Skip to content

Commit 8f699cd

Browse files
authored
chore(tracing): add additional debug logging to APM_TRACING rc callback (#14446)
It is really hard to debug if we are ignoring/rejecting RC payloads with mismatched data or not. ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [ ] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
1 parent cd2ddee commit 8f699cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ddtrace/internal/remoteconfig/products/apm_tracing.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,26 @@
2020
def _rc_callback(payloads: t.Sequence[Payload]) -> None:
2121
for payload in payloads:
2222
if payload.metadata is None or (content := payload.content) is None:
23+
log.debug("ignoring invalid APM Tracing remote config payload")
2324
continue
2425

2526
if (service_target := t.cast(t.Optional[dict], content.get("service_target"))) is not None:
26-
if (service := t.cast(str, service_target.get("service"))) is not None and service != config.service:
27+
if (
28+
service := t.cast(t.Optional[str], service_target.get("service"))
29+
) is not None and service != config.service:
30+
log.debug("ignoring APM Tracing remote config payload for service: %r != %r", service, config.service)
2731
continue
2832

2933
if (env := t.cast(str, service_target.get("env"))) is not None and env != config.env:
34+
log.debug("ignoring APM Tracing remote config payload for env: %r != %r", env, config.env)
3035
continue
36+
else:
37+
log.debug("APM Tracing remote config payload has no service_target, accepting")
3138

3239
if (lib_config := t.cast(dict, content.get("lib_config"))) is not None:
3340
dispatch("apm-tracing.rc", (lib_config, config))
41+
else:
42+
log.debug("ignoring invalid APM Tracing remote config payload with no lib_config")
3443

3544

3645
class APMTracingAdapter(PubSub):

0 commit comments

Comments
 (0)