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(pin): prevent overriding the global tracer #12219

Draft
wants to merge 4 commits into
base: munir/make-tracer-a-singleton-2
Choose a base branch
from

Conversation

mabdinur
Copy link
Contributor

@mabdinur mabdinur commented Feb 4, 2025

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

pin = Pin(service, tags=tags)
else:
pin = Pin(service, tags=tags, tracer=pin.tracer)
pin = Pin(service, tags=tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

variable name is the same as a function parameter (...read more)

A function parameter should only be read and not be modified. If your intent is to modify the value of the parameter, return the value in the function and handle the new value in the caller of the function.

View in Datadog  Leave us feedback  Documentation

Copy link
Contributor

github-actions bot commented Feb 4, 2025

CODEOWNERS have been resolved as:

ddtrace/_trace/pin.py                                                   @DataDog/apm-sdk-api-python
ddtrace/contrib/internal/asgi/middleware.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/mongoengine/trace.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/pylibmc/client.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/sqlalchemy/engine.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/tornado/application.py                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/appsec/contrib_appsec/django_app/urls.py                          @DataDog/asm-python
tests/appsec/contrib_appsec/fastapi_app/app.py                          @DataDog/asm-python
tests/appsec/contrib_appsec/flask_app/app.py                            @DataDog/asm-python
tests/appsec/contrib_appsec/test_flask.py                               @DataDog/asm-python
tests/appsec/contrib_appsec/utils.py                                    @DataDog/asm-python
tests/appsec/integrations/django_tests/conftest.py                      @DataDog/asm-python
tests/commands/ddtrace_run_integration.py                               @DataDog/apm-core-python
tests/contrib/aiobotocore/utils.py                                      @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/aiohttp/test_aiohttp_client.py                            @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/aiohttp_jinja2/conftest.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/aiohttp_jinja2/test_aiohttp_jinja2.py                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/aiomysql/test_aiomysql.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/aiopg/test.py                                             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/algoliasearch/test.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/anthropic/conftest.py                                     @DataDog/ml-observability
tests/contrib/aredis/test_aredis.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/asyncpg/test_asyncpg.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/avro/test_avro.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/boto/test.py                                              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/botocore/test.py                                          @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/botocore/test_bedrock.py                                  @DataDog/ml-observability
tests/contrib/botocore/test_bedrock_llmobs.py                           @DataDog/ml-observability
tests/contrib/botocore/test_stepfunctions.py                            @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/cassandra/test.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/autopatch.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/base.py                                            @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/test_app.py                                        @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/test_integration.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/test_patch.py                                      @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/celery/test_tagging.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/consul/test.py                                            @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/dbapi/test_dbapi.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/dbapi/test_dbapi_appsec.py                                @DataDog/asm-python
tests/contrib/dbapi_async/test_dbapi_async.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/django/conftest.py                                        @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/django/test_django_dbm.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/dogpile_cache/test_tracing.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/dramatiq/test_integration.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/elasticsearch/test_elasticsearch.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/__init__.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/test_blueprint.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/test_flask_helpers.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/test_signals.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask/test_template.py                                    @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/flask_autopatch/test_flask_autopatch.py                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/google_generativeai/conftest.py                           @DataDog/ml-observability
tests/contrib/grpc/common.py                                            @DataDog/apm-idm-python @DataDog/asm-python
tests/contrib/grpc/test_grpc.py                                         @DataDog/apm-idm-python @DataDog/asm-python
tests/contrib/grpc_aio/test_grpc_aio.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/httplib/test_httplib.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/httplib/test_httplib_distributed.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/httpx/test_httpx.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/httpx/test_httpx_pre_0_11.py                              @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/jinja2/test_jinja2.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/kafka/test_kafka.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/kombu/test.py                                             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/langchain/conftest.py                                     @DataDog/ml-observability
tests/contrib/langgraph/conftest.py                                     @DataDog/ml-observability
tests/contrib/mako/test_mako.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/mariadb/test_mariadb.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/molten/test_molten.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/molten/test_molten_di.py                                  @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/mongoengine/test.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/mysql/test_mysql.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/mysqldb/test_mysqldb.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/openai/conftest.py                                        @DataDog/ml-observability
tests/contrib/psycopg/test_psycopg.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/psycopg/test_psycopg_async.py                             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/psycopg2/test_psycopg.py                                  @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pylibmc/test.py                                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pymemcache/test_client.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pymemcache/test_client_defaults.py                        @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pymemcache/test_client_mixin.py                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pymongo/test.py                                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pymysql/test_pymysql.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pynamodb/test_pynamodb.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pyodbc/test_pyodbc.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/pytest/test_pytest.py                                     @DataDog/ci-app-libraries
tests/contrib/redis/test_redis.py                                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/redis/test_redis_asyncio.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/redis/test_redis_cluster.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/redis/test_redis_cluster_asyncio.py                       @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/rediscluster/test.py                                      @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/rq/test_rq.py                                             @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/shared_tests.py                                           @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/shared_tests_async.py                                     @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/snowflake/test_snowflake.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/sqlalchemy/test_patch.py                                  @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/sqlite3/test_sqlite3.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/starlette/test_starlette.py                               @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/subprocess/test_subprocess.py                             @DataDog/asm-python
tests/contrib/urllib3/test_urllib3.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/vertexai/conftest.py                                      @DataDog/ml-observability
tests/contrib/vertica/test_vertica.py                                   @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/yaaredis/test_yaaredis.py                                 @DataDog/apm-core-python @DataDog/apm-idm-python
tests/tracer/test_instance_config.py                                    @DataDog/apm-sdk-api-python
tests/tracer/test_trace_utils.py                                        @DataDog/apm-sdk-api-python
tests/utils.py                                                          @DataDog/python-guild

@mabdinur mabdinur force-pushed the munir/remove-deprecations-from-pin branch from 20d6173 to ddf975c Compare February 4, 2025 18:14
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Feb 4, 2025

Datadog Report

Branch report: munir/remove-deprecations-from-pin
Commit report: 4765935
Test service: dd-trace-py

❌ 103 Failed (0 Known Flaky), 472 Passed, 305 Skipped, 9m 22.22s Total duration (11m 22.76s time saved)

❌ Failed Tests (103)

This report shows up to 5 failed tests.

  • MysqlConnectorTestCase::test_engine_connect_execute - test_mysql.py - Details

  • MysqlConnectorTestCase::test_engine_execute_errors - test_mysql.py - Details

    Expand for error
     0 != 1
    
  • MysqlConnectorTestCase::test_opentracing - test_mysql.py - Details

  • MysqlConnectorTestCase::test_orm_insert - test_mysql.py - Details

  • MysqlConnectorTestCase::test_session_query - test_mysql.py - Details

@pr-commenter
Copy link

pr-commenter bot commented Feb 4, 2025

Benchmarks

Benchmark execution time: 2025-02-04 21:03:04

Comparing candidate commit d3624a0 in PR branch munir/remove-deprecations-from-pin with baseline commit dc30784 in branch munir/make-tracer-a-singleton-2.

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

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