metrics

package
v0.1.64 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricEdgeMsgIn  = "tiny.edge.msg.in"
	MetricEdgeMsgOut = "tiny.edge.msg.out"
)

Variables

This section is empty.

Functions

func ConfigureOpenTelemetry added in v0.1.63

func ConfigureOpenTelemetry(opts ...Option) error

ConfigureOpenTelemetry configures OpenTelemetry. You can use OTLP_DISABLED env var to completely skip open telemetry configuration.

func ForceFlush added in v0.1.63

func ForceFlush(ctx context.Context) error

func ReportError added in v0.1.63

func ReportError(ctx context.Context, err error, opts ...trace.EventOption)

func ReportPanic added in v0.1.63

func ReportPanic(ctx context.Context)

func Shutdown added in v0.1.63

func Shutdown(ctx context.Context) error

func TracerProvider added in v0.1.63

func TracerProvider() *sdktrace.TracerProvider

Types

type DSN added in v0.1.63

type DSN struct {
	Scheme   string
	Host     string
	GRPCPort string
	Token    string
	// contains filtered or unexported fields
}

func ParseDSN added in v0.1.63

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

func (*DSN) OTLPEndpoint added in v0.1.63

func (dsn *DSN) OTLPEndpoint() string

func (*DSN) String added in v0.1.63

func (dsn *DSN) String() string

type Metric

type Metric string

type MetricsOption added in v0.1.63

type MetricsOption interface {
	Option
	// contains filtered or unexported methods
}

func WithMetricOption added in v0.1.63

func WithMetricOption(options ...metric.Option) MetricsOption

func WithMetricsDisabled added in v0.1.63

func WithMetricsDisabled() MetricsOption

WithMetricsDisabled disables metrics.

func WithMetricsEnabled added in v0.1.63

func WithMetricsEnabled(on bool) MetricsOption

WithMetricsEnabled can be used to enable/disable metrics.

type Option added in v0.1.63

type Option interface {
	// contains filtered or unexported methods
}

func WithDSN added in v0.1.63

func WithDSN(dsn string) Option

WithDSN configures a data source name that is used to connect `https://<token>@api.tinysystems.io`.

The default is to use OTLP_DSN environment variable.

func WithDeploymentEnvironment added in v0.1.63

func WithDeploymentEnvironment(env string) Option

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

func WithResource added in v0.1.63

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 v0.1.63

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 v0.1.63

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

WithResourceDetectors adds detectors to be evaluated for the configured resource.

func WithServiceName added in v0.1.63

func WithServiceName(serviceName string) Option

WithServiceName configures `service.name` resource attribute.

func WithServiceVersion added in v0.1.63

func WithServiceVersion(serviceVersion string) Option

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

func WithTLSConfig added in v0.1.63

func WithTLSConfig(tlsConf *tls.Config) Option

type TracingOption added in v0.1.63

type TracingOption interface {
	Option
	// contains filtered or unexported methods
}

func WithBatchSpanProcessorOption added in v0.1.63

func WithBatchSpanProcessorOption(opts ...sdktrace.BatchSpanProcessorOption) TracingOption

WithBatchSpanProcessorOption specifies options used to created BatchSpanProcessor.

func WithPrettyPrintSpanExporter added in v0.1.63

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 v0.1.63

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 v0.1.63

func WithTextMapPropagator(propagator propagation.TextMapPropagator) TracingOption

WithTextMapPropagator is an alias for WithPropagator.

func WithTraceSampler added in v0.1.63

func WithTraceSampler(sampler sdktrace.Sampler) TracingOption

WithTraceSampler configures a span sampler.

func WithTracerProvider added in v0.1.63

func WithTracerProvider(provider *sdktrace.TracerProvider) TracingOption

WithTracerProvider overwrites the default tracer provider.

When this option is used, you might need to call otel.SetTracerProvider to register the provider as the global trace provider.

func WithTracingDisabled added in v0.1.63

func WithTracingDisabled() TracingOption

WithTracingDisabled disables tracing.

func WithTracingEnabled added in v0.1.63

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