mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-02-05 13:15:41 +02:00
otlptrace: Add instrumentation scope attributes (#5934)
Towards https://github.com/open-telemetry/opentelemetry-go/issues/5844
This commit is contained in:
parent
3cc4857fd8
commit
692cb35a80
@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
The package contains semantic conventions from the `v1.27.0` version of the OpenTelemetry Semantic Conventions. (#5894)
|
||||
- Add `Attributes attribute.Set` field to `Scope` in `go.opentelemetry.io/otel/sdk/instrumentation`. (#5903)
|
||||
- Add `Attributes attribute.Set` field to `ScopeRecords` in `go.opentelemetry.io/otel/log/logtest`. (#5927)
|
||||
- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` adds instrumentation scope attributes. (#5934)
|
||||
- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` adds instrumentation scope attributes. (#5934)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -13,7 +13,8 @@ func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationSco
|
||||
return nil
|
||||
}
|
||||
return &commonpb.InstrumentationScope{
|
||||
Name: il.Name,
|
||||
Version: il.Version,
|
||||
Name: il.Name,
|
||||
Version: il.Version,
|
||||
Attributes: Iterator(il.Attributes.Iter()),
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package tracetransform
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||
commonpb "go.opentelemetry.io/proto/otlp/common/v1"
|
||||
)
|
||||
|
||||
func TestInstrumentationScope(t *testing.T) {
|
||||
want := &commonpb.InstrumentationScope{
|
||||
Name: "name",
|
||||
Version: "1.0.0",
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "foo",
|
||||
Value: &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_StringValue{StringValue: "bar"},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
in := instrumentation.Scope{
|
||||
Name: "name",
|
||||
Version: "1.0.0",
|
||||
Attributes: attribute.NewSet(attribute.String("foo", "bar")),
|
||||
}
|
||||
|
||||
got := InstrumentationScope(in)
|
||||
|
||||
assert.Equal(t, want, got)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user