Skip to content

Commit 68f031e

Browse files
committed
set up agentic monitoring feature flag
1 parent c0f8a05 commit 68f031e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/otlp_aws_span_exporter.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import logging
4+
import os
45
from typing import Dict, Optional, Sequence
56

67
import requests
@@ -13,6 +14,7 @@
1314
from opentelemetry.sdk.trace.export import SpanExportResult
1415

1516
AWS_SERVICE = "xray"
17+
AGENT_OBSERVABILITY_ENABLED = os.environ.get("AGENT_OBSERVABILITY_ENABLED", "false")
1618
_logger = logging.getLogger(__name__)
1719

1820

@@ -77,10 +79,13 @@ def __init__(
7779

7880
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
7981
# Process spans to handle LLO attributes
80-
modified_spans = self._llo_handler.process_spans(spans)
82+
if AGENT_OBSERVABILITY_ENABLED == "true":
83+
spans_to_export = self._llo_handler.process_spans(spans)
84+
else:
85+
spans_to_export = spans
8186

8287
# Export the modified spans
83-
return super().export(modified_spans)
88+
return super().export(spans_to_export)
8489

8590
# Overrides upstream's private implementation of _export. All behaviors are
8691
# the same except if the endpoint is an XRay OTLP endpoint, we will sign the request

0 commit comments

Comments
 (0)