Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions solarwinds_apm/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ def _configure(self, **kwargs: dict) -> None:
",".join(INTL_SWO_DEFAULT_RESOURCE_DETECTORS),
)

# TODO: Support other signal types when available
# Always opt into new semconv for all instrumentors (if supported)
environ["OTEL_SEMCONV_STABILITY_OPT_IN"] = self.get_semconv_opt_in()

Expand Down Expand Up @@ -395,15 +394,13 @@ def detect_commenter_options(self) -> dict:
def get_semconv_opt_in(self) -> str:
"""Return semantic convention opt-in configuration.

Always returns config to opt into new, stable HTTP and database semconv only.
Always returns config to opt into new, stable HTTP and database semconv,
as well as the latest experimental GenAI semconv (gen_ai_latest_experimental).

Returns:
str: Semantic convention stability opt-in string.

See also:
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/0a231e57f9722e6101194c6b38695addf23ab950/opentelemetry-instrumentation/src/opentelemetry/instrumentation/_semconv.py#L93-L99
"""
# TODO: Support other signal types when available
# return environ.get("OTEL_SEMCONV_STABILITY_OPT_IN")

return "http,database"
return "http,database,gen_ai_latest_experimental"
22 changes: 11 additions & 11 deletions tests/unit/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_configure_no_env(self, mocker):
assert os.environ[OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION] == "base2_exponential_bucket_histogram"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_exporter(self, mocker):
mocker.patch.dict(
Expand All @@ -233,7 +233,7 @@ def test_configure_env_exporter(self, mocker):
assert os.environ[OTEL_EXPORTER_OTLP_HEADERS] == "authorization=Bearer%20foo-token"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_invalid_protocol(self, mocker):
mocker.patch.dict(
Expand All @@ -255,7 +255,7 @@ def test_configure_env_invalid_protocol(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_valid_protocol_http(self, mocker):
mocker.patch.dict(
Expand All @@ -276,7 +276,7 @@ def test_configure_env_valid_protocol_http(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_valid_protocol_grpc(self, mocker):
mocker.patch.dict(
Expand All @@ -299,7 +299,7 @@ def test_configure_env_valid_protocol_grpc(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_exporter_and_valid_protocol_http(self, mocker):
mocker.patch.dict(
Expand All @@ -323,7 +323,7 @@ def test_configure_env_exporter_and_valid_protocol_http(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "qux"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_exporter_and_valid_protocol_grpc(self, mocker):
mocker.patch.dict(
Expand All @@ -347,7 +347,7 @@ def test_configure_env_exporter_and_valid_protocol_grpc(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "qux"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_endpoint(self, mocker):
mocker.patch.dict(
Expand All @@ -368,7 +368,7 @@ def test_configure_env_endpoint(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_service_key_only(self, mocker):
mocker.patch.dict(
Expand Down Expand Up @@ -577,7 +577,7 @@ def test_configure_env_headers_otel_headers(self, mocker):
assert os.environ[OTEL_LOGS_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_configure_env_headers_otel_headers_endpoint_default(self, mocker):
mocker.patch.dict(
Expand Down Expand Up @@ -736,7 +736,7 @@ def test_configure_env_propagators(self, mocker):
assert os.environ[OTEL_TRACES_EXPORTER] == "otlp"
assert os.environ[OTEL_PYTHON_LOG_AUTO_INSTRUMENTATION] == "false"
assert os.environ[OTEL_PYTHON_LOG_CODE_ATTRIBUTES] == "true"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database"
assert os.environ.get("OTEL_SEMCONV_STABILITY_OPT_IN") == "http,database,gen_ai_latest_experimental"

def test_load_instrumentor_aws_lambda_not_lambda_env(self, mocker):
mock_apm_config = mocker.patch(
Expand Down Expand Up @@ -1465,4 +1465,4 @@ def test_detect_commenter_options_strip_mix(self, mocker):

def test_get_semconv_opt_in(self):
# TODO: Support other signal types when available
assert distro.SolarWindsDistro().get_semconv_opt_in() == "http,database"
assert distro.SolarWindsDistro().get_semconv_opt_in() == "http,database,gen_ai_latest_experimental"
Loading