Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(telemetry): configuration telemetry reporting #11115

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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 ddtrace/settings/peer_service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os

from ddtrace.ext import SpanKind
from ddtrace.internal.schema import SCHEMA_VERSION
from ddtrace.internal.utils.formats import asbool
from ddtrace.internal.utils.formats import parse_tags_str
from ddtrace.settings._core import report_telemetry as _report_telemetry
from ddtrace.settings._core import get_config as _get_config


class PeerServiceConfig(object):
Expand All @@ -23,19 +21,18 @@ def __init__(self, set_defaults_enabled=None, peer_service_mapping=None):
@property
def set_defaults_enabled(self):
if self._set_defaults_enabled is None:
env_enabled = asbool(os.getenv("DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED", default=False))
env_enabled = _get_config("DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED", False, asbool)
self._set_defaults_enabled = SCHEMA_VERSION == "v1" or (SCHEMA_VERSION == "v0" and env_enabled)

return self._set_defaults_enabled

@property
def peer_service_mapping(self):
if self._peer_service_mapping is None:
self._unparsed_peer_service_mapping = os.getenv("DD_TRACE_PEER_SERVICE_MAPPING", default="")
self._unparsed_peer_service_mapping = _get_config("DD_TRACE_PEER_SERVICE_MAPPING", "")
self._peer_service_mapping = parse_tags_str(self._unparsed_peer_service_mapping)

return self._peer_service_mapping


_ps_config = PeerServiceConfig()
_report_telemetry(_ps_config)
mabdinur marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 12 additions & 1 deletion tests/telemetry/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def test_app_started_event_configuration_override(test_agent_session, run_python
{"name": "DD_API_SECURITY_SAMPLE_DELAY", "origin": "default", "value": 30.0},
{"name": "DD_APPSEC_AUTOMATED_USER_EVENTS_TRACKING", "origin": "default", "value": ""},
{"name": "DD_APPSEC_AUTOMATED_USER_EVENTS_TRACKING_ENABLED", "origin": "default", "value": True},
{"name": "DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE", "origin": "default", "value": ""},
{"name": "DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE", "origin": "unknown", "value": "identification"},
mabdinur marked this conversation as resolved.
Show resolved Hide resolved
{"name": "DD_APPSEC_ENABLED", "origin": "env_var", "value": True},
{"name": "DD_APPSEC_MAX_STACK_TRACES", "origin": "default", "value": 2},
{"name": "DD_APPSEC_MAX_STACK_TRACE_DEPTH", "origin": "default", "value": 32},
Expand Down Expand Up @@ -386,12 +386,21 @@ def test_app_started_event_configuration_override(test_agent_session, run_python
{"name": "DD_PROFILING_ENABLE_ASSERTS", "origin": "default", "value": False},
{"name": "DD_PROFILING_ENABLE_CODE_PROVENANCE", "origin": "default", "value": True},
{"name": "DD_PROFILING_ENDPOINT_COLLECTION_ENABLED", "origin": "default", "value": True},
{"name": "DD_PROFILING_EXPORT_LIBDD_ENABLED", "origin": "default", "value": False},
mabdinur marked this conversation as resolved.
Show resolved Hide resolved
{"name": "DD_PROFILING_HEAP_ENABLED", "origin": "env_var", "value": False},
{"name": "DD_PROFILING_HEAP_SAMPLE_SIZE", "origin": "default", "value": None},
{"name": "DD_PROFILING_IGNORE_PROFILER", "origin": "default", "value": False},
{"name": "DD_PROFILING_LOCK_ENABLED", "origin": "env_var", "value": False},
{"name": "DD_PROFILING_LOCK_NAME_INSPECT_DIR", "origin": "default", "value": True},
{"name": "DD_PROFILING_MAX_EVENTS", "origin": "default", "value": 16384},
{"name": "DD_PROFILING_MAX_FRAMES", "origin": "env_var", "value": 512},
{"name": "DD_PROFILING_MAX_TIME_USAGE_PCT", "origin": "default", "value": 1.0},
{"name": "DD_PROFILING_MEMORY_ENABLED", "origin": "env_var", "value": False},
{"name": "DD_PROFILING_MEMORY_EVENTS_BUFFER", "origin": "default", "value": 16},
{"name": "DD_PROFILING_OUTPUT_PPROF", "origin": "default", "value": None},
{"name": "DD_PROFILING_SAMPLE_POOL_CAPACITY", "origin": "default", "value": 4},
{"name": "DD_PROFILING_STACK_ENABLED", "origin": "env_var", "value": False},
{"name": "DD_PROFILING_STACK_V2_ENABLED", "origin": "default", "value": False},
{"name": "DD_PROFILING_TAGS", "origin": "default", "value": ""},
{"name": "DD_PROFILING_TIMELINE_ENABLED", "origin": "default", "value": False},
{"name": "DD_PROFILING_UPLOAD_INTERVAL", "origin": "env_var", "value": 10.0},
Expand Down Expand Up @@ -435,6 +444,8 @@ def test_app_started_event_configuration_override(test_agent_session, run_python
{"name": "DD_TRACE_OTEL_ENABLED", "origin": "env_var", "value": True},
{"name": "DD_TRACE_PARTIAL_FLUSH_ENABLED", "origin": "env_var", "value": False},
{"name": "DD_TRACE_PARTIAL_FLUSH_MIN_SPANS", "origin": "env_var", "value": 3},
{"name": "DD_TRACE_PEER_SERVICE_DEFAULTS_ENABLED", "origin": "default", "value": False},
{"name": "DD_TRACE_PEER_SERVICE_MAPPING", "origin": "env_var", "value": "default_service:remapped_service"},
{"name": "DD_TRACE_PROPAGATION_EXTRACT_FIRST", "origin": "default", "value": False},
{"name": "DD_TRACE_PROPAGATION_HTTP_BAGGAGE_ENABLED", "origin": "default", "value": False},
{"name": "DD_TRACE_PROPAGATION_STYLE_EXTRACT", "origin": "env_var", "value": "tracecontext"},
Expand Down
Loading