// Code generated by mdatagen. DO NOT EDIT.

package metadatatest

import (
	"context"
	"testing"

	"github.com/stretchr/testify/require"
	"go.opentelemetry.io/collector/component/componenttest"
	"go.opentelemetry.io/otel/metric"
	"go.opentelemetry.io/otel/sdk/metric/metricdata"
	"go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest"

	"github.com/atlassian-labs/atlassian-sampling-processor/pkg/processor/atlassiansamplingprocessor/internal/metadata"
)

func TestSetupTelemetry(t *testing.T) {
	testTel := componenttest.NewTelemetry()
	tb, err := metadata.NewTelemetryBuilder(testTel.NewTelemetrySettings())
	require.NoError(t, err)
	defer tb.Shutdown()
	require.NoError(t, tb.RegisterProcessorAtlassianSamplingCacheReadsCallback(func(_ context.Context, observer metric.Int64Observer) error {
		observer.Observe(1)
		return nil
	}))
	tb.ProcessorAtlassianSamplingChanBlockingTime.Record(context.Background(), 1)
	tb.ProcessorAtlassianSamplingDecisionEvictionTime.Record(context.Background(), 1)
	tb.ProcessorAtlassianSamplingInternalErrorDroppedSpans.Add(context.Background(), 1)
	tb.ProcessorAtlassianSamplingPolicyDecisions.Add(context.Background(), 1)
	tb.ProcessorAtlassianSamplingPrimaryCacheSize.Record(context.Background(), 1)
	tb.ProcessorAtlassianSamplingTraceEvictionTime.Record(context.Background(), 1)
	tb.ProcessorAtlassianSamplingTracesNotSampled.Add(context.Background(), 1)
	tb.ProcessorAtlassianSamplingTracesSampled.Add(context.Background(), 1)
	AssertEqualProcessorAtlassianSamplingCacheReads(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingChanBlockingTime(t, testTel,
		[]metricdata.HistogramDataPoint[int64]{{}}, metricdatatest.IgnoreValue(),
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingDecisionEvictionTime(t, testTel,
		[]metricdata.DataPoint[float64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingInternalErrorDroppedSpans(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingPolicyDecisions(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingPrimaryCacheSize(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingTraceEvictionTime(t, testTel,
		[]metricdata.DataPoint[float64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingTracesNotSampled(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())
	AssertEqualProcessorAtlassianSamplingTracesSampled(t, testTel,
		[]metricdata.DataPoint[int64]{{Value: 1}},
		metricdatatest.IgnoreTimestamp())

	require.NoError(t, testTel.Shutdown(context.Background()))
}
