From b2b3250897a4ffea02aa94a6c38af258a4978d50 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Wed, 4 Mar 2026 06:49:49 -0800 Subject: [PATCH] Semconv metric helper caller-slice mutation fix (#7993) This PR addresses issue #7987 (issue (1)): generated semconv metric helpers should not risk mutating caller-provided `attrs` backing arrays when required attributes are appended. Update the generator logic to merge required-attribute using capacity clamping before append: ``` append(attrs[:len(attrs):len(attrs)], requiredAttrs...) ``` This guarantees append allocates a new backing array for the merged slice instead of writing into caller memory when there are attributes appended. It makes not allocations in the case attributes are not appended. --- semconv/templates/registry/go/instrument.j2 | 2 +- semconv/v1.40.0/azureconv/metric.go | 2 +- semconv/v1.40.0/cicdconv/metric.go | 10 +-- semconv/v1.40.0/dbconv/metric.go | 22 +++--- semconv/v1.40.0/dnsconv/metric.go | 2 +- semconv/v1.40.0/genaiconv/metric.go | 10 +-- semconv/v1.40.0/httpconv/metric.go | 20 ++--- semconv/v1.40.0/hwconv/metric.go | 84 ++++++++++----------- semconv/v1.40.0/k8sconv/metric.go | 34 ++++----- semconv/v1.40.0/mcpconv/metric.go | 4 +- semconv/v1.40.0/messagingconv/metric.go | 8 +- semconv/v1.40.0/openshiftconv/metric.go | 8 +- semconv/v1.40.0/rpcconv/metric.go | 4 +- semconv/v1.40.0/vcsconv/metric.go | 18 ++--- 14 files changed, 114 insertions(+), 114 deletions(-) diff --git a/semconv/templates/registry/go/instrument.j2 b/semconv/templates/registry/go/instrument.j2 index f8d548859..3e0e5c5e8 100644 --- a/semconv/templates/registry/go/instrument.j2 +++ b/semconv/templates/registry/go/instrument.j2 @@ -95,7 +95,7 @@ Int64 {{ prefix }}metric.WithAttributes( {%- if attrs | required | length > 0 %} {{ prefix }} append( -{{ prefix }} attrs, +{{ prefix }} attrs[:len(attrs):len(attrs)], {%- for attr in attrs | required | attribute_sort %} {{ prefix }} {{ to_attribute(attr, pkg) }} {%- endfor %} diff --git a/semconv/v1.40.0/azureconv/metric.go b/semconv/v1.40.0/azureconv/metric.go index 48be2c6f9..d16755f32 100644 --- a/semconv/v1.40.0/azureconv/metric.go +++ b/semconv/v1.40.0/azureconv/metric.go @@ -260,7 +260,7 @@ func (m CosmosDBClientOperationRequestCharge) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.operation.name", dbOperationName), )..., ), diff --git a/semconv/v1.40.0/cicdconv/metric.go b/semconv/v1.40.0/cicdconv/metric.go index 9b4cde857..2b05e2f00 100644 --- a/semconv/v1.40.0/cicdconv/metric.go +++ b/semconv/v1.40.0/cicdconv/metric.go @@ -180,7 +180,7 @@ func (m PipelineRunActive) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("cicd.pipeline.name", pipelineName), attribute.String("cicd.pipeline.run.state", string(pipelineRunState)), )..., @@ -299,7 +299,7 @@ func (m PipelineRunDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("cicd.pipeline.name", pipelineName), attribute.String("cicd.pipeline.run.state", string(pipelineRunState)), )..., @@ -434,7 +434,7 @@ func (m PipelineRunErrors) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("cicd.pipeline.name", pipelineName), attribute.String("error.type", string(errorType)), )..., @@ -557,7 +557,7 @@ func (m SystemErrors) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("cicd.system.component", systemComponent), attribute.String("error.type", string(errorType)), )..., @@ -671,7 +671,7 @@ func (m WorkerCount) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("cicd.worker.state", string(workerState)), )..., ), diff --git a/semconv/v1.40.0/dbconv/metric.go b/semconv/v1.40.0/dbconv/metric.go index a539e80a5..f4aece4bd 100644 --- a/semconv/v1.40.0/dbconv/metric.go +++ b/semconv/v1.40.0/dbconv/metric.go @@ -311,7 +311,7 @@ func (m ClientConnectionCount) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), attribute.String("db.client.connection.state", string(clientConnectionState)), )..., @@ -429,7 +429,7 @@ func (m ClientConnectionCreateTime) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -545,7 +545,7 @@ func (m ClientConnectionIdleMax) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -661,7 +661,7 @@ func (m ClientConnectionIdleMin) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -777,7 +777,7 @@ func (m ClientConnectionMax) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -895,7 +895,7 @@ func (m ClientConnectionPendingRequests) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -1012,7 +1012,7 @@ func (m ClientConnectionTimeouts) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -1129,7 +1129,7 @@ func (m ClientConnectionUseTime) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -1245,7 +1245,7 @@ func (m ClientConnectionWaitTime) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.client.connection.pool.name", clientConnectionPoolName), )..., ), @@ -1360,7 +1360,7 @@ func (m ClientOperationDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.system.name", string(systemName)), )..., ), @@ -1557,7 +1557,7 @@ func (m ClientResponseReturnedRows) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("db.system.name", string(systemName)), )..., ), diff --git a/semconv/v1.40.0/dnsconv/metric.go b/semconv/v1.40.0/dnsconv/metric.go index 437713fa3..57d3e0f61 100644 --- a/semconv/v1.40.0/dnsconv/metric.go +++ b/semconv/v1.40.0/dnsconv/metric.go @@ -117,7 +117,7 @@ func (m LookupDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("dns.question.name", questionName), )..., ), diff --git a/semconv/v1.40.0/genaiconv/metric.go b/semconv/v1.40.0/genaiconv/metric.go index 80b4f4858..ae69f43b2 100644 --- a/semconv/v1.40.0/genaiconv/metric.go +++ b/semconv/v1.40.0/genaiconv/metric.go @@ -236,7 +236,7 @@ func (m ClientOperationDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("gen_ai.operation.name", string(operationName)), attribute.String("gen_ai.provider.name", string(providerName)), )..., @@ -391,7 +391,7 @@ func (m ClientTokenUsage) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("gen_ai.operation.name", string(operationName)), attribute.String("gen_ai.provider.name", string(providerName)), attribute.String("gen_ai.token.type", string(tokenType)), @@ -537,7 +537,7 @@ func (m ServerRequestDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("gen_ai.operation.name", string(operationName)), attribute.String("gen_ai.provider.name", string(providerName)), )..., @@ -689,7 +689,7 @@ func (m ServerTimePerOutputToken) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("gen_ai.operation.name", string(operationName)), attribute.String("gen_ai.provider.name", string(providerName)), )..., @@ -833,7 +833,7 @@ func (m ServerTimeToFirstToken) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("gen_ai.operation.name", string(operationName)), attribute.String("gen_ai.provider.name", string(providerName)), )..., diff --git a/semconv/v1.40.0/httpconv/metric.go b/semconv/v1.40.0/httpconv/metric.go index d6ad8735a..7264925ba 100644 --- a/semconv/v1.40.0/httpconv/metric.go +++ b/semconv/v1.40.0/httpconv/metric.go @@ -177,7 +177,7 @@ func (m ClientActiveRequests) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), )..., @@ -320,7 +320,7 @@ func (m ClientConnectionDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), )..., @@ -467,7 +467,7 @@ func (m ClientOpenConnections) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.connection.state", string(connectionState)), attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), @@ -620,7 +620,7 @@ func (m ClientRequestBodySize) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), @@ -800,7 +800,7 @@ func (m ClientRequestDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), @@ -980,7 +980,7 @@ func (m ClientResponseBodySize) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("server.address", serverAddress), attribute.Int("server.port", serverPort), @@ -1157,7 +1157,7 @@ func (m ServerActiveRequests) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("url.scheme", urlScheme), )..., @@ -1297,7 +1297,7 @@ func (m ServerRequestBodySize) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("url.scheme", urlScheme), )..., @@ -1484,7 +1484,7 @@ func (m ServerRequestDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("url.scheme", urlScheme), )..., @@ -1671,7 +1671,7 @@ func (m ServerResponseBodySize) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("http.request.method", string(requestMethod)), attribute.String("url.scheme", urlScheme), )..., diff --git a/semconv/v1.40.0/hwconv/metric.go b/semconv/v1.40.0/hwconv/metric.go index 8fc865bd8..adc39abd8 100644 --- a/semconv/v1.40.0/hwconv/metric.go +++ b/semconv/v1.40.0/hwconv/metric.go @@ -272,7 +272,7 @@ func (m BatteryCharge) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -427,7 +427,7 @@ func (m BatteryChargeLimit) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -596,7 +596,7 @@ func (m BatteryTimeLeft) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.state", string(state)), )..., @@ -757,7 +757,7 @@ func (m CPUSpeed) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -896,7 +896,7 @@ func (m CPUSpeedLimit) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -1045,7 +1045,7 @@ func (m Energy) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.type", string(hwType)), )..., @@ -1176,7 +1176,7 @@ func (m Errors) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.type", string(hwType)), )..., @@ -1316,7 +1316,7 @@ func (m FanSpeed) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -1448,7 +1448,7 @@ func (m FanSpeedLimit) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -1586,7 +1586,7 @@ func (m FanSpeedRatio) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -1722,7 +1722,7 @@ func (m GpuIO) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("network.io.direction", string(networkIoDirection)), )..., @@ -1883,7 +1883,7 @@ func (m GpuMemoryLimit) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2042,7 +2042,7 @@ func (m GpuMemoryUsage) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2202,7 +2202,7 @@ func (m GpuMemoryUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2362,7 +2362,7 @@ func (m GpuUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2528,7 +2528,7 @@ func (m HostAmbientTemperature) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2659,7 +2659,7 @@ func (m HostEnergy) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2791,7 +2791,7 @@ func (m HostHeatingMargin) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -2922,7 +2922,7 @@ func (m HostPower) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -3053,7 +3053,7 @@ func (m LogicalDiskLimit) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -3190,7 +3190,7 @@ func (m LogicalDiskUsage) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.logical_disk.state", string(logicalDiskState)), )..., @@ -3328,7 +3328,7 @@ func (m LogicalDiskUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.logical_disk.state", string(logicalDiskState)), )..., @@ -3462,7 +3462,7 @@ func (m MemorySize) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -3614,7 +3614,7 @@ func (m NetworkBandwidthLimit) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -3775,7 +3775,7 @@ func (m NetworkBandwidthUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -3939,7 +3939,7 @@ func (m NetworkIO) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("network.io.direction", string(networkIoDirection)), )..., @@ -4104,7 +4104,7 @@ func (m NetworkPackets) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("network.io.direction", string(networkIoDirection)), )..., @@ -4265,7 +4265,7 @@ func (m NetworkUp) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -4430,7 +4430,7 @@ func (m PhysicalDiskEnduranceUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.physical_disk.state", string(physicalDiskState)), )..., @@ -4591,7 +4591,7 @@ func (m PhysicalDiskSize) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -4754,7 +4754,7 @@ func (m PhysicalDiskSmart) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -4930,7 +4930,7 @@ func (m Power) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.type", string(hwType)), )..., @@ -5059,7 +5059,7 @@ func (m PowerSupplyLimit) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -5211,7 +5211,7 @@ func (m PowerSupplyUsage) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -5358,7 +5358,7 @@ func (m PowerSupplyUtilization) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -5520,7 +5520,7 @@ func (m Status) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), attribute.String("hw.state", string(state)), attribute.String("hw.type", string(hwType)), @@ -5656,7 +5656,7 @@ func (m TapeDriveOperations) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -5809,7 +5809,7 @@ func (m Temperature) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -5941,7 +5941,7 @@ func (m TemperatureLimit) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -6079,7 +6079,7 @@ func (m Voltage) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -6211,7 +6211,7 @@ func (m VoltageLimit) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), @@ -6349,7 +6349,7 @@ func (m VoltageNominal) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("hw.id", id), )..., ), diff --git a/semconv/v1.40.0/k8sconv/metric.go b/semconv/v1.40.0/k8sconv/metric.go index 004fdb340..2e8f74d06 100644 --- a/semconv/v1.40.0/k8sconv/metric.go +++ b/semconv/v1.40.0/k8sconv/metric.go @@ -1379,7 +1379,7 @@ func (m ContainerStatusReason) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.container.status.reason", string(containerStatusReason)), )..., ), @@ -1500,7 +1500,7 @@ func (m ContainerStatusState) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.container.status.state", string(containerStatusState)), )..., ), @@ -3872,7 +3872,7 @@ func (m NamespacePhase) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.namespace.phase", string(namespacePhase)), )..., ), @@ -3991,7 +3991,7 @@ func (m NodeConditionStatus) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.node.condition.status", string(nodeConditionStatus)), attribute.String("k8s.node.condition.type", string(nodeConditionType)), )..., @@ -7195,7 +7195,7 @@ func (m PodStatusPhase) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.pod.status.phase", string(podStatusPhase)), )..., ), @@ -7316,7 +7316,7 @@ func (m PodStatusReason) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.pod.status.reason", string(podStatusReason)), )..., ), @@ -7540,7 +7540,7 @@ func (m PodVolumeAvailable) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -7674,7 +7674,7 @@ func (m PodVolumeCapacity) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -7808,7 +7808,7 @@ func (m PodVolumeInodeCount) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -7942,7 +7942,7 @@ func (m PodVolumeInodeFree) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -8079,7 +8079,7 @@ func (m PodVolumeInodeUsed) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -8218,7 +8218,7 @@ func (m PodVolumeUsage) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.volume.name", volumeName), )..., ), @@ -9610,7 +9610,7 @@ func (m ResourceQuotaHugepageCountRequestHard) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.hugepage.size", hugepageSize), )..., ), @@ -9734,7 +9734,7 @@ func (m ResourceQuotaHugepageCountRequestUsed) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.hugepage.size", hugepageSize), )..., ), @@ -10278,7 +10278,7 @@ func (m ResourceQuotaObjectCountHard) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.resourcequota.resource_name", resourcequotaResourceName), )..., ), @@ -10402,7 +10402,7 @@ func (m ResourceQuotaObjectCountUsed) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.resourcequota.resource_name", resourcequotaResourceName), )..., ), @@ -11094,7 +11094,7 @@ func (m ServiceEndpointCount) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.service.endpoint.address_type", string(serviceEndpointAddressType)), attribute.String("k8s.service.endpoint.condition", string(serviceEndpointCondition)), )..., diff --git a/semconv/v1.40.0/mcpconv/metric.go b/semconv/v1.40.0/mcpconv/metric.go index f78a3d653..20471c144 100644 --- a/semconv/v1.40.0/mcpconv/metric.go +++ b/semconv/v1.40.0/mcpconv/metric.go @@ -245,7 +245,7 @@ func (m ClientOperationDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("mcp.method.name", string(methodName)), )..., ), @@ -615,7 +615,7 @@ func (m ServerOperationDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("mcp.method.name", string(methodName)), )..., ), diff --git a/semconv/v1.40.0/messagingconv/metric.go b/semconv/v1.40.0/messagingconv/metric.go index c6ffc00bb..aa93a4253 100644 --- a/semconv/v1.40.0/messagingconv/metric.go +++ b/semconv/v1.40.0/messagingconv/metric.go @@ -186,7 +186,7 @@ func (m ClientConsumedMessages) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("messaging.operation.name", operationName), attribute.String("messaging.system", string(system)), )..., @@ -371,7 +371,7 @@ func (m ClientOperationDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("messaging.operation.name", operationName), attribute.String("messaging.system", string(system)), )..., @@ -558,7 +558,7 @@ func (m ClientSentMessages) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("messaging.operation.name", operationName), attribute.String("messaging.system", string(system)), )..., @@ -724,7 +724,7 @@ func (m ProcessDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("messaging.operation.name", operationName), attribute.String("messaging.system", string(system)), )..., diff --git a/semconv/v1.40.0/openshiftconv/metric.go b/semconv/v1.40.0/openshiftconv/metric.go index 4d7352527..648a9988f 100644 --- a/semconv/v1.40.0/openshiftconv/metric.go +++ b/semconv/v1.40.0/openshiftconv/metric.go @@ -994,7 +994,7 @@ func (m ClusterquotaHugepageCountRequestHard) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.hugepage.size", k8sHugepageSize), )..., ), @@ -1122,7 +1122,7 @@ func (m ClusterquotaHugepageCountRequestUsed) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.hugepage.size", k8sHugepageSize), )..., ), @@ -1691,7 +1691,7 @@ func (m ClusterquotaObjectCountHard) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.resourcequota.resource_name", k8sResourcequotaResourceName), )..., ), @@ -1820,7 +1820,7 @@ func (m ClusterquotaObjectCountUsed) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("k8s.resourcequota.resource_name", k8sResourcequotaResourceName), )..., ), diff --git a/semconv/v1.40.0/rpcconv/metric.go b/semconv/v1.40.0/rpcconv/metric.go index cdee1cf60..2086ffce5 100644 --- a/semconv/v1.40.0/rpcconv/metric.go +++ b/semconv/v1.40.0/rpcconv/metric.go @@ -144,7 +144,7 @@ func (m ClientCallDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("rpc.system.name", string(systemName)), )..., ), @@ -296,7 +296,7 @@ func (m ServerCallDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("rpc.system.name", string(systemName)), )..., ), diff --git a/semconv/v1.40.0/vcsconv/metric.go b/semconv/v1.40.0/vcsconv/metric.go index 398418d6e..7d77cbed1 100644 --- a/semconv/v1.40.0/vcsconv/metric.go +++ b/semconv/v1.40.0/vcsconv/metric.go @@ -241,7 +241,7 @@ func (m ChangeCount) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.change.state", string(changeState)), attribute.String("vcs.repository.url.full", repositoryUrlFull), )..., @@ -390,7 +390,7 @@ func (m ChangeDuration) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.change.state", string(changeState)), attribute.String("vcs.ref.head.name", refHeadName), attribute.String("vcs.repository.url.full", repositoryUrlFull), @@ -536,7 +536,7 @@ func (m ChangeTimeToApproval) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.ref.head.name", refHeadName), attribute.String("vcs.repository.url.full", repositoryUrlFull), )..., @@ -710,7 +710,7 @@ func (m ChangeTimeToMerge) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.ref.head.name", refHeadName), attribute.String("vcs.repository.url.full", repositoryUrlFull), )..., @@ -877,7 +877,7 @@ func (m ContributorCount) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.repository.url.full", repositoryUrlFull), )..., ), @@ -1019,7 +1019,7 @@ func (m RefCount) Add( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.ref.type", string(refType)), attribute.String("vcs.repository.url.full", repositoryUrlFull), )..., @@ -1192,7 +1192,7 @@ func (m RefLinesDelta) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.line_change.type", string(lineChangeType)), attribute.String("vcs.ref.base.name", refBaseName), attribute.String("vcs.ref.base.type", string(refBaseType)), @@ -1381,7 +1381,7 @@ func (m RefRevisionsDelta) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.ref.base.name", refBaseName), attribute.String("vcs.ref.base.type", string(refBaseType)), attribute.String("vcs.ref.head.name", refHeadName), @@ -1548,7 +1548,7 @@ func (m RefTime) Record( *o, metric.WithAttributes( append( - attrs, + attrs[:len(attrs):len(attrs)], attribute.String("vcs.ref.head.name", refHeadName), attribute.String("vcs.ref.head.type", string(refHeadType)), attribute.String("vcs.repository.url.full", repositoryUrlFull),