Noop Instrumentation Provider (instrumentationtest/instrumentation.go)

signoz · pkg/instrumentation/instrumentationtest/instrumentation.go · go · MIT
analytics, testing, infra, lang:go

Provides no-op implementations of OpenTelemetry metrics, traces, logs, and Prometheus registries for testing. Reuse in Go testing frameworks.

// Source: https://github.com/SigNoz/signoz | License: MIT | Copyright 2020-present SigNoz Inc
// Provided via justclaw.it.com; keep this notice with the code.
package instrumentationtest

import (
	"log/slog"

	"github.com/SigNoz/signoz/pkg/factory"
	"github.com/SigNoz/signoz/pkg/instrumentation"
	"github.com/prometheus/client_golang/prometheus"
	sdkmetric "go.opentelemetry.io/otel/metric"
	noopmetric "go.opentelemetry.io/otel/metric/noop"
	sdktrace "go.opentelemetry.io/otel/trace"
	nooptrace "go.opentelemetry.io/otel/trace/noop"
)

type noopInstrumentation struct {
	logger             *slog.Logger
	meterProvider      sdkmetric.MeterProvider
	tracerProvider     sdktrace.TracerProvider
	prometheusRegistry *prometheus.Registry
}

func New() instrumentation.Instrumentation {
	return &noopIns

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key