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

fix(remoteconfig): fix remoteconfig when flare data in payload [backport 2.8] #9203

Merged
merged 2 commits into from May 12, 2024

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented May 8, 2024

Backport 69f91ee from #9196 to 2.8.

Remote config was broken entirely due to the addition of tracer flare data in the config sent from the agent. Example incoming RC config:

data = {'metadata': [{'id': 'configuration_order', 'product_name': 'AGENT_CONFIG', 'sha256_hash': 'ddfc2c7b5ee1710aa915edfccd8a0d452784d946cebae0554485b5c0539a9e2c', 'length': 198, 'tuf_version': 2, 'apply_state': 2, 'apply_error': None}, {'id': 'f6c80fdcc00b702c54ff6ae5ff2ac7f16d9afef109bdf53ee990376455301ab2', 'product_name': 'APM_TRACING', 'sha256_hash': '098cb5a0d27fce648cdd4c6e686038282b64ffee7f42b7238a78552c91948d11', 'length': 616, 'tuf_version': 3, 'apply_state': 2, 'apply_error': None}], 'config': [{'internal_order': ['flare-log-level.trace', 'flare-log-level.debug', 'flare-log-level.info', 'flare-log-level.warn', 'flare-log-level.error', 'flare-log-level.critical', 'flare-log-level.off'], 'order': []}, {'id': 'f6c80fdcc00b702c54ff6ae5ff2ac7f16d9afef109bdf53ee990376455301ab2', 'revision': 1715109076236, 'schema_version': 'v1.0.0', 'action': 'enable', 'lib_config': {'library_language': 'all', 'library_version': 'latest', 'service_name': 'zachs-python-app', 'env': 'zachariah', 'tracing_enabled': True, 'dynamic_sampling_enabled': False, 'tracing_tags': ['rc:works'], 'tracing_sampling_rules': [{'service': 'zachs-python-app', 'provenance': 'customer', 'resource': 'GET /', 'sample_rate': 0.01}, {'service': 'zachs-python-app', 'provenance': 'customer', 'resource': '', 'sample_rate': 1}]}, 'service_target': {'service': 'zachs-python-app', 'env': 'zachariah'}}], 'shared_data_counter': 1}

The python tracer’s implementation of pulling RC rules was brittle and relied upon data["config"][0] always having the lib_config dict. However, with tracer flares it seems the agent sometimes sends the payload with the flare info in that 0 position in the list, so instead we need to sometimes grab data["config"][1] .

Checklist

  • Change(s) are motivated and described in the PR description
  • Testing strategy is described if automated tests are not included in the PR
  • Risks are described (performance impact, potential for breakage, maintainability)
  • Change is maintainable (easy to change, telemetry, documentation)
  • Library release note guidelines are followed or label changelog/no-changelog is set
  • Documentation is included (in-code, generated user docs, public corp docs)
  • Backport labels are set (if applicable)
  • If this PR changes the public interface, I've notified @DataDog/apm-tees.

Reviewer Checklist

  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Description motivates each change
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Change is maintainable (easy to change, telemetry, documentation)
  • Release note makes sense to a user of the library
  • 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

@github-actions github-actions bot requested review from a team as code owners May 8, 2024 19:01
@brettlangdon brettlangdon enabled auto-merge (squash) May 8, 2024 19:06
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented May 8, 2024

Datadog Report

Branch report: backport-9196-to-2.8
Commit report: 3442e80
Test service: dd-trace-py

✅ 0 Failed, 152891 Passed, 19504 Skipped, 10h 47m 19.53s Total duration (1h 55m 27.93s time saved)

Remote config was broken entirely due to the addition of tracer flare
data in the config sent from the agent. Example incoming RC config:
```
data = {'metadata': [{'id': 'configuration_order', 'product_name': 'AGENT_CONFIG', 'sha256_hash': 'ddfc2c7b5ee1710aa915edfccd8a0d452784d946cebae0554485b5c0539a9e2c', 'length': 198, 'tuf_version': 2, 'apply_state': 2, 'apply_error': None}, {'id': 'f6c80fdcc00b702c54ff6ae5ff2ac7f16d9afef109bdf53ee990376455301ab2', 'product_name': 'APM_TRACING', 'sha256_hash': '098cb5a0d27fce648cdd4c6e686038282b64ffee7f42b7238a78552c91948d11', 'length': 616, 'tuf_version': 3, 'apply_state': 2, 'apply_error': None}], 'config': [{'internal_order': ['flare-log-level.trace', 'flare-log-level.debug', 'flare-log-level.info', 'flare-log-level.warn', 'flare-log-level.error', 'flare-log-level.critical', 'flare-log-level.off'], 'order': []}, {'id': 'f6c80fdcc00b702c54ff6ae5ff2ac7f16d9afef109bdf53ee990376455301ab2', 'revision': 1715109076236, 'schema_version': 'v1.0.0', 'action': 'enable', 'lib_config': {'library_language': 'all', 'library_version': 'latest', 'service_name': 'zachs-python-app', 'env': 'zachariah', 'tracing_enabled': True, 'dynamic_sampling_enabled': False, 'tracing_tags': ['rc:works'], 'tracing_sampling_rules': [{'service': 'zachs-python-app', 'provenance': 'customer', 'resource': 'GET /', 'sample_rate': 0.01}, {'service': 'zachs-python-app', 'provenance': 'customer', 'resource': '', 'sample_rate': 1}]}, 'service_target': {'service': 'zachs-python-app', 'env': 'zachariah'}}], 'shared_data_counter': 1}
```

The python tracer’s implementation of pulling RC rules was brittle and
relied upon data["config"][0] always having the lib_config dict.
However, with tracer flares it seems the agent sometimes sends the
payload with the flare info in that 0 position in the list, so instead
we need to sometimes grab data["config"][1] .

## Checklist

- [ ] Change(s) are motivated and described in the PR description
- [ ] Testing strategy is described if automated tests are not included
in the PR
- [ ] Risks are described (performance impact, potential for breakage,
maintainability)
- [ ] Change is maintainable (easy to change, telemetry, documentation)
- [ ] [Library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
are followed or label `changelog/no-changelog` is set
- [ ] Documentation is included (in-code, generated user docs, [public
corp docs](https://github.com/DataDog/documentation/))
- [ ] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
- [ ] If this PR changes the public interface, I've notified
`@DataDog/apm-tees`.

## Reviewer Checklist

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Description motivates each change
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Change is maintainable (easy to change, telemetry, documentation)
- [x] Release note makes sense to a user of the library
- [x] 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)

(cherry picked from commit 69f91ee)
@pr-commenter
Copy link

pr-commenter bot commented May 8, 2024

Benchmarks

Benchmark execution time: 2024-05-09 13:53:43

Comparing candidate commit 3442e80 in PR branch backport-9196-to-2.8 with baseline commit b93d994 in branch 2.8.

Found 15 performance improvements and 10 performance regressions! Performance is the same for 176 metrics, 9 unstable metrics.

scenario:coreapiscenario-core_dispatch_with_results_listeners_and_all_listeners

  • 🟩 max_rss_usage [-722.456KB; -677.147KB] or [-3.279%; -3.073%]

scenario:coreapiscenario-core_dispatch_with_results_no_listeners

  • 🟥 max_rss_usage [+645.014KB; +699.703KB] or [+3.024%; +3.280%]

scenario:coreapiscenario-get_item_missing

  • 🟩 max_rss_usage [-718.511KB; -670.442KB] or [-3.264%; -3.046%]

scenario:coreapiscenario-set_item

  • 🟩 max_rss_usage [-705.181KB; -438.832KB] or [-3.222%; -2.005%]

scenario:httppropagationextract-b3_single_headers

  • 🟥 max_rss_usage [+703.092KB; +749.350KB] or [+3.306%; +3.523%]

scenario:httppropagationextract-full_t_id_datadog_headers

  • 🟥 max_rss_usage [+1.105MB; +1.156MB] or [+5.299%; +5.546%]

scenario:httppropagationextract-invalid_trace_id_header

  • 🟩 max_rss_usage [-763.280KB; -507.299KB] or [-3.487%; -2.318%]

scenario:httppropagationextract-none_propagation_style

  • 🟥 max_rss_usage [+648.178KB; +707.598KB] or [+3.045%; +3.324%]

scenario:httppropagationextract-tracecontext_headers

  • 🟥 max_rss_usage [+702.454KB; +756.951KB] or [+3.300%; +3.556%]

scenario:httppropagationextract-valid_headers_all

  • 🟩 max_rss_usage [-719.691KB; -667.215KB] or [-3.276%; -3.038%]

scenario:httppropagationextract-wsgi_invalid_trace_id_header

  • 🟩 max_rss_usage [-703.377KB; -476.680KB] or [-3.218%; -2.181%]

scenario:httppropagationextract-wsgi_large_header_no_matches

  • 🟥 max_rss_usage [+886.161KB; +964.003KB] or [+4.208%; +4.578%]

scenario:httppropagationextract-wsgi_medium_header_no_matches

  • 🟥 max_rss_usage [+878.727KB; +968.159KB] or [+4.175%; +4.600%]

scenario:httppropagationextract-wsgi_medium_valid_headers_all

  • 🟥 max_rss_usage [+494.798KB; +728.677KB] or [+2.324%; +3.423%]

scenario:httppropagationinject-ids_only

  • 🟥 max_rss_usage [+529.459KB; +686.644KB] or [+2.481%; +3.217%]

scenario:httppropagationinject-with_dd_origin

  • 🟥 max_rss_usage [+815.075KB; +872.886KB] or [+3.868%; +4.142%]

scenario:httppropagationinject-with_tags_max_size

  • 🟩 max_rss_usage [-709.029KB; -602.101KB] or [-3.229%; -2.742%]

scenario:sethttpmeta-all-enabled

  • 🟩 max_rss_usage [-719.732KB; -481.215KB] or [-3.252%; -2.174%]

scenario:sethttpmeta-no-useragentvariant

  • 🟩 max_rss_usage [-778.672KB; -455.043KB] or [-3.532%; -2.064%]

scenario:sethttpmeta-useragentvariant_exists_2

  • 🟩 max_rss_usage [-701.276KB; -647.537KB] or [-3.151%; -2.909%]

scenario:sethttpmeta-useragentvariant_exists_3

  • 🟩 max_rss_usage [-750.764KB; -696.762KB] or [-3.369%; -3.127%]

scenario:span-start-finish

  • 🟩 max_rss_usage [-705.678KB; -564.082KB] or [-3.209%; -2.565%]

scenario:tracer-large

  • 🟩 max_rss_usage [-775.838KB; -705.276KB] or [-3.357%; -3.052%]

scenario:tracer-medium

  • 🟩 max_rss_usage [-802.043KB; -725.355KB] or [-3.627%; -3.280%]

scenario:tracer-small

  • 🟩 max_rss_usage [-763.788KB; -684.558KB] or [-3.447%; -3.089%]

@brettlangdon brettlangdon merged commit ab9ca08 into 2.8 May 12, 2024
172 of 189 checks passed
@brettlangdon brettlangdon deleted the backport-9196-to-2.8 branch May 12, 2024 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants