Documentation ¶
Index ¶
- func ConfigureOpentelemetry(opts ...Option)
- func ForceFlush(ctx context.Context) error
- func ReportError(ctx context.Context, err error, opts ...trace.EventOption)
- func ReportPanic(ctx context.Context)
- func SetLogger(logger internal.ILogger)
- func Shutdown(ctx context.Context) error
- func TraceURL(span trace.Span) string
- func TracerProvider() *sdktrace.TracerProvider
- func Version() string
- type DSN
- type MetricsOption
- type Option
- func WithDSN(dsn string) Option
- func WithDeploymentEnvironment(env string) Option
- func WithResource(resource *resource.Resource) Option
- func WithResourceAttributes(attrs []attribute.KeyValue) Option
- func WithResourceDetectors(detectors ...resource.Detector) Option
- func WithServiceName(serviceName string) Option
- func WithServiceVersion(serviceVersion string) Option
- type TracingOption
- func WithBatchSpanProcessorOption(opts ...sdktrace.BatchSpanProcessorOption) TracingOption
- func WithPrettyPrintSpanExporter() TracingOption
- func WithPropagator(propagator propagation.TextMapPropagator) TracingOption
- func WithTextMapPropagator(propagator propagation.TextMapPropagator) TracingOption
- func WithTraceSampler(sampler sdktrace.Sampler) TracingOption
- func WithTracerProvider(provider *sdktrace.TracerProvider) TracingOption
- func WithTracingDisabled() TracingOption
- func WithTracingEnabled(on bool) TracingOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureOpentelemetry ¶ added in v0.19.0
func ConfigureOpentelemetry(opts ...Option)
ConfigureOpentelemetry configures OpenTelemetry to export data to Uptrace. By default it:
- creates tracer provider;
- registers Uptrace span exporter;
- sets tracecontext + baggage composite context propagator.
You can use UPTRACE_DISABLED env var to completely skip Uptrace configuration.
func ForceFlush ¶ added in v0.20.0
func ReportError ¶ added in v0.19.0
func ReportError(ctx context.Context, err error, opts ...trace.EventOption)
func ReportPanic ¶ added in v0.19.0
func TracerProvider ¶ added in v1.9.0
func TracerProvider() *sdktrace.TracerProvider
Types ¶
type DSN ¶ added in v1.3.1
type MetricsOption ¶ added in v1.0.0
type MetricsOption interface { Option // contains filtered or unexported methods }
func WithMetricsDisabled ¶ added in v1.0.0
func WithMetricsDisabled() MetricsOption
WithMetricsDisabled disables metrics.
func WithMetricsEnabled ¶ added in v1.1.0
func WithMetricsEnabled(on bool) MetricsOption
WithMetricsEnabled can be used to enable/disable metrics.
type Option ¶ added in v0.6.0
type Option interface {
// contains filtered or unexported methods
}
func WithDSN ¶ added in v1.0.0
WithDSN configures a data source name that is used to connect to Uptrace, for example, `https://<token>@api.uptrace.dev/<project_id>`.
The default is to use UPTRACE_DSN environment variable.
func WithDeploymentEnvironment ¶ added in v1.0.4
WithDeploymentEnvironment configures `deployment.environment` resource attribute, for example, `production`.
func WithResource ¶ added in v1.0.0
WithResource configures a resource that describes an entity that produces telemetry, for example, such attributes as host.name and service.name. All produced spans and metrics will have these attributes.
WithResource overrides and replaces any other resource attributes.
func WithResourceAttributes ¶ added in v1.0.0
WithResourceAttributes configures resource attributes that describe an entity that produces telemetry, for example, such attributes as host.name, service.name, etc.
The default is to use `OTEL_RESOURCE_ATTRIBUTES` env var, for example, `OTEL_RESOURCE_ATTRIBUTES=service.name=myservice,service.version=1.0.0`.
func WithResourceDetectors ¶ added in v1.3.1
WithResourceDetectors adds detectors to be evaluated for the configured resource.
func WithServiceName ¶ added in v1.0.0
WithServiceVersion configures `service.name` resource attribute.
func WithServiceVersion ¶ added in v1.0.0
WithServiceVersion configures `service.version` resource attribute, for example, `1.0.0`.
type TracingOption ¶ added in v1.0.0
type TracingOption interface { Option // contains filtered or unexported methods }
func WithBatchSpanProcessorOption ¶ added in v1.9.0
func WithBatchSpanProcessorOption(opts ...sdktrace.BatchSpanProcessorOption) TracingOption
WithBatchSpanProcessorOption specifies options used to created BatchSpanProcessor.
func WithPrettyPrintSpanExporter ¶ added in v1.0.0
func WithPrettyPrintSpanExporter() TracingOption
WithPrettyPrintSpanExporter adds a span exproter that prints spans to stdout. It is useful for debugging or demonstration purposes.
func WithPropagator ¶ added in v1.9.0
func WithPropagator(propagator propagation.TextMapPropagator) TracingOption
WithPropagator sets the global TextMapPropagator used by OpenTelemetry. The default is propagation.TraceContext and propagation.Baggage.
func WithTextMapPropagator ¶ added in v1.0.0
func WithTextMapPropagator(propagator propagation.TextMapPropagator) TracingOption
WithTextMapPropagator is an alias for WithPropagator.
func WithTraceSampler ¶ added in v1.0.0
func WithTraceSampler(sampler sdktrace.Sampler) TracingOption
WithTraceSampler configures a span sampler.
func WithTracerProvider ¶ added in v1.0.0
func WithTracerProvider(provider *sdktrace.TracerProvider) TracingOption
TracerProvider overwrites the default Uptrace tracer provider. You can use it to configure Uptrace distro to use OTLP exporter.
func WithTracingDisabled ¶ added in v1.0.0
func WithTracingDisabled() TracingOption
WithTracingDisabled disables tracing.
func WithTracingEnabled ¶ added in v1.1.0
func WithTracingEnabled(on bool) TracingOption
WithTracingEnabled can be used to enable/disable tracing.