Skip to content

Commit 71b3ca0

Browse files
committed
Refactor metric attributes creation and add linter suppression (too-many-lines) for bedrock.py
1 parent a9380ee commit 71b3ca0

File tree

1 file changed

+5
-5
lines changed
  • instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions

1 file changed

+5
-5
lines changed

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/bedrock.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# Includes work from:
1616
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
1717
# SPDX-License-Identifier: Apache-2.0
18+
# pylint: disable=too-many-lines
1819

1920
from __future__ import annotations
2021

@@ -147,7 +148,10 @@ def setup_metrics(self, meter: Meter, metrics: dict[str, Instrument]):
147148
)
148149

149150
def _extract_metrics_attributes(self) -> _AttributeMapT:
150-
attributes = {GEN_AI_SYSTEM: GenAiSystemValues.AWS_BEDROCK.value}
151+
attributes = {
152+
GEN_AI_SYSTEM: GenAiSystemValues.AWS_BEDROCK.value,
153+
**get_server_attributes(self._call_context.endpoint_url),
154+
}
151155

152156
model_id = self._call_context.params.get(_MODEL_ID_KEY)
153157
if not model_id:
@@ -165,10 +169,6 @@ def _extract_metrics_attributes(self) -> _AttributeMapT:
165169
GenAiOperationNameValues.CHAT.value
166170
)
167171

168-
server_attributes = get_server_attributes(
169-
self._call_context.endpoint_url
170-
)
171-
attributes.update(server_attributes)
172172
return attributes
173173

174174
def extract_attributes(self, attributes: _AttributeMapT):

0 commit comments

Comments
 (0)