You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-11-27 22:49:15 +02:00
Add schema URL support to Tracer (#1889)
This adds support for schema URL to the Tracer according to the specification: https://github.com/open-telemetry/opentelemetry-specification/pull/1666 (Link to replaced by the link to the spec after that PR is merged) For the future: once the proto is updated we will need to populate the schema_url field in the messages.
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
type basicSpanProcesor struct {
|
||||
@@ -82,3 +84,13 @@ func TestFailedProcessorShutdownInUnregister(t *testing.T) {
|
||||
err := stp.Shutdown(context.Background())
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestSchemaURL(t *testing.T) {
|
||||
stp := NewTracerProvider()
|
||||
schemaURL := "https://opentelemetry.io/schemas/1.2.0"
|
||||
tracerIface := stp.Tracer("tracername", trace.WithSchemaURL(schemaURL))
|
||||
|
||||
// Verify that the SchemaURL of the constructed Tracer is correctly populated.
|
||||
tracerStruct := tracerIface.(*tracer)
|
||||
assert.EqualValues(t, schemaURL, tracerStruct.instrumentationLibrary.SchemaURL)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user