mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-26 21:05:00 +02:00
33 lines
842 B
Go
33 lines
842 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package metric_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/metric"
|
|
)
|
|
|
|
func TestConfig(t *testing.T) {
|
|
version := "v1.1.1"
|
|
schemaURL := "https://opentelemetry.io/schemas/1.0.0"
|
|
attr := attribute.NewSet(
|
|
attribute.String("user", "alice"),
|
|
attribute.Bool("admin", true),
|
|
)
|
|
|
|
c := metric.NewMeterConfig(
|
|
metric.WithInstrumentationVersion(version),
|
|
metric.WithSchemaURL(schemaURL),
|
|
metric.WithInstrumentationAttributes(attr.ToSlice()...),
|
|
)
|
|
|
|
assert.Equal(t, version, c.InstrumentationVersion(), "instrumentation version")
|
|
assert.Equal(t, schemaURL, c.SchemaURL(), "schema URL")
|
|
assert.Equal(t, attr, c.InstrumentationAttributes(), "instrumentation attributes")
|
|
}
|