observ
v1.47.0
Documentation
pkg.go.dev ↗Package observ provides experimental observability instrumentation for the metric reader.
Constants
ScopeName (2 declarations)
const ( // ScopeName is the unique name of the meter used for instrumentation. ScopeName = "go.opentelemetry.io/otel/sdk/metric/internal/observ" // SchemaURL is the schema URL of the metrics produced by this // instrumentation. SchemaURL = semconv.SchemaURL )
Functions
ComponentName
func ComponentName(componentType string, id int64) string
ComponentName returns the component name for the metric reader with the provided ComponentType and ID.
Types
CollectOp
type CollectOp struct {
// contains filtered or unexported fields
}
CollectOp tracks the collect operation being observed by Instrumentation.CollectMetrics.
CollectOp.End
func (e CollectOp) End(err error)
End completes the observation of the operation being observed by a call to Instrumentation.CollectMetrics.
Any error that is encountered is provided as err.
Instrumentation
type Instrumentation struct {
// contains filtered or unexported fields
}
Instrumentation is experimental instrumentation for the metric reader.
NewInstrumentation
func NewInstrumentation(componentType string, id int64) (*Instrumentation, error)
NewInstrumentation returns instrumentation for metric reader with the provided component type (such as periodic and manual metric reader) and ID. It uses the global MeterProvider to create the instrumentation.
The id should be the unique metric reader instance ID. It is used to set the "component.name" attribute.
If the experimental observability is disabled, nil is returned.
Instrumentation.CollectMetrics
func (i *Instrumentation) CollectMetrics(ctx context.Context) CollectOp
CollectMetrics instruments the collect method of metric reader. It returns an CollectOp that must have its CollectOp.End method called when the collection end.