Documentation
¶
Index ¶
- func Version() string
- type Instrumentation
- type InstrumentationOption
- func WithEnv() InstrumentationOption
- func WithGlobal() InstrumentationOption
- func WithPID(pid int) InstrumentationOption
- func WithResourceAttributes(attrs ...attribute.KeyValue) InstrumentationOption
- func WithSampler(sampler trace.Sampler) InstrumentationOption
- func WithServiceName(serviceName string) InstrumentationOption
- func WithTarget(path string) InstrumentationOption
- func WithTraceExporter(exp trace.SpanExporter) InstrumentationOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Instrumentation ¶ added in v0.20.0
type Instrumentation struct {
// contains filtered or unexported fields
}
Instrumentation manages and controls all OpenTelemetry Go auto-instrumentation.
func NewInstrumentation ¶ added in v0.20.0
func NewInstrumentation(ctx context.Context, opts ...InstrumentationOption) (*Instrumentation, error)
NewInstrumentation returns a new Instrumentation configured with the provided opts.
If conflicting or duplicate options are provided, the last one will have precedence and be used.
func (*Instrumentation) Close ¶ added in v0.20.0
func (i *Instrumentation) Close() error
Close closes the Instrumentation, cleaning up all used resources.
type InstrumentationOption ¶ added in v0.20.0
type InstrumentationOption interface {
// contains filtered or unexported methods
}
InstrumentationOption applies a configuration option to Instrumentation.
func WithEnv ¶ added in v0.20.0
func WithEnv() InstrumentationOption
WithEnv returns an InstrumentationOption that will configure Instrumentation using the values defined by the following environment variables:
- OTEL_GO_AUTO_TARGET_EXE: sets the target binary
- OTEL_SERVICE_NAME (or OTEL_RESOURCE_ATTRIBUTES): sets the service name
- OTEL_TRACES_EXPORTER: sets the trace exporter
This option may conflict with WithTarget, WithPID, WithTraceExporter, and WithServiceName if their respective environment variable is defined. If more than one of these options are used, the last one provided to an Instrumentation will be used.
The OTEL_TRACES_EXPORTER environment variable value is resolved using the autoexport package. See that package's documentation for information on supported values and registration of custom exporters.
func WithGlobal ¶ added in v0.20.0
func WithGlobal() InstrumentationOption
WithGlobal returns an InstrumentationOption that will configure an Instrumentation to record telemetry from the OpenTelemetry default global implementation. By default, the OpenTelemetry global implementation is a no-op implementation of the OpenTelemetry API. However, by using this option, all telemetry that would have been dropped by the global implementation will be recorded using telemetry pipelines from the configured Instrumentation.
If the target process overrides the default global implementation (e.g. [otel.SetTracerProvider]), the telemetry from that process will go to the set implementation. It will not be recorded using the telemetry pipelines from the configured Instrumentation even if this option is used.
The OpenTelemetry default global implementation is left unchanged (i.e. it remains a no-op implementation) if this options is not used.
func WithPID ¶ added in v0.20.0
func WithPID(pid int) InstrumentationOption
WithPID returns an InstrumentationOption defining the target binary for Instrumentation that is being run with the provided PID.
This option conflicts with WithTarget. If both are used, the last one provided to an Instrumentation will be used.
If multiple of these options are provided to an Instrumentation, the last one will be used.
If OTEL_GO_AUTO_TARGET_EXE is defined, this option will conflict with WithEnv. If both are used, the last one provided to an Instrumentation will be used.
func WithResourceAttributes ¶ added in v0.20.0
func WithResourceAttributes(attrs ...attribute.KeyValue) InstrumentationOption
WithResourceAttributes returns an InstrumentationOption that will configure an Instrumentation to add the provided attributes to the OpenTelemetry resource.
func WithSampler ¶ added in v0.20.0
func WithSampler(sampler trace.Sampler) InstrumentationOption
WithSampler returns an InstrumentationOption that will configure an Instrumentation to use the provided sampler to sample OpenTelemetry traces.
func WithServiceName ¶ added in v0.20.0
func WithServiceName(serviceName string) InstrumentationOption
WithServiceName returns an InstrumentationOption defining the name of the service running.
If multiple of these options are provided to an Instrumentation, the last one will be used.
If OTEL_SERVICE_NAME is defined or the service name is defined in OTEL_RESOURCE_ATTRIBUTES, this option will conflict with WithEnv. If both are used, the last one provided to an Instrumentation will be used.
func WithTarget ¶ added in v0.20.0
func WithTarget(path string) InstrumentationOption
WithTarget returns an InstrumentationOption defining the target binary for Instrumentation that is being executed at the provided path.
This option conflicts with WithPID. If both are used, the last one provided to an Instrumentation will be used.
If multiple of these options are provided to an Instrumentation, the last one will be used.
If OTEL_GO_AUTO_TARGET_EXE is defined, this option will conflict with WithEnv. If both are used, the last one provided to an Instrumentation will be used.
func WithTraceExporter ¶ added in v0.20.0
func WithTraceExporter(exp trace.SpanExporter) InstrumentationOption
WithTraceExporter returns an InstrumentationOption that will configure an Instrumentation to use the provided exp to export OpenTelemetry tracing telemetry.
If OTEL_TRACES_EXPORTER is defined, this option will conflict with WithEnv. If both are used, the last one provided to an Instrumentation will be used.
Directories
¶
Path | Synopsis |
---|---|
examples
module
|
|
httpPlusdb
Module
|
|
kafka-go
Module
|
|
kafka-go/consumer
Module
|
|
kafka-go/producer
Module
|
|
rolldice
Module
|
|
rolldice/user
Module
|
|
internal
|
|
pkg/instrumentation/probe
Package probe provides instrumentation probe types and definitions.
|
Package probe provides instrumentation probe types and definitions. |
pkg/structfield
Package structfield provides types to track struct field offsets.
|
Package structfield provides types to track struct field offsets. |
test/e2e/autosdk
Module
|
|
test/e2e/gorillamux
Module
|
|
test/e2e/kafka-go
Module
|
|
tools
Module
|
|
offsets-tracker
module
|
|
sdk
module
|
|
internal/telemetry/test
Module
|
|
telemetry/test
Module
|
|
test
|
|
e2e/gin
Module
|
|
e2e/gorillamux
Module
|
|
e2e/nethttp
Module
|