Documentation ¶
Index ¶
- Constants
- func AddSpanEvent(span trace.Span, event string)
- func AddSpanEventWithOption(span trace.Span, event string, options trace.SpanStartEventOption)
- func IsOTelEnabled() bool
- func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue)
- func PeerAttr(addr string) []attribute.KeyValue
- func PeerFromCtx(ctx context.Context) string
- func SetSpanStatus(span trace.Span, code codes2.Code, statusMessage string)
- func SetupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shutdown func(context.Context) error, err error, ...)
- func StartClientSpan(ctx context.Context, tracer trace.Tracer, serviceName string, ...) (context.Context, trace.Span)
- func StartServerSpanFromClientContext(ctx context.Context, tracer trace.Tracer, serviceNames string, ...) (trace.SpanContext, context.Context, trace.Span)
- func TelemetryAttributes(fullMethod, peerAddress string) (string, []attribute.KeyValue, []attribute.KeyValue)
- type OTELConfig
Constants ¶
View Source
const ( OTEL_HOSTNAME = "OTEL_HOSTNAME" OTEL_PROTOCOL = "OTEL_PROTOCOL" OTEL_PORT = "OTEL_PORT" OTEL_ENABLED = "OTEL_ENABLED" OTEL_SERVICE_NAME = "OTEL_SERVICE_NAME" OTEL_TRACE_SAMPLING_RATE = "OTEL_TRACE_SAMPLING_RATE" )
Variables ¶
This section is empty.
Functions ¶
func AddSpanEvent ¶
func AddSpanEventWithOption ¶
func AddSpanEventWithOption(span trace.Span, event string, options trace.SpanStartEventOption)
func IsOTelEnabled ¶
func IsOTelEnabled() bool
func ParseFullMethod ¶
ParseFullMethod returns a span name following the OpenTelemetry semantic conventions as well as all applicable span attribute.KeyValue attributes based on a gRPC's FullMethod.
Parsing is consistent with grpc-go implementation: https://github.com/grpc/grpc-go/blob/v1.57.0/internal/grpcutil/method.go#L26-L39
func PeerFromCtx ¶
peerFromCtx returns a peer address from a context, if one exists.
func SetupOTelSDK ¶
func SetupOTelSDK(ctx context.Context, serviceName, serviceVersion string) (shutdown func(context.Context) error, err error, meterProvider *metric.MeterProvider, tracerProvider *trace.TracerProvider)
setupOTelSDK bootstraps the OpenTelemetry pipeline. If it does not return an error, make sure to call shutdown for proper cleanup.
func StartClientSpan ¶
Types ¶
type OTELConfig ¶
type OTELConfig struct {
// contains filtered or unexported fields
}
func NewOTELConfig ¶
func NewOTELConfig() *OTELConfig
func (*OTELConfig) GetOTELEndpoint ¶
func (o *OTELConfig) GetOTELEndpoint() string
Click to show internal directories.
Click to hide internal directories.