Documentation
¶
Overview ¶
package ldobserve provides LaunchDarkly observability functionality for Go applications.
This package is currently in early access preview. APIs are subject to change until a 1.x version is released.
Package ldobserve contains an AI SDK suitable for usage with generative AI applications.
Index ¶
- Constants
- func EndSpan(span trace.Span)
- func RecordCount(ctx context.Context, name string, value int64, tags ...attribute.KeyValue)
- func RecordError(ctx context.Context, err error, tags ...attribute.KeyValue) context.Context
- func RecordHistogram(ctx context.Context, name string, value float64, tags ...attribute.KeyValue)
- func RecordLog(ctx context.Context, record log.Record, tags ...log.KeyValue) error
- func RecordMetric(ctx context.Context, name string, value float64, tags ...attribute.KeyValue)
- func Shutdown()
- func Start() error
- func StartSpan(ctx context.Context, name string, opts []trace.SpanStartOption, ...) (context.Context, trace.Span)
- type ObservabilityPlugin
- type Option
- func WithBackendURL(backendURL string) Option
- func WithContext(ctx context.Context) Option
- func WithDebug() Option
- func WithEnvironment(environment string) Option
- func WithManualStart() Option
- func WithOTLPEndpoint(otlpEndpoint string) Option
- func WithSamplingRateMap(rates map[trace.SpanKind]float64) Option
- func WithServiceName(serviceName string) Option
- func WithServiceVersion(serviceVersion string) Option
Constants ¶
const Version = metadata.InstrumentationVersion
Version is the current version string of the observability package. This is updated by our release scripts.
Variables ¶
This section is empty.
Functions ¶
func EndSpan ¶
EndSpan is used to end a span. The span will include a stack trace when this function is used to end the span.
func RecordCount ¶
RecordCount is used to record arbitrary counts in your golang backend.
func RecordError ¶
RecordError is used to record an error in the current span. If there is an active recording span, then the error is recorded in the span. If there is no active recording span, then a new span is created and the error is recorded in it. If this function starts a span, then that span will be ended after the error is recorded.
func RecordHistogram ¶
RecordHistogram is used to record arbitrary histograms in your golang backend.
func RecordMetric ¶
RecordMetric is used to record arbitrary metrics in your golang backend.
func Shutdown ¶
func Shutdown()
Shutdown stops the observability plugin. It is recommended to call this function when the application is shutting down.
Types ¶
type ObservabilityPlugin ¶
type ObservabilityPlugin struct { ldplugins.Unimplemented // contains filtered or unexported fields }
ObservabilityPlugin represents the LaunchDarkly observability plugin.
func NewObservabilityPlugin ¶
func NewObservabilityPlugin(opts ...Option) *ObservabilityPlugin
NewObservabilityPlugin creates a new observability plugin with the given configuration.
func (ObservabilityPlugin) GetHooks ¶
func (p ObservabilityPlugin) GetHooks(_ ldplugins.EnvironmentMetadata) []ldhooks.Hook
GetHooks returns the hooks for the observability plugin.
func (ObservabilityPlugin) Metadata ¶
func (p ObservabilityPlugin) Metadata() ldplugins.Metadata
Metadata returns the metadata for the observability plugin.
func (ObservabilityPlugin) Register ¶
func (p ObservabilityPlugin) Register(client interfaces.LDClientInterface, ldmd ldplugins.EnvironmentMetadata)
Register registers the observability plugin with the LaunchDarkly client.
type Option ¶
type Option func(*observabilityConfig)
Option is a function that configures the observability plugin.
func WithBackendURL ¶
WithBackendURL sets the backend URL for the observability plugin.
func WithContext ¶
WithContext sets the context for the observability plugin. Cancelling the provided context will stop the observability plugin. Calling the Shutdown function is recommended and provides a greater level of control.
func WithDebug ¶
func WithDebug() Option
WithDebug enables debug mode for the observability plugin. This is for use debugging the plugin itself, but should not be needed in regular use.
func WithEnvironment ¶
WithEnvironment sets the environment for the observability plugin.
func WithManualStart ¶
func WithManualStart() Option
WithManualStart indicates that the observability plugin should not start automatically. Instead, the plugin should be started manually by calling the Start function.
func WithOTLPEndpoint ¶
WithOTLPEndpoint sets the OTLP endpoint for the observability plugin.
func WithSamplingRateMap ¶ added in v0.2.1
WithSamplingRateMap sets the sampling rate for each span kind. This setting can influence the quality of metrics used for experiments and guarded releases and should only be adjusted with consultation. If the sampling rate is specified for the SpanKindUnspecified kind, then that rate will be used for any span kind for which a rate is not specified.
func WithServiceName ¶
WithServiceName sets the service name for the observability plugin.
func WithServiceVersion ¶
WithServiceVersion sets the service version for the observability plugin.