Skip to content

Commit 6106e05

Browse files
authored
[internal/core] migrate semconv from v1.12.0 (open-telemetry#46533)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Add feature gates to migrate deprecated semconv v1.12.0 attributes to their v1.38.0 equivalents in pkg/translator/zipkin and internal/coreinternal/goldendataset, following the [semconv feature gates RFC](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/rfcs/semconv-feature-gates.md). Both gates default to disabled, preserving the existing behavior. Users can opt in to the migration at their own pace. Zipkin translator (`pkg.translator.zipkin.*`): - `net.host.ip` -> `network.local.address` - `net.peer.ip` -> `network.peer.address` goldendataset (`internal.coreinternal.goldendataset.*`): - `net.host.ip` -> `network.local.address` - `net.peer.ip` -> `network.peer.address` - `http.host` -> `server.address` - `http.server_name` -> `server.address` Migration path: Enable `<component>.EmitV1NetworkConventions` to start emitting both old and new keys (dual-emit transition) Once user pipelines and backends are updated, also enable `<component>.DontEmitV0NetworkConventions` to stop emitting the deprecated v1.12.0 keys. Initially, this was split into 2 PRs, but the open-telemetry#46534 is also a dependency for this one, so I checked out the code for this PR and closed that one. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#45076 open-telemetry#45041 <!--Describe what testing was performed and which tests were added.--> #### Testing Tested locally without any error. --------- Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
1 parent 7a6a51c commit 6106e05

23 files changed

Lines changed: 380 additions & 34 deletions

File tree

.chloggen/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ components:
126126
- internal/aws
127127
- internal/collectd
128128
- internal/common
129-
- internal/coreinternal
130129
- internal/datadog
131130
- internal/datadog/e2e
132131
- internal/docker
@@ -149,6 +148,7 @@ components:
149148
- pkg/batchperresourceattr
150149
- pkg/batchpersignal
151150
- pkg/core/xidutils
151+
- pkg/coreinternal
152152
- pkg/datadog
153153
- pkg/experimentalmetricmetadata
154154
- pkg/faro
@@ -175,10 +175,10 @@ components:
175175
- pkg/translator/signalfx
176176
- pkg/translator/skywalking
177177
- pkg/translator/splunk
178-
- pkg/translator/zipkin
179178
- pkg/winperfcounters
180179
- pkg/xk8stest
181180
- pkg/xstreamencoding
181+
- pkg/zipkin
182182
- processor/akamaidetector
183183
- processor/alibabaecsdetector
184184
- processor/attributes

.chloggen/feat_45041.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: "enhancement"
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: pkg/zipkin
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Add feature gates to migrate semconv v1.12.0 attributes to v1.38.0 equivalents"
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [45076]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
The following attribute keys from `go.opentelemetry.io/otel/semconv/v1.12.0` can now be migrated to their `v1.38.0` equivalents
20+
using feature gates (both default to disabled, preserving the old behavior):
21+
- `net.host.ip` -> `network.local.address` (enable `pkg.translator.zipkin.EmitV1NetworkConventions`)
22+
- `net.peer.ip` -> `network.peer.address` (enable `pkg.translator.zipkin.EmitV1NetworkConventions`)
23+
To stop emitting the deprecated v1.12.0 attributes, also enable `pkg.translator.zipkin.DontEmitV0NetworkConventions`
24+
(requires `pkg.translator.zipkin.EmitV1NetworkConventions` to also be enabled).
25+
26+
# If your change doesn't affect end users or the exported elements of any package,
27+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
28+
# Optional: The change log or logs in which this entry should be included.
29+
# e.g. '[user]' or '[user, api]'
30+
# Include 'user' if the change is relevant to end users.
31+
# Include 'api' if there is a change to a library API.
32+
# Default: '[user]'
33+
change_logs: [user]

.chloggen/feat_45076.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: "enhancement"
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: pkg/coreinternal
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Add feature gates to migrate semconv v1.12.0 attributes to v1.38.0 equivalents in goldendataset"
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [45076]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
The following attribute keys from `go.opentelemetry.io/otel/semconv/v1.12.0` can now be migrated to their `v1.38.0` equivalents
20+
using feature gates (both default to disabled, preserving the old behavior):
21+
- `net.host.ip` -> `network.local.address` (enable `internal.coreinternal.goldendataset.EmitV1NetworkConventions`)
22+
- `net.peer.ip` -> `network.peer.address` (enable `internal.coreinternal.goldendataset.EmitV1NetworkConventions`)
23+
- `http.host` -> `server.address` (enable `internal.coreinternal.goldendataset.EmitV1NetworkConventions`)
24+
- `http.server_name` -> `server.address` (enable `internal.coreinternal.goldendataset.EmitV1NetworkConventions`)
25+
To stop emitting the deprecated v1.12.0 attributes, also enable `internal.coreinternal.goldendataset.DontEmitV0NetworkConventions`
26+
(requires `internal.coreinternal.goldendataset.EmitV1NetworkConventions` to also be enabled).
27+
28+
# If your change doesn't affect end users or the exported elements of any package,
29+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
30+
# Optional: The change log or logs in which this entry should be included.
31+
# e.g. '[user]' or '[user, api]'
32+
# Include 'user' if the change is relevant to end users.
33+
# Include 'api' if there is a change to a library API.
34+
# Default: '[user]'
35+
change_logs: [user]

exporter/zipkinexporter/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/openzipkin/zipkin-go v0.4.3
1111
github.com/stretchr/testify v1.11.1
1212
go.opentelemetry.io/collector/component v1.53.0
13+
go.opentelemetry.io/collector/component/componentstatus v0.147.0
1314
go.opentelemetry.io/collector/component/componenttest v0.147.0
1415
go.opentelemetry.io/collector/config/confighttp v0.147.0
1516
go.opentelemetry.io/collector/config/confignet v1.53.0
@@ -25,6 +26,7 @@ require (
2526
go.opentelemetry.io/collector/pdata v1.53.0
2627
go.opentelemetry.io/collector/receiver/receivertest v0.147.0
2728
go.uber.org/goleak v1.3.0
29+
go.uber.org/zap v1.27.1
2830
)
2931

3032
require (
@@ -61,7 +63,6 @@ require (
6163
github.com/rs/cors v1.11.1 // indirect
6264
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
6365
go.opentelemetry.io/collector/client v1.53.0 // indirect
64-
go.opentelemetry.io/collector/component/componentstatus v0.147.0 // indirect
6566
go.opentelemetry.io/collector/config/configauth v1.53.0 // indirect
6667
go.opentelemetry.io/collector/config/configcompression v1.53.0 // indirect
6768
go.opentelemetry.io/collector/config/configmiddleware v1.53.0 // indirect
@@ -90,7 +91,6 @@ require (
9091
go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect
9192
go.opentelemetry.io/otel/trace v1.41.0 // indirect
9293
go.uber.org/multierr v1.11.0 // indirect
93-
go.uber.org/zap v1.27.1 // indirect
9494
go.yaml.in/yaml/v3 v3.0.4 // indirect
9595
golang.org/x/crypto v0.48.0 // indirect
9696
golang.org/x/net v0.51.0 // indirect

exporter/zipkinexporter/zipkin.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import (
1212
"github.com/openzipkin/zipkin-go/proto/zipkin_proto3"
1313
zipkinreporter "github.com/openzipkin/zipkin-go/reporter"
1414
"go.opentelemetry.io/collector/component"
15+
"go.opentelemetry.io/collector/component/componentstatus"
1516
"go.opentelemetry.io/collector/config/confighttp"
1617
"go.opentelemetry.io/collector/consumer/consumererror"
1718
"go.opentelemetry.io/collector/pdata/ptrace"
19+
"go.uber.org/zap"
1820

1921
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/zipkin/zipkinv2"
2022
)
@@ -59,6 +61,11 @@ func createZipkinExporter(cfg *Config, settings component.TelemetrySettings) (*z
5961

6062
// start creates the http client
6163
func (ze *zipkinExporter) start(ctx context.Context, host component.Host) (err error) {
64+
if err = zipkinv2.ValidateFeatureGates(); err != nil {
65+
ze.settings.Logger.Error("Invalid feature gate combination", zap.Error(err))
66+
componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(err))
67+
return err
68+
}
6269
ze.client, err = ze.clientSettings.ToClient(ctx, host.GetExtensions(), ze.settings)
6370
return err
6471
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)
2+
3+
# coreinternal
4+
5+
## Feature Gates
6+
7+
This component has the following feature gates:
8+
9+
| Feature Gate | Stage | Description | From Version | To Version | Reference |
10+
| ------------ | ----- | ----------- | ------------ | ---------- | --------- |
11+
| `internal.coreinternal.goldendataset.DontEmitV0NetworkConventions` | alpha | When enabled, goldendataset no longer generates spans with deprecated semconv v1.12.0 attributes (net.host.ip, net.peer.ip, http.host, http.server_name). | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45076) |
12+
| `internal.coreinternal.goldendataset.EmitV1NetworkConventions` | alpha | When enabled, goldendataset generates spans with network.local.address, network.peer.address, and server.address (semconv v1.38.0) instead of the deprecated net.host.ip, net.peer.ip, http.host, http.server_name (semconv v1.12.0). Enable together with pkg.translator.zipkin.EmitV1NetworkConventions for consistent round-trip translation in tests. | v0.147.0 | N/A | [Link](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/45076) |
13+
14+
For more information about feature gates, see the [Feature Gates](https://github.com/open-telemetry/opentelemetry-collector/blob/main/featuregate/README.md) documentation.

internal/coreinternal/generated_package_test.go

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/coreinternal/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ require (
1616
go.opentelemetry.io/collector/consumer v1.53.0
1717
go.opentelemetry.io/collector/consumer/consumererror v0.147.0
1818
go.opentelemetry.io/collector/consumer/consumertest v0.147.0
19+
go.opentelemetry.io/collector/featuregate v1.53.0
1920
go.opentelemetry.io/collector/pdata v1.53.0
2021
go.opentelemetry.io/collector/pdata/pprofile v0.147.0
2122
go.opentelemetry.io/collector/receiver v1.53.0
@@ -78,7 +79,6 @@ require (
7879
github.com/yusufpapurcu/wmi v1.2.4 // indirect
7980
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
8081
go.opentelemetry.io/collector/consumer/xconsumer v0.147.0 // indirect
81-
go.opentelemetry.io/collector/featuregate v1.53.0 // indirect
8282
go.opentelemetry.io/collector/internal/componentalias v0.147.0 // indirect
8383
go.opentelemetry.io/collector/pdata/xpdata v0.147.0 // indirect
8484
go.opentelemetry.io/collector/pipeline v1.53.0 // indirect

internal/coreinternal/goldendataset/span_generator.go

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"go.opentelemetry.io/collector/pdata/pcommon"
1313
"go.opentelemetry.io/collector/pdata/ptrace"
14-
conventionsv112 "go.opentelemetry.io/otel/semconv/v1.12.0"
1514
conventionsv116 "go.opentelemetry.io/otel/semconv/v1.16.0"
1615
conventionsv118 "go.opentelemetry.io/otel/semconv/v1.18.0"
1716
conventionsv119 "go.opentelemetry.io/otel/semconv/v1.19.0"
@@ -21,6 +20,8 @@ import (
2120
conventionsv126 "go.opentelemetry.io/otel/semconv/v1.26.0"
2221
conventionsv128 "go.opentelemetry.io/otel/semconv/v1.28.0"
2322
conventions "go.opentelemetry.io/otel/semconv/v1.38.0"
23+
24+
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/internal/metadata"
2425
)
2526

2627
var statusCodeMap = map[PICTInputStatus]ptrace.StatusCode{
@@ -198,10 +199,20 @@ func appendDatabaseSQLAttributes(attrMap pcommon.Map) {
198199
attrMap.PutStr(string(conventionsv128.DBSystemKey), "mysql")
199200
attrMap.PutStr(string(conventionsv125.DBConnectionStringKey), "Server=shopdb.example.com;Database=ShopDb;Uid=billing_user;TableCache=true;UseCompression=True;MinimumPoolSize=10;MaximumPoolSize=50;")
200201
attrMap.PutStr(string(conventionsv125.DBUserKey), "billing_user")
201-
attrMap.PutStr(string(conventionsv112.NetHostIPKey), "192.0.3.122")
202+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
203+
attrMap.PutStr("net.host.ip", "192.0.3.122")
204+
}
205+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
206+
attrMap.PutStr(string(conventions.NetworkLocalAddressKey), "192.0.3.122")
207+
}
202208
attrMap.PutInt(string(conventionsv125.NetHostPortKey), 51306)
203209
attrMap.PutStr(string(conventionsv125.NetPeerNameKey), "shopdb.example.com")
204-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "192.0.2.12")
210+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
211+
attrMap.PutStr("net.peer.ip", "192.0.2.12")
212+
}
213+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
214+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "192.0.2.12")
215+
}
205216
attrMap.PutInt(string(conventionsv125.NetPeerPortKey), 3306)
206217
attrMap.PutStr(string(conventionsv125.NetTransportKey), "IP.TCP")
207218
attrMap.PutStr(string(conventionsv125.DBNameKey), "shopdb")
@@ -213,7 +224,12 @@ func appendDatabaseNoSQLAttributes(attrMap pcommon.Map) {
213224
attrMap.PutStr(string(conventionsv128.DBSystemKey), "mongodb")
214225
attrMap.PutStr(string(conventionsv125.DBUserKey), "the_user")
215226
attrMap.PutStr(string(conventionsv125.NetPeerNameKey), "mongodb0.example.com")
216-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "192.0.2.14")
227+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
228+
attrMap.PutStr("net.peer.ip", "192.0.2.14")
229+
}
230+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
231+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "192.0.2.14")
232+
}
217233
attrMap.PutInt(string(conventionsv125.NetPeerPortKey), 27017)
218234
attrMap.PutStr(string(conventionsv125.NetTransportKey), "IP.TCP")
219235
attrMap.PutStr(string(conventionsv125.DBNameKey), "shopDb")
@@ -236,7 +252,12 @@ func appendFaaSHTTPAttributes(includeStatus bool, attrMap pcommon.Map) {
236252
attrMap.PutStr(string(conventions.FaaSTriggerKey), conventions.FaaSTriggerHTTP.Value.AsString())
237253
attrMap.PutStr(string(conventionsv125.HTTPMethodKey), http.MethodPost)
238254
attrMap.PutStr(string(conventionsv125.HTTPSchemeKey), "https")
239-
attrMap.PutStr(string(conventionsv112.HTTPHostKey), "api.opentelemetry.io")
255+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
256+
attrMap.PutStr("http.host", "api.opentelemetry.io")
257+
}
258+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
259+
attrMap.PutStr(string(conventions.ServerAddressKey), "api.opentelemetry.io")
260+
}
240261
attrMap.PutStr(string(conventionsv125.HTTPTargetKey), "/blog/posts")
241262
attrMap.PutStr(string(conventionsv119.HTTPFlavorKey), "2")
242263
if includeStatus {
@@ -284,7 +305,12 @@ func appendHTTPClientAttributes(includeStatus bool, attrMap pcommon.Map) {
284305
func appendHTTPServerAttributes(includeStatus bool, attrMap pcommon.Map) {
285306
attrMap.PutStr(string(conventionsv125.HTTPMethodKey), http.MethodPost)
286307
attrMap.PutStr(string(conventionsv125.HTTPSchemeKey), "https")
287-
attrMap.PutStr(string(conventionsv112.HTTPServerNameKey), "api22.opentelemetry.io")
308+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
309+
attrMap.PutStr("http.server_name", "api22.opentelemetry.io")
310+
}
311+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
312+
attrMap.PutStr(string(conventions.ServerAddressKey), "api22.opentelemetry.io")
313+
}
288314
attrMap.PutInt(string(conventionsv125.NetHostPortKey), 443)
289315
attrMap.PutStr(string(conventionsv125.HTTPTargetKey), "/blog/posts")
290316
attrMap.PutStr(string(conventionsv119.HTTPFlavorKey), "2")
@@ -304,28 +330,48 @@ func appendMessagingProducerAttributes(attrMap pcommon.Map) {
304330
attrMap.PutStr(string(conventionsv119.MessagingDestinationKindKey), "topic")
305331
attrMap.PutStr(string(conventions.MessagingMessageIDKey), "AA7C5438-D93A-43C8-9961-55613204648F")
306332
attrMap.PutInt("messaging.sequence", 1)
307-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "10.10.212.33")
333+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
334+
attrMap.PutStr("net.peer.ip", "10.10.212.33")
335+
}
336+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
337+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "10.10.212.33")
338+
}
308339
attrMap.PutStr(string(conventionsv126.EnduserIDKey), "unittest")
309340
}
310341

311342
func appendMessagingConsumerAttributes(attrMap pcommon.Map) {
312343
attrMap.PutStr(string(conventions.MessagingSystemKey), "kafka")
313344
attrMap.PutStr(string(conventionsv116.MessagingDestinationKey), "infrastructure-events-zone1")
314345
attrMap.PutStr(string(conventionsv125.MessagingOperationKey), "receive")
315-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
346+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
347+
attrMap.PutStr("net.peer.ip", "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
348+
}
349+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
350+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
351+
}
316352
attrMap.PutStr(string(conventionsv126.EnduserIDKey), "unittest")
317353
}
318354

319355
func appendGRPCClientAttributes(attrMap pcommon.Map) {
320356
attrMap.PutStr(string(conventions.RPCServiceKey), "PullRequestsService")
321-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
357+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
358+
attrMap.PutStr("net.peer.ip", "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
359+
}
360+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
361+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "2600:1700:1f00:11c0:4de0:c223:a800:4e87")
362+
}
322363
attrMap.PutInt(string(conventionsv125.NetHostPortKey), 8443)
323364
attrMap.PutStr(string(conventionsv126.EnduserIDKey), "unittest")
324365
}
325366

326367
func appendGRPCServerAttributes(attrMap pcommon.Map) {
327368
attrMap.PutStr(string(conventions.RPCServiceKey), "PullRequestsService")
328-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "192.168.1.70")
369+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
370+
attrMap.PutStr("net.peer.ip", "192.168.1.70")
371+
}
372+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
373+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "192.168.1.70")
374+
}
329375
attrMap.PutStr(string(conventionsv126.EnduserIDKey), "unittest")
330376
}
331377

@@ -337,9 +383,19 @@ func appendInternalAttributes(attrMap pcommon.Map) {
337383
func appendMaxCountAttributes(includeStatus bool, attrMap pcommon.Map) {
338384
attrMap.PutStr(string(conventionsv125.HTTPMethodKey), http.MethodPost)
339385
attrMap.PutStr(string(conventionsv125.HTTPSchemeKey), "https")
340-
attrMap.PutStr(string(conventionsv112.HTTPHostKey), "api.opentelemetry.io")
386+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
387+
attrMap.PutStr("http.host", "api.opentelemetry.io")
388+
}
389+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
390+
attrMap.PutStr(string(conventions.ServerAddressKey), "api.opentelemetry.io")
391+
}
341392
attrMap.PutStr(string(conventionsv125.NetHostNameKey), "api22.opentelemetry.io")
342-
attrMap.PutStr(string(conventionsv112.NetHostIPKey), "2600:1700:1f00:11c0:1ced:afa5:fd88:9d48")
393+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
394+
attrMap.PutStr("net.host.ip", "2600:1700:1f00:11c0:1ced:afa5:fd88:9d48")
395+
}
396+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
397+
attrMap.PutStr(string(conventions.NetworkLocalAddressKey), "2600:1700:1f00:11c0:1ced:afa5:fd88:9d48")
398+
}
343399
attrMap.PutInt(string(conventionsv125.NetHostPortKey), 443)
344400
attrMap.PutStr(string(conventionsv125.HTTPTargetKey), "/blog/posts")
345401
attrMap.PutStr(string(conventionsv119.HTTPFlavorKey), "2")
@@ -352,7 +408,12 @@ func appendMaxCountAttributes(includeStatus bool, attrMap pcommon.Map) {
352408
attrMap.PutStr(string(conventions.HTTPRouteKey), "/blog/posts")
353409
attrMap.PutStr(string(conventionsv120.HTTPClientIPKey), "2600:1700:1f00:11c0:1ced:afa5:fd77:9d01")
354410
attrMap.PutStr(string(conventions.PeerServiceKey), "IdentifyImageService")
355-
attrMap.PutStr(string(conventionsv112.NetPeerIPKey), "2600:1700:1f00:11c0:1ced:afa5:fd77:9ddc")
411+
if !metadata.InternalCoreinternalGoldendatasetDontEmitV0NetworkConventionsFeatureGate.IsEnabled() {
412+
attrMap.PutStr("net.peer.ip", "2600:1700:1f00:11c0:1ced:afa5:fd77:9ddc")
413+
}
414+
if metadata.InternalCoreinternalGoldendatasetEmitV1NetworkConventionsFeatureGate.IsEnabled() {
415+
attrMap.PutStr(string(conventions.NetworkPeerAddressKey), "2600:1700:1f00:11c0:1ced:afa5:fd77:9ddc")
416+
}
356417
attrMap.PutInt(string(conventionsv125.NetPeerPortKey), 39111)
357418
attrMap.PutDouble("ai-sampler.weight", 0.07)
358419
attrMap.PutBool("ai-sampler.absolute", false)

0 commit comments

Comments
 (0)