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(trace_utils): move implementation details to internal [3.0] #12002

Conversation

mabdinur
Copy link
Contributor

Motivation

  • Create a unified public interface for all contrib utils. We will deprecate and redesign this interface in v3.0.
  • Ensure the ddtrace.contrib.internal package is self contained and does rely on ddtrace.contrib public interfaces.

Changes

  • Deprecates ddtrace.contrib.redis_utils module. Expose all public redis_utils in ddtrace.contrib.trace_utils (for now).
  • Deprecates ddtrace.contrib.trace_utils_async module. Expose all public async utils to ddtrace.contrib.trace_utils.
  • Deprecates trace_handlers, func_name, module_name, and require_modules functions exposed in ddtrace.contrib.__init__. These functions are internal to ddtrace.
  • Moves the implementation details of trace_utils, trace_utils_async, and redis_utils to ddtrace.contrib.internal.trace_util.

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

Copy link
Contributor

github-actions bot commented Jan 17, 2025

CODEOWNERS have been resolved as:

ddtrace/contrib/internal/redis_utils.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/trace_utils.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/trace_utils_async.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
releasenotes/notes/munir-refactor-trace-utils-e887e8da8a01430b.yaml     @DataDog/apm-python
ddtrace/_trace/trace_handlers.py                                        @DataDog/apm-sdk-api-python
ddtrace/_trace/utils_redis.py                                           @DataDog/apm-sdk-api-python
ddtrace/appsec/_handlers.py                                             @DataDog/asm-python
ddtrace/appsec/_processor.py                                            @DataDog/asm-python
ddtrace/appsec/_trace_utils.py                                          @DataDog/asm-python
ddtrace/appsec/_utils.py                                                @DataDog/asm-python
ddtrace/contrib/__init__.py                                             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/dbapi/__init__.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/dbapi_async/__init__.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/aiobotocore/patch.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/aiohttp/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/aiohttp_jinja2/patch.py                        @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/aiomysql/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/aioredis/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/anthropic/patch.py                             @DataDog/ml-observability
ddtrace/contrib/internal/aredis/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/asyncpg/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/azure_functions/patch.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/botocore/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/botocore/services/bedrock.py                   @DataDog/ml-observability
ddtrace/contrib/internal/botocore/services/kinesis.py                   @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/botocore/services/sqs.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/botocore/services/stepfunctions.py             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/celery/utils.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/django/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/django/restframework.py                        @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/elasticsearch/patch.py                         @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/flask/patch.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/google_generativeai/patch.py                   @DataDog/ml-observability
ddtrace/contrib/internal/grpc/patch.py                                  @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/httplib/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/httpx/patch.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/jinja2/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/langchain/patch.py                             @DataDog/ml-observability
ddtrace/contrib/internal/logbook/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/logging/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/loguru/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/mako/patch.py                                  @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/molten/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/mysql/patch.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/mysqldb/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/psycopg/async_connection.py                    @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/psycopg/connection.py                          @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/pymysql/patch.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/pynamodb/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/pyodbc/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/redis/asyncio_patch.py                         @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/redis/patch.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/requests/connection.py                         @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/requests/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/snowflake/patch.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/sqlalchemy/patch.py                            @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/starlette/patch.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/structlog/patch.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/tornado/handlers.py                            @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/urllib/patch.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/vertexai/patch.py                              @DataDog/ml-observability
ddtrace/contrib/internal/webbrowser/patch.py                            @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/yaaredis/patch.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/redis_utils.py                                          @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/trace_utils.py                                          @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/trace_utils_async.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/trace_utils_redis.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/llmobs/_integrations/base.py                                    @DataDog/ml-observability
tests/appsec/appsec/test_appsec_trace_utils.py                          @DataDog/asm-python
tests/appsec/appsec/test_asm_standalone.py                              @DataDog/asm-python
tests/appsec/appsec/test_processor.py                                   @DataDog/asm-python
tests/appsec/appsec/test_remoteconfiguration.py                         @DataDog/asm-python
tests/appsec/appsec/test_telemetry.py                                   @DataDog/asm-python
tests/contrib/asyncpg/test_asyncpg.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/django/views.py                                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/app.py                                              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/openai/test_openai_v0.py                                  @DataDog/ml-observability
tests/contrib/openai/test_openai_v1.py                                  @DataDog/ml-observability
tests/internal/test_module.py                                           @DataDog/debugger-python @DataDog/apm-core-python
tests/tracer/test_trace_utils.py                                        @DataDog/apm-sdk-api-python
tests/tracer/test_tracer.py                                             @DataDog/apm-sdk-api-python

@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jan 17, 2025

Datadog Report

Branch report: munir/refactor-trace-utils
Commit report: e5fa748
Test service: dd-trace-py

✅ 0 Failed, 130 Passed, 1468 Skipped, 4m 30.98s Total duration (35m 3.38s time saved)

@mabdinur mabdinur requested review from a team as code owners January 17, 2025 20:52
@mabdinur mabdinur requested a review from a team as a code owner January 17, 2025 21:33
@pr-commenter
Copy link

pr-commenter bot commented Jan 17, 2025

Benchmarks

Benchmark execution time: 2025-01-20 18:52:44

Comparing candidate commit e5fa748 in PR branch munir/refactor-trace-utils with baseline commit c170b14 in branch munir/remove-patch-unpatch-get-version-from-public-api.

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

@mabdinur mabdinur changed the base branch from main to munir/remove-patch-unpatch-get-version-from-public-api January 20, 2025 17:59
@mabdinur mabdinur merged commit 50c61c8 into munir/remove-patch-unpatch-get-version-from-public-api Jan 20, 2025
663 of 670 checks passed
@mabdinur mabdinur deleted the munir/refactor-trace-utils branch January 20, 2025 21:46
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