Documentation ¶
Index ¶
- Constants
- type OperationIDKey
- type TelemetryObj
- type XField
- type XTelemetryConfig
- type XTelemetryObject
- type XTelemetryObjectImpl
- func (t *XTelemetryObjectImpl) Debug(ctx context.Context, message string, fields ...XField)
- func (t *XTelemetryObjectImpl) Dependency(ctx context.Context, dependencyType string, target string, success bool, ...)
- func (t *XTelemetryObjectImpl) Error(ctx context.Context, message string, fields ...XField)
- func (t *XTelemetryObjectImpl) Info(ctx context.Context, message string, fields ...XField)
- func (t *XTelemetryObjectImpl) Request(ctx context.Context, method string, url string, duration time.Duration, ...)
- func (t *XTelemetryObjectImpl) Warn(ctx context.Context, message string, fields ...XField)
Constants ¶
const ( // OperationIDKeyContextKey is the key used to store the operation ID in context OperationIDKeyContextKey OperationIDKey = "operationID" // TelemetryContextKey represents the key type for the telemetry object in context TelemetryContextKey TelemetryObj = "telemetry" // Service name key ServiceNameKey = "ServiceName" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OperationIDKey ¶
type OperationIDKey string
OperationIDKey represents the key type for the operation ID in context
type TelemetryObj ¶
type TelemetryObj string
type XTelemetryConfig ¶ added in v1.0.22
type XTelemetryConfig interface { GetInstrumentationKey() string GetServiceName() string GetLogLevel() string GetCallerSkip() int SetInstrumentationKey(string) SetServiceName(string) SetLogLevel(string) SetCallerSkip(int) }
func NewXTelemetryConfig ¶ added in v1.0.23
func NewXTelemetryConfig(instrumentationKey string, serviceName string, logLevel string, callerSkip int) XTelemetryConfig
type XTelemetryObject ¶ added in v1.0.25
type XTelemetryObject interface { Debug(ctx context.Context, message string, fields ...XField) Info(ctx context.Context, message string, fields ...XField) Warn(ctx context.Context, message string, fields ...XField) Error(ctx context.Context, message string, fields ...XField) Dependency(ctx context.Context, dependencyType string, target string, success bool, startTime time.Time, endTime time.Time, message string, fields ...XField) Request(ctx context.Context, method string, url string, duration time.Duration, responseCode string, success bool, source string, message string, fields ...XField) }
type XTelemetryObjectImpl ¶ added in v1.0.26
type XTelemetryObjectImpl struct {
// contains filtered or unexported fields
}
XTelemetryObjectImpl will store the logger, the app insights client and the service name
func GetXTelemetryClient ¶ added in v1.0.34
func GetXTelemetryClient(ctx context.Context) *XTelemetryObjectImpl
Helper function to retrieve the telemetry client from the context
func NewXTelemetry ¶ added in v1.0.22
func NewXTelemetry(cc XTelemetryConfig) (*XTelemetryObjectImpl, error)
Initialize the telemetry object
func (*XTelemetryObjectImpl) Debug ¶ added in v1.0.26
func (t *XTelemetryObjectImpl) Debug(ctx context.Context, message string, fields ...XField)
Debug will log the message using xTelemetry (no trace to App Insights)
func (*XTelemetryObjectImpl) Dependency ¶ added in v1.0.37
func (t *XTelemetryObjectImpl) Dependency(ctx context.Context, dependencyType string, target string, success bool, startTime time.Time, endTime time.Time, message string, fields ...XField)
Dependency will log the dependency using xTelemetry and also send a dependency to App Insights
func (*XTelemetryObjectImpl) Error ¶ added in v1.0.26
func (t *XTelemetryObjectImpl) Error(ctx context.Context, message string, fields ...XField)
Error will log the message using xTelemetry and also send an exception to App Insights
func (*XTelemetryObjectImpl) Info ¶ added in v1.0.26
func (t *XTelemetryObjectImpl) Info(ctx context.Context, message string, fields ...XField)
Info will log the message using xTelemetry and also send a trace to App Insights
func (*XTelemetryObjectImpl) Request ¶ added in v1.0.37
func (t *XTelemetryObjectImpl) Request(ctx context.Context, method string, url string, duration time.Duration, responseCode string, success bool, source string, message string, fields ...XField)
Request will log the request using xTelemetry and also send a request to App Insights