Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ManualReader *sdkmetric.ManualReader
ManualReader is initialized only when the in-memory metric provider is used. It will be nil otherwise. ManualReader is primarily intended for use in tests.
Functions ¶
func NewLogger ¶
NewLogger creates a new slog.Logger. If OpenTelemetry logging is enabled, the logger is connected to the OpenTelemetry logging bridge.
func ReleaseTestMetricReader ¶
ReleaseTestMetricReader releases the test metric reader lock.
func Shutdown ¶
Shutdown gracefully shutdown all OpenTelemetry exporters, providers that were previously enabled.
Shutdown can be safely called before Start.
func Start ¶
Start initializes OpenTelemetry exporters, resources, and providers for logging, tracing, and metrics based on the standard OTEL_* environment variables: https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
This function should be called only once at the beginning of the program.
Types ¶
type TestMetricReader ¶
type TestMetricReader struct {
*sdkmetric.ManualReader
}
func AcquireTestMetricReader ¶
func AcquireTestMetricReader(t *testing.T) *TestMetricReader
AcquireTestMetricReader initializes an in-memory metric reader for inspecting metric changes during tests. ReleaseTestMetricReader must be called after AcquireTestMetricReader.
func (*TestMetricReader) Collect ¶
func (m *TestMetricReader) Collect(t *testing.T) TestMetrics
Collect returns the accumulated metric changes and resets all metrics to zero.
type TestMetrics ¶
type TestMetrics struct {
*metricdata.ResourceMetrics
}