Documentation
¶
Index ¶
- Constants
- func ExtractOTelSpanID(span trace.Span) string
- func ExtractOTelTraceID(span trace.Span) string
- func FinishSpans(spans *Spans)
- func GetDefaultServiceSpanAttributes(ctx context.Context) []attribute.KeyValue
- func InitOpenTelemetry(ctx context.Context, cfg *OpenTelemetryConfig) error
- func LogInfo(ctx context.Context, msg string, fields ...log.Field)
- func Recover(spans *Spans, logger logger.Logger)
- func RecoveryWithTelemetry(log logger.Logger) gin.HandlerFunc
- func SetDefaultServiceSpanAttributes(ctx context.Context, span trace.Span)
- func SetSpanKindConsumer(spans *Spans)
- func SetSpanKindDatabase(spans *Spans)
- func SetSpanKindInternal(spans *Spans)
- func SetSpanKindServer(spans *Spans)
- func TagComponentCronJob(spans *Spans)
- func TagComponentGraphQL(spans *Spans)
- func TagComponentListener(spans *Spans)
- func TagComponentPostgres(spans *Spans)
- func TagComponentREST(spans *Spans)
- func TagComponentService(spans *Spans)
- type OpenTelemetryConfig
- type SpanOptions
- type Spans
- func StartCronSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartGraphQLSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartListenerSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartPostgresSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartRestSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartServiceSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func StartSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
- func (s *Spans) Finish()
- func (s *Spans) LogFields(fields ...log.Field)
- func (s *Spans) LogKV(alternatingKeyValues ...interface{})
- func (s *Spans) LogObjectAsJson(key string, obj interface{})
- func (s *Spans) TagBool(key string, value bool)
- func (s *Spans) TagEntity(entityId string)
- func (s *Spans) TagInt(key string, value int)
- func (s *Spans) TagString(key, value string)
- func (s *Spans) TagStringSlice(key string, value []string)
- func (s *Spans) TagUint32(key string, value uint32)
- func (s *Spans) TraceError(err error)
Constants ¶
const ( ComponentGraphQL = "graphql" ComponentPostgres = "postgres" ComponentREST = "rest" ComponentService = "service" ComponentListener = "listener" ComponentCronJob = "cron" )
Component tag constants
const ( SpanTagTenant = "tenant" SpanTagUserId = "user.id" SpanTagEntityId = "entity.id" )
const ( SpanKindInternal = "internal" SpanKindServer = "server" SpanKindClient = "client" SpanKindConsumer = "consumer" )
SpanKind constants
Variables ¶
This section is empty.
Functions ¶
func ExtractOTelSpanID ¶ added in v0.2.1
ExtractOTelSpanID extracts OpenTelemetry span ID from span
func ExtractOTelTraceID ¶ added in v0.2.1
ExtractOTelTraceID extracts OpenTelemetry trace ID from span
func GetDefaultServiceSpanAttributes ¶ added in v0.2.1
GetDefaultServiceSpanAttributes returns default attributes for service spans
func InitOpenTelemetry ¶
func InitOpenTelemetry(ctx context.Context, cfg *OpenTelemetryConfig) error
InitOpenTelemetry initializes OpenTelemetry with the given configuration
func RecoveryWithTelemetry ¶ added in v0.2.24
func RecoveryWithTelemetry(log logger.Logger) gin.HandlerFunc
RecoveryWithTelemetry creates a gin middleware that recovers from panics and logs them to both Jaeger and OpenTelemetry
func SetDefaultServiceSpanAttributes ¶ added in v0.2.1
SetDefaultServiceSpanAttributes sets default attributes on a span
func SetSpanKindConsumer ¶
func SetSpanKindConsumer(spans *Spans)
func SetSpanKindDatabase ¶
func SetSpanKindDatabase(spans *Spans)
func SetSpanKindServer ¶
func SetSpanKindServer(spans *Spans)
func TagComponentCronJob ¶
func TagComponentCronJob(spans *Spans)
func TagComponentListener ¶
func TagComponentListener(spans *Spans)
func TagComponentPostgres ¶
func TagComponentPostgres(spans *Spans)
func TagComponentREST ¶
func TagComponentREST(spans *Spans)
func TagComponentService ¶
func TagComponentService(spans *Spans)
Types ¶
type OpenTelemetryConfig ¶
type SpanOptions ¶ added in v0.2.1
type SpanOptions struct {
NewRoot bool
}
SpanOptions defines options for span creation
func WithNewRoot ¶ added in v0.2.1
func WithNewRoot() SpanOptions
WithForceNewTrace returns a SpanOptions that forces creation of a new trace
type Spans ¶
Types and Constants
func StartCronSpan ¶
func StartCronSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
Component-specific Span Starters
func StartGraphQLSpan ¶
func StartListenerSpan ¶
func StartPostgresSpan ¶
func StartRestSpan ¶
func StartServiceSpan ¶
func StartSpan ¶ added in v0.2.15
func StartSpan(ctx context.Context, operationName string, opts ...SpanOptions) (*Spans, context.Context)
Core Span Operations