Version: v1.9.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2022 License: BSD-2-Clause Imports: 29 Imported by: 11




This section is empty.


This section is empty.


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 ForceFlush(ctx context.Context) error

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 ReportPanic(ctx context.Context)

func SetLogger added in v0.5.3

func SetLogger(logger internal.ILogger)

SetLogger sets the logger to the given one.

func Shutdown added in v0.19.0

func Shutdown(ctx context.Context) error

func TraceURL added in v0.19.0

func TraceURL(span trace.Span) string

func TracerProvider added in v1.9.0

func TracerProvider() *sdktrace.TracerProvider

func Version added in v1.0.0

func Version() string

Version is the current release version.


type DSN added in v1.3.1

type DSN struct {
	Scheme string
	Host   string

	ProjectID string
	Token     string
	// contains filtered or unexported fields

func ParseDSN added in v1.3.1

func ParseDSN(dsnStr string) (*DSN, error)

func (*DSN) AppAddr added in v1.3.1

func (dsn *DSN) AppAddr() string

func (*DSN) OTLPHost added in v1.3.1

func (dsn *DSN) OTLPHost() string

func (*DSN) String added in v1.3.1

func (dsn *DSN) String() string

type MetricsOption added in v1.0.0

type MetricsOption interface {
	// 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

func WithDSN(dsn string) Option

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

func WithDeploymentEnvironment(env string) Option

WithDeploymentEnvironment configures `deployment.environment` resource attribute, for example, `production`.

func WithResource added in v1.0.0

func WithResource(resource *resource.Resource) Option

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

func WithResourceAttributes(attrs []attribute.KeyValue) Option

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

func WithResourceDetectors(detectors ...resource.Detector) Option

WithResourceDetectors adds detectors to be evaluated for the configured resource.

func WithServiceName added in v1.0.0

func WithServiceName(serviceName string) Option

WithServiceVersion configures `service.name` resource attribute.

func WithServiceVersion added in v1.0.0

func WithServiceVersion(serviceVersion string) Option

WithServiceVersion configures `service.version` resource attribute, for example, `1.0.0`.

type TracingOption added in v1.0.0

type TracingOption interface {
	// 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL