mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
Follows #12812 This PR adds the `size` metrics defined in the [Pipeline Component Telemetry RFC](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/component-universal-telemetry.md).
20 lines
437 B
Go
20 lines
437 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package obsconsumer // import "go.opentelemetry.io/collector/service/internal/obsconsumer"
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.opentelemetry.io/otel/metric"
|
|
)
|
|
|
|
type enabledInstrument interface {
|
|
Enabled(context.Context) bool
|
|
}
|
|
|
|
func isEnabled(ctx context.Context, inst metric.Int64Counter) bool {
|
|
ei, ok := inst.(enabledInstrument)
|
|
return !ok || ei.Enabled(ctx)
|
|
}
|