open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.04k stars 2.35k forks source link

azuremonitorexporter does not implement ExportSpans (Re-Open #27053) #35690

Open pavgup opened 3 weeks ago

pavgup commented 3 weeks ago

Component(s)

exporter/azuremonitor

What happened?

Description

Steps to Reproduce

func initMonitor() (*sdktrace.TracerProvider, error) {
    key := os.Getenv("INSTRUMENTATION_KEY")
    exporterConfig := azuremonitorexporter.Config{
        InstrumentationKey: configopaque.String(key),
    }
    factory := azuremonitorexporter.NewFactory()

    azExporter, err := factory.CreateTracesExporter(context.Background(), exporter.CreateSettings{}, exporterConfig)
    if err != nil {
        panic(err)
    }

    tp := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.AlwaysSample()),
        sdktrace.WithBatcher(azExporter),
    )

    otel.SetTracerProvider(tp)
    otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))

    return tp, nil
}

Expected Result

TraceProvider created

Actual Result

The exporter is not able to be used WithBatcher because it does not implement ExportSpans

Collector version

v0.111.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

github-actions[bot] commented 3 weeks ago

Pinging code owners: