dd-trace-py icon indicating copy to clipboard operation
dd-trace-py copied to clipboard

refactor: make global config an `AttrDict`

Open P403n1x87 opened this issue 3 years ago • 5 comments

This change refactors the global configuration object to be a subclass of the AttrDict object. The latter has also been refactored to allow more reliable attribute access in both an object and dict-like fashion. The DefaultAttrDict subclass of AttrDict has also been added to provide an analogue of defaultdict. The API of the global configuration class has been enlarged with a method that allows registering sub-configuration items for components using a namespace mechanism. This allows for the whole configuration to be reached from a single object while keeping coupling between components as loose as possible.

Checklist

  • [ ] Added to the correct milestone.
  • [ ] Tests provided or description of manual testing performed is included in the code or PR.
  • [ ] Library documentation is updated.
  • [ ] Corp site documentation is updated (link to the PR).

P403n1x87 avatar May 10 '22 13:05 P403n1x87

For the time being we can take the "component" bit out and keep the rest of the changes

P403n1x87 avatar May 13 '22 10:05 P403n1x87

Discussed offline to remove the component change here and focus this refactor on not subclassing dict.

majorgreys avatar May 25 '22 15:05 majorgreys

Codecov Report

Merging #3698 (bd4cacb) into 1.x (5731586) will decrease coverage by 0.02%. The diff coverage is 54.92%.

@@            Coverage Diff             @@
##              1.x    #3698      +/-   ##
==========================================
- Coverage   77.51%   77.49%   -0.03%     
==========================================
  Files         664      664              
  Lines       51039    51074      +35     
==========================================
+ Hits        39565    39579      +14     
- Misses      11474    11495      +21     
Impacted Files Coverage Δ
ddtrace/internal/safety.py 0.00% <0.00%> (ø)
tests/internal/test_safety.py 0.00% <0.00%> (ø)
ddtrace/internal/utils/attrdict.py 100.00% <100.00%> (ø)
ddtrace/settings/config.py 91.52% <100.00%> (-0.22%) :arrow_down:
ddtrace/settings/integration.py 92.72% <100.00%> (ø)
tests/tracer/test_settings.py 98.26% <100.00%> (+<0.01%) :arrow_up:

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov-commenter avatar May 27 '22 16:05 codecov-commenter

@P403n1x87 this pull request is now in conflict 😩

mergify[bot] avatar Sep 13 '22 07:09 mergify[bot]

@P403n1x87 this pull request is now in conflict 😩

mergify[bot] avatar Sep 26 '22 07:09 mergify[bot]

This PR has been open for almost a year, and last changes were from 9 months ago. Closing for now, @P403n1x87 feel free to resolve conflicts and re-open!

brettlangdon avatar Mar 28 '23 23:03 brettlangdon