Documentation
¶
Index ¶
- func NewResource(ctx context.Context, opts Options) (*resource.Resource, error)
- type Option
- func WithEnvironment(env string) Option
- func WithExportInterval(interval time.Duration) Option
- func WithExporterTimeout(timeout time.Duration) Option
- func WithExporterURL(url string) Option
- func WithInsecure(insecure bool) Option
- func WithServiceName(name string) Option
- func WithServiceVersion(version string) Option
- type Options
- type ShutdownFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
Option is a functional option for configuring OpenTelemetry providers.
func WithEnvironment ¶
WithEnvironment sets the deployment environment. Defaults to "development" if not set.
func WithExportInterval ¶
WithExportInterval sets the interval for periodic metric exports. Defaults to 60 seconds if not set or zero. Only used by metrics provider.
func WithExporterTimeout ¶
WithExporterTimeout sets the timeout for exporter operations. Defaults to 10 seconds if not set or zero.
func WithExporterURL ¶
WithExporterURL sets the OTLP exporter endpoint URL (required).
func WithInsecure ¶
WithInsecure sets whether to use insecure connection. Should be true for local development, false for production.
func WithServiceName ¶
WithServiceName sets the service name (required).
func WithServiceVersion ¶
WithServiceVersion sets the service version. Defaults to "unknown" if not set.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options contains shared configuration for OpenTelemetry providers.
func NewOptions ¶
NewOptions creates a new Options with the provided functional options.
func (Options) Environment ¶
func (Options) ExportInterval ¶
func (Options) ExporterTimeout ¶
func (Options) ExporterURL ¶
func (Options) ServiceName ¶
func (Options) ServiceVersion ¶
type ShutdownFunc ¶
ShutdownFunc is a function that shuts down an OpenTelemetry provider. It should be called when the application exits to ensure all telemetry data is flushed.