Documentation
¶
Index ¶
- Constants
- func CheckHasTraceID(ctx context.Context) bool
- func ExtractHTTPBaggage(ctx context.Context, header http.Header) context.Context
- func GetTraceId(ctx context.Context) string
- func InjectHTTPBaggage(ctx context.Context, header http.Header)
- func SetIfCtxErr(span oteltrace.Span, ctx context.Context)
- func SetIfErr(span oteltrace.Span, err error)
- func SpanID(span oteltrace.Span) string
- func TraceID(span oteltrace.Span) string
- func TraceIdFromCtx(ctx context.Context) string
- func Tracer() oteltrace.Tracer
- type Config
- type Exporter
- type OTLP
- type OtelGRPC
- type OtelHTTP
- type Provider
- type ServiceInfo
- type TraceConfigLoader
Constants ¶
View Source
const ( Baggage = "baggage" AttributeTraceID = attribute.Key("trace.id") AttributeSpanID = attribute.Key("span.id") AttributeLogID = attribute.Key("log_id") AttributeRequest = attribute.Key("request") AttributeResponse = attribute.Key("response") AttributeGinError = attribute.Key("gin.errors") AttributeRedisError = attribute.Key("redis.cmd.error") AttributeRedisCmdName = attribute.Key("redis.cmd.name") AttributeRedisCmdString = attribute.Key("redis.cmd.string") AttributeRedisCmdArgs = attribute.Key("redis.cmd.args") )
View Source
const DefaultStdout = "stdout"
View Source
const (
KeyErrMsg = "err_msg"
)
Variables ¶
This section is empty.
Functions ¶
func CheckHasTraceID ¶
func ExtractHTTPBaggage ¶
func GetTraceId ¶
func SetIfCtxErr ¶
SetIfCtxErr record context error
func TraceIdFromCtx ¶
Types ¶
type Config ¶
type Config struct {
TraceExporter Exporter `yaml:"trace_exporter"`
MetricExporter Exporter `yaml:"metric_exporter"`
SampleRatio float64 `yaml:"sample_ratio"`
Service ServiceInfo `yaml:"service"`
Headers map[string]string `yaml:"headers"`
// contains filtered or unexported fields
}
func DefaultCfg ¶ added in v2.2.0
func DefaultCfg() Config
type Exporter ¶
type Exporter struct {
ExporterEndpoint string `yaml:"endpoint"`
Insecure bool `yaml:"insecure"`
Creds credentials.TransportCredentials `yaml:"-"`
}
type OTLP ¶ added in v2.2.0
type OTLP struct {
GRPC *OtelGRPC `yaml:"grpc,omitempty"`
HTTP *OtelHTTP `yaml:"http,omitempty"`
AddEntryPointsLabels bool `yaml:"addEntryPointsLabels,omitempty"`
AddRoutersLabels bool `yaml:"addRoutersLabels,omitempty"`
AddServicesLabels bool `yaml:"addServicesLabels,omitempty"`
ExplicitBoundaries []float64 `yaml:"explicitBoundaries,omitempty"`
PushInterval *durationpb.Duration `yaml:"pushInterval,omitempty"`
ServiceName string `yaml:"serviceName,omitempty"`
}
OTLP contains specific configuration used by the OpenTelemetry Metric exporter.
func (*OTLP) SetDefaults ¶ added in v2.2.0
func (o *OTLP) SetDefaults()
type OtelGRPC ¶ added in v2.2.0
type OtelGRPC struct {
Endpoint string `yaml:"endpoint"`
Insecure bool `yaml:"insecure"`
Headers map[string]string `yaml:"headers"`
}
func (*OtelGRPC) SetDefaults ¶ added in v2.2.0
func (c *OtelGRPC) SetDefaults()
type OtelHTTP ¶ added in v2.2.0
type OtelHTTP struct {
Endpoint string `yaml:"endpoint"`
Headers map[string]string `yaml:"headers"`
}
func (*OtelHTTP) SetDefaults ¶ added in v2.2.0
func (c *OtelHTTP) SetDefaults()
type Provider ¶
type Provider struct {
TracerProvider oteltrace.TracerProvider
Tracer oteltrace.Tracer
MeterProvider otelmetric.MeterProvider
Meter otelmetric.Meter
}
type ServiceInfo ¶
type TraceConfigLoader ¶ added in v2.2.0
type TraceConfigLoader struct {
TraceCfg *Config `yaml:"tracing"`
}
Click to show internal directories.
Click to hide internal directories.