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: add integration registry #13051

Closed
wants to merge 15 commits into from
Closed

Conversation

wconti27
Copy link
Contributor

@wconti27 wconti27 commented Apr 3, 2025

Description

This PR adds a registry for integrations, that for a start contains the name of the integration and the package dependency name. Within the registry, other information is also stored on a per integration basis.
This information includes:

  • PIP dependency name
  • If the package is an external package or is a stdlib
  • If the integration is patched by default
  • If the integration is patchable (some integrations such as cherrypy do not have patch() methods
  • Instrumented module name
  • Tested Version Min
  • Tested Version Max
  • All tested Versions

Tests added with this PR include

  • test_registry_conforms_to_schema: Validates the overall structure and data types of registry.yaml against the _registry_schema.json definition using jsonschema.
  • test_all_internal_dirs_accounted_for: Ensures every subdirectory within ddtrace/contrib/internal has a corresponding integration_name entry in registry.yaml, and vice-versa.
  • test_registry_integrations_in_patch_modules: Verifies that every integration marked is_patchable: true in registry.yaml also exists as a key in the PATCH_MODULES dictionary in ddtrace._monkey.py.
  • test_dependency_name_only_if_external: Checks that the dependency_name field is only present for integrations marked is_external_package: true and that such external integrations have either a dependency_name or instrumented_modules.
  • test_version_fields_only_if_external: Ensures the tested_version_* fields only exist for integrations marked is_external_package: true and validates that the version strings follow SemVer format.
  • test_patched_by_default_only_if_patchable: Confirms the patched_by_default field generally only exists if is_patchable: true (allowing for the "MISSING..." status).
  • test_instrumented_modules_only_if_patchable: Checks that the instrumented_modules field generally only exists if is_patchable: true.
  • test_external_packages_have_version_fields: Ensures all non-deprecated, external integrations have the tested_version_min, tested_version_max, and tested_versions_list fields defined.
  • test_remapped_modules_in_contrib_map: Verifies that if an integration's instrumented_modules list doesn't include the integration_name itself, that integration_name must be present as a key in the _MODULES_FOR_CONTRIB mapping in ddtrace._monkey.py.

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

@wconti27 wconti27 requested review from a team as code owners April 3, 2025 17:28
Copy link
Contributor

github-actions bot commented Apr 3, 2025

CODEOWNERS have been resolved as:

.riot/requirements/12febf5.txt                                          @DataDog/apm-python
ddtrace/contrib/integration_registry/_registry_schema.json              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/integration_registry/_registry_schema_goal.json         @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/integration_registry/registry.yaml                      @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/test_registry.py                                          @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/_monkey.py                                                      @DataDog/apm-core-python
lib-injection/sources/min_compatible_versions.csv                       @DataDog/apm-core-python
min_compatible_versions.csv                                             @DataDog/apm-core-python
riotfile.py                                                             @DataDog/apm-python
tests/suitespec.yml                                                     @DataDog/python-guild @DataDog/apm-core-python

Copy link
Contributor

github-actions bot commented Apr 3, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 234 ± 3 ms.

The average import time from base is: 234 ± 3 ms.

The import time difference between this PR and base is: -0.5 ± 0.1 ms.

Import time breakdown

The following import paths have grown:

ddtrace.auto 0.109 ms (0.05%)
ddtrace 0.109 ms (0.05%)
ddtrace.trace 0.109 ms (0.05%)
ddtrace._trace.filters 0.109 ms (0.05%)
ddtrace._trace.processor 0.109 ms (0.05%)
ddtrace._trace.sampler 0.109 ms (0.05%)

The following import paths have shrunk:

ddtrace.auto 1.947 ms (0.83%)
ddtrace.bootstrap.sitecustomize 1.183 ms (0.51%)
ddtrace.bootstrap.preload 1.183 ms (0.51%)
ddtrace.internal.products 1.183 ms (0.51%)
ddtrace.internal.remoteconfig.client 0.601 ms (0.26%)
ddtrace 0.764 ms (0.33%)
ddtrace.trace 0.103 ms (0.04%)
ddtrace._trace.filters 0.103 ms (0.04%)
ddtrace._trace.processor 0.103 ms (0.04%)
ddtrace._trace.sampler 0.103 ms (0.04%)
ddtrace._trace.span 0.103 ms (0.04%)

@wconti27 wconti27 marked this pull request as draft April 3, 2025 19:15
@pr-commenter
Copy link

pr-commenter bot commented Apr 7, 2025

Benchmarks

Benchmark execution time: 2025-04-07 16:49:57

Comparing candidate commit 05e6e3c in PR branch conti/add-integration-registry with baseline commit 8a4c296 in branch main.

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

scenario:flasksqli-appsec-enabled

  • 🟩 execution_time [-181.528µs; -171.997µs] or [-7.857%; -7.445%]

scenario:flasksqli-iast-enabled

  • 🟩 execution_time [-178.975µs; -169.460µs] or [-7.751%; -7.339%]

scenario:flasksqli-tracer-enabled

  • 🟩 execution_time [-184.237µs; -171.915µs] or [-7.969%; -7.436%]

scenario:iast_aspects-replace_aspect

  • 🟩 execution_time [-729.269ns; -660.193ns] or [-12.677%; -11.477%]

@wconti27 wconti27 closed this Apr 10, 2025
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.

1 participant