Skip to content

feat(config): support libdatadog's library_config for config through file#11839

Closed
BaptisteFoy wants to merge 29 commits intomainfrom
baptiste.foy/FA/library-config-libdatadog
Closed

feat(config): support libdatadog's library_config for config through file#11839
BaptisteFoy wants to merge 29 commits intomainfrom
baptiste.foy/FA/library-config-libdatadog

Conversation

@BaptisteFoy
Copy link
Copy Markdown
Collaborator

@BaptisteFoy BaptisteFoy commented Dec 27, 2024

Description of changes

  • Bumps libdatadog to v15.0.0 & handles the required changes to crashtracking
  • Starts using the library_config component of libdatadog that allows reading configuration from a file with a higher precedence than environment variables

Supported config entries

As of libdatadog v15.0.0 (source):

  • DD_TRACE_DEBUG
  • DD_SERVICE
  • DD_ENV
  • DD_VERSION
  • DD_PROFILING_ENABLED

Testing strategy

Added a unit test.

To test this PR, you can:

  1. Create a Linux VM
  2. Start this tracer version & ensure everything works well (non-regression)
  3. Create a file at the following path: /etc/datadog-agent/managed/datadog-apm-libraries/stable/libraries_config.yaml
  4. Write the following content in the file:
rules:
  - selectors:
      - origin: language
        matches:
          - python
        operator: equals
    configuration:
      DD_TRACE_DEBUG: true
  1. Start this tracer version
  2. Verify that debug logs are properly enabled

Additional concerns

This change does increase the size of the serverless layer by 380KB (14204KB vs 13824 as the limit) even after optimization. I had to go from lto=true to lto=fast, as lto=true somehow prevents release builds on older machines. That accounts for 200KB, while the 200 other KB are mostly coming from the libdatadog bump.

Checklist

  • 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
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

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 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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 27, 2024

CODEOWNERS have been resolved as:

src/native/library_config.rs                                            @DataDog/apm-core-python
tests/internal/test_native.py                                           @DataDog/apm-core-python
ddtrace/__init__.py                                                     @DataDog/apm-core-python
ddtrace/internal/native/__init__.py                                     @DataDog/apm-core-python
ddtrace/internal/native/_native.pyi                                     @DataDog/apm-core-python
src/native/Cargo.lock                                                   @DataDog/apm-core-python
src/native/Cargo.toml                                                   @DataDog/apm-core-python
src/native/lib.rs                                                       @DataDog/apm-core-python

Comment thread ddtrace/__init__.py Outdated
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch 3 times, most recently from 606b2a5 to cef695a Compare December 27, 2024 14:39
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from cef695a to 3f85c2a Compare January 15, 2025 13:43
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from 3f85c2a to 908ace8 Compare January 15, 2025 13:44
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Jan 17, 2025

Benchmarks

Benchmark execution time: 2025-02-04 13:17:24

Comparing candidate commit ee3c320 in PR branch baptiste.foy/FA/library-config-libdatadog with baseline commit af9098c in branch main.

Found 2 performance improvements and 0 performance regressions! Performance is the same for 392 metrics, 2 unstable metrics.

scenario:iast_aspects-ospathdirname_aspect

  • 🟩 execution_time [-434.186ns; -373.254ns] or [-10.755%; -9.246%]

scenario:iast_aspects-ospathsplitext_aspect

  • 🟩 execution_time [-372.226ns; -323.480ns] or [-9.303%; -8.085%]

Copy link
Copy Markdown
Contributor

@taegyunkim taegyunkim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 I'd like to suggest not adding new modules under /profiling as the functionality is not profiling. You should be able to expose the libdatadog API through src/core, or add a new rust/python module under src/

@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch 2 times, most recently from 4bd0ef9 to 217fa81 Compare January 21, 2025 13:41
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from 217fa81 to 39af866 Compare January 21, 2025 13:58
@BaptisteFoy BaptisteFoy changed the title upgrade(tracer): Support libdatadog's library_config for config through file feat(config): Support libdatadog's library_config for config through file Jan 21, 2025
@BaptisteFoy BaptisteFoy changed the title feat(config): Support libdatadog's library_config for config through file feat(config): support libdatadog's library_config for config through file Jan 21, 2025
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from 55ce7fe to df2f272 Compare January 21, 2025 14:20
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from df2f272 to a1877e2 Compare January 21, 2025 14:28
@datadog-dd-trace-py-rkomorn
Copy link
Copy Markdown

datadog-dd-trace-py-rkomorn Bot commented Jan 21, 2025

Datadog Report

Branch report: baptiste.foy/FA/library-config-libdatadog
Commit report: 1575326
Test service: dd-trace-py

✅ 0 Failed, 208 Passed, 1390 Skipped, 5m 3.12s Total duration (35m 0.17s time saved)

@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch from bb2848b to 32de0db Compare January 21, 2025 16:38
@BaptisteFoy BaptisteFoy force-pushed the baptiste.foy/FA/library-config-libdatadog branch 5 times, most recently from fddf037 to bac1549 Compare January 22, 2025 15:23
BaptisteFoy and others added 2 commits January 28, 2025 15:40
## 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
- [x] 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)
Comment thread src/native/Cargo.toml Outdated
5. Default values
"""
for key, value in get_configuration_from_disk().items():
os.environ[key] = str(value).lower()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I love this 🤔

I don't have a good suggestion, but modifying system state in this way just feels weird.

would we expect that a user should be able to access/see the configuration applied by accessing it at os.environ[key] ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does really feel weird to me too; and to be fair it's a hack to make it work quickly. There is no global configuration object that is used everywhere that we can use.

Hopefully in the not-so-far future we'll be able to properly apply this configuration and track its origin; but this is a whole other problem to tackle.

return False # If one or both modules are not imported, return False


def test_native_before_settings():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably have a test that applying a configuration via file gets applied to the application.

do we expect to have system-tests for this stuff as well? (if not, can we?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should; would you have any pointers on how I can do so?

Besides, yes we want to add system-tests to test this behaviour on customer-like systems.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, yes we want to add system-tests to test this behaviour on customer-like systems

Can we add those before we merge this? It should be fully tested before we merge, since as soon as it is merged it can be released.

Copy link
Copy Markdown
Contributor

@paullegranddc paullegranddc Feb 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fully tested before we merge, since as soon as it is merged it can be released.

Would you be ok with merging this under an experimental flag that disables calling to this code by default, so we are sure no customer uses it even if we release? It's hard to bootstrap system-tests if we don't have any merged language implementation to run the actual tests against.

We need to make sure that this code doesn't crash stuff obviously but this is something that can be tested in integration tests in ddtrace-py rather than in system-tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to write tests against a dev version of this library pretty easily: https://github.com/DataDog/system-tests/blob/main/docs/execute/binaries.md#python-library

Merging tests in system-tests can be tricky since we need to ensure they are expected to fail on older versions.

I'd prefer the approach of writing at least the first pass of tests against this branch, but otherwise, a private/hidden feature flag would be ok.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've written a first system test and made it pass locally against this PR: DataDog/system-tests#3982. Happy to get your review @brettlangdon. Let me know if there is anything to change on this PR to run this test.

christophe-papazian and others added 4 commits January 28, 2025 16:28
Depending of the timing, libddwaf loading process could create triggers
that would create loops in our instrumentation.
From what I investigated:
- if loaded too early, it could have bad interactions with gevent.
- if loaded too late, it could be self instrumented by the tracer,
creating a loop, as ctypes is using Popen and subprocess.

while keeping the late loading introduced by 2 previous PRs
- #11987
- #12013
this PR introduced a mechanism to bypass tracer instrumentation during
ctypes loading, to avoid a possible loop that would prevent the WAF to
be loaded.


## 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
- [x] 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)
…t config (#12089)

This PR makes a change to our shared distributed tracing header
injection method to dispatch signals/events instead of relying on the
global config settings, which is only modifiable via env vars. This
fixes distributed tracing for users that might rely solely on the
`LLMObs.enable()` setup config.

Programmatic `LLMObs.enable()/disable()` calls do not set the global
`config._llmobs_enabled` boolean setting, which is only controlled by
the `DD_LLMOBS_ENABLED` env var. This was problematic for users that
relied on manual `LLMObs.enable()` setup (i.e. no env vars) because our
distributed tracing injection code only checks the global config to
inject llmobs parent IDs into request headers. If users manually enabled
LLMObs without any env vars, then this would not be reflected in the
global config value and thus LLMObs parent IDs would never be injected
into the request headers.

We can't check directly if LLMObs is enabled in the http injection
module because:
1. This would require us to import significant product-specific
LLMObs-code into the shared http injector helper module which would
impact non-LLMObs users' app performance
2. Circular imports in LLMObs which imports http injector logic to use
in its own helpers

Instead of doing our check based on the global `config._llmobs_enabled`
setting, we now send a tracing event to our shared product listeners,
and register a corresponding `LLMObs._inject_llmobs_context()` hook to
be called for all inject() calls if LLMObs is enabled (we check the
LLMObs instance, not the global config setting value).

~One risk and why I don't like changing global config settings is
because this then implies that it is no longer global or tied to an env
var (I want to push for env var configuration where possible over manual
overriding/enabling). If a global enabled config can be toggled
indiscriminately then this could open a can of worms for
enabling/disabling logic in our LLMObs service, which isn't really
designed to be toggled on/off multiple times in the app's lifespan.
However if some users cannot rely on env vars, then I don't see any
other solution that does not couple tracer internal code with LLMObs
code which is a no-option.~ (UPDATE: we avoided this issue by using
signal dispatching)

## 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
- [x] 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)
ddtrace v3.0 is set to remove `ddtrace.providers` module from the public
API. However we should still allow users to use their own
ContextProviders. This PR ensures the BaseContextProvider remains in the
public API and can be used in `tracer.configure(...)`.

## 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
- [x] 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)
The shared pipeline is introducing support for windows OCI packages.
This PR ensure dd-trace-py doesn't generate nonsensical packages.
Windows support can be added later.

This was tested by using the WIP branch of one-pipeline

## 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
- [x] 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)

---------

Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
ZStriker19 pushed a commit that referenced this pull request Jan 30, 2025
This PR depends on #12063.

Rename src/core to src/native. This is laying ground as a [following
PR](#11839) will need to
import native code in `ddtrace.__init__.py`. Without this change this
would create a dependency loop between `ddtrace` & `ddtrace.core`
through `event_hub.py`.

This PR only renames files, so a non-regression test is the only thing
needed.

## 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
- [x] 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)
@BaptisteFoy
Copy link
Copy Markdown
Collaborator Author

Closing in favour of #12260

mabdinur pushed a commit that referenced this pull request Feb 13, 2025
…file (#12260)

## Description of changes
Most changes were taken from
#11839

- Bumps `libdatadog` to v16.0.2
- Starts using the library_config component of `libdatadog` that allows
reading configuration from a file **with a higher precedence than
environment variables**

### Supported config entries
As of libdatadog v16.0.2:
- DD_APM_TRACING_ENABLED
- DD_RUNTIME_METRICS_ENABLED
- DD_LOGS_INJECTION
- DD_PROFILING_ENABLED
- DD_DATA_STREAMS_ENABLED
- DD_APPSEC_ENABLED
- DD_IAST_ENABLED
- DD_DYNAMIC_INSTRUMENTATION_ENABLED
- DD_DATA_JOBS_ENABLED
- DD_APPSEC_SCA_ENABLED
- DD_TRACE_DEBUG
- DD_SERVICE
- DD_ENV
- DD_VERSION


## Testing strategy
Added a unit test.

To test this PR, you can:
1. Create a Linux VM
2. Start this tracer version & ensure everything works well
(non-regression)
3. Create a file at the following path:
`/etc/datadog-agent/application_monitoring.yaml`
4. Write the following content in the file:
```yaml
rules:
  - selectors:
      - origin: language
        matches:
          - python
        operator: equals
    configuration:
      DD_TRACE_DEBUG: true
```
5. Start this tracer version
6. Verify that debug logs are properly enabled

## Additional concerns
Relevant system test: DataDog/system-tests#3982

## 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
- [x] 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)
gnufede pushed a commit that referenced this pull request Feb 19, 2025
…file (#12260)

## Description of changes
Most changes were taken from
#11839

- Bumps `libdatadog` to v16.0.2
- Starts using the library_config component of `libdatadog` that allows
reading configuration from a file **with a higher precedence than
environment variables**

### Supported config entries
As of libdatadog v16.0.2:
- DD_APM_TRACING_ENABLED
- DD_RUNTIME_METRICS_ENABLED
- DD_LOGS_INJECTION
- DD_PROFILING_ENABLED
- DD_DATA_STREAMS_ENABLED
- DD_APPSEC_ENABLED
- DD_IAST_ENABLED
- DD_DYNAMIC_INSTRUMENTATION_ENABLED
- DD_DATA_JOBS_ENABLED
- DD_APPSEC_SCA_ENABLED
- DD_TRACE_DEBUG
- DD_SERVICE
- DD_ENV
- DD_VERSION


## Testing strategy
Added a unit test.

To test this PR, you can:
1. Create a Linux VM
2. Start this tracer version & ensure everything works well
(non-regression)
3. Create a file at the following path:
`/etc/datadog-agent/application_monitoring.yaml`
4. Write the following content in the file:
```yaml
rules:
  - selectors:
      - origin: language
        matches:
          - python
        operator: equals
    configuration:
      DD_TRACE_DEBUG: true
```
5. Start this tracer version
6. Verify that debug logs are properly enabled

## Additional concerns
Relevant system test: DataDog/system-tests#3982

## 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
- [x] 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)
RamyElkest pushed a commit that referenced this pull request Feb 20, 2025
…file (#12260)

## Description of changes
Most changes were taken from
#11839

- Bumps `libdatadog` to v16.0.2
- Starts using the library_config component of `libdatadog` that allows
reading configuration from a file **with a higher precedence than
environment variables**

### Supported config entries
As of libdatadog v16.0.2:
- DD_APM_TRACING_ENABLED
- DD_RUNTIME_METRICS_ENABLED
- DD_LOGS_INJECTION
- DD_PROFILING_ENABLED
- DD_DATA_STREAMS_ENABLED
- DD_APPSEC_ENABLED
- DD_IAST_ENABLED
- DD_DYNAMIC_INSTRUMENTATION_ENABLED
- DD_DATA_JOBS_ENABLED
- DD_APPSEC_SCA_ENABLED
- DD_TRACE_DEBUG
- DD_SERVICE
- DD_ENV
- DD_VERSION


## Testing strategy
Added a unit test.

To test this PR, you can:
1. Create a Linux VM
2. Start this tracer version & ensure everything works well
(non-regression)
3. Create a file at the following path:
`/etc/datadog-agent/application_monitoring.yaml`
4. Write the following content in the file:
```yaml
rules:
  - selectors:
      - origin: language
        matches:
          - python
        operator: equals
    configuration:
      DD_TRACE_DEBUG: true
```
5. Start this tracer version
6. Verify that debug logs are properly enabled

## Additional concerns
Relevant system test: DataDog/system-tests#3982

## 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
- [x] 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants