Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: instana/python-sensor
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v71
Choose a base ref
...
head repository: instana/python-sensor
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Loading
Showing with 4,508 additions and 1,101 deletions.
  1. +94 −177 .circleci/config.yml
  2. +58 −0 .github/workflows/py3140_build.yml
  3. +3 −0 .gitignore
  4. +2 −2 .tekton/.currency/currency-tasks.yaml
  5. +28 −28 .tekton/.currency/docs/report.md
  6. +1 −0 .tekton/.currency/resources/requirements.txt
  7. +110 −25 .tekton/.currency/scripts/generate_report.py
  8. +32 −18 .tekton/pipeline.yaml
  9. +16 −12 .tekton/python-tracer-prepuller.yaml
  10. +5 −1 .tekton/run_unittests.sh
  11. +40 −0 .tekton/task.yaml
  12. +21 −0 Dockerfile-py3140
  13. +14 −2 docker-compose.yml
  14. +1 −0 pytest.ini
  15. +50 −0 run_tests.sh
  16. +30 −14 src/instana/__init__.py
  17. +18 −29 src/instana/agent/host.py
  18. +40 −44 src/instana/collector/base.py
  19. +117 −0 src/instana/instrumentation/aio_pika.py
  20. +78 −0 src/instana/instrumentation/aioamqp.py
  21. +122 −0 src/instana/instrumentation/aws/boto3.py
  22. +31 −0 src/instana/instrumentation/aws/dynamodb.py
  23. +75 −71 src/instana/instrumentation/aws/lambda_inst.py
  24. +83 −0 src/instana/instrumentation/aws/s3.py
  25. +0 −174 src/instana/instrumentation/boto3_inst.py
  26. 0 src/instana/instrumentation/{cassandra_inst.py → cassandra.py}
  27. 0 src/instana/instrumentation/{couchbase_inst.py → couchbase.py}
  28. +2 −2 src/instana/instrumentation/{fastapi_inst.py → fastapi.py}
  29. +15 −9 src/instana/instrumentation/{gevent_inst.py → gevent.py}
  30. +1 −0 src/instana/instrumentation/kafka/__init__.py
  31. +184 −0 src/instana/instrumentation/kafka/confluent_kafka_python.py
  32. +156 −0 src/instana/instrumentation/kafka/kafka_python.py
  33. +2 −0 src/instana/instrumentation/pika.py
  34. +0 −1 src/instana/instrumentation/{sanic_inst.py → sanic.py}
  35. +125 −0 src/instana/instrumentation/spyne.py
  36. 0 src/instana/instrumentation/{starlette_inst.py → starlette.py}
  37. +57 −0 src/instana/options.py
  38. +141 −68 src/instana/propagators/base_propagator.py
  39. +12 −0 src/instana/propagators/format.py
  40. +139 −0 src/instana/propagators/kafka_propagator.py
  41. +4 −0 src/instana/span/kind.py
  42. +58 −10 src/instana/span/registered_span.py
  43. +2 −0 src/instana/span/span.py
  44. +17 −5 src/instana/tracer.py
  45. +56 −54 src/instana/util/__init__.py
  46. +13 −0 src/instana/util/span_utils.py
  47. +7 −14 src/instana/util/traceutils.py
  48. +1 −1 src/instana/version.py
  49. +30 −0 tests/agent/test_host.py
  50. +10 −0 tests/apps/spyne_app/__init__.py
  51. +67 −0 tests/apps/spyne_app/app.py
  52. +409 −0 tests/clients/boto3/test_boto3_dynamodb.py
  53. +81 −292 tests/clients/boto3/test_boto3_s3.py
  54. +327 −0 tests/clients/kafka/test_confluent_kafka.py
  55. +371 −0 tests/clients/kafka/test_kafka_python.py
  56. +171 −0 tests/clients/test_aio_pika.py
  57. +1 −0 tests/clients/test_sqlalchemy.py
  58. +5 −3 tests/clients/test_urllib3.py
  59. +0 −5 tests/collector/test_base_collector.py
  60. +8 −1 tests/conftest.py
  61. +131 −0 tests/frameworks/test_aioamqp.py
  62. +340 −0 tests/frameworks/test_spyne.py
  63. +19 −3 tests/helpers.py
  64. +2 −0 tests/requirements-aws.txt
  65. +1 −2 tests/requirements-cassandra.txt
  66. +1 −2 tests/requirements-couchbase.txt
  67. +1 −2 tests/requirements-gevent-starlette.txt
  68. +5 −0 tests/requirements-kafka.txt
  69. +3 −0 tests/requirements-minimal.txt
  70. +4 −2 tests/requirements-pre314.txt
  71. +8 −4 tests/requirements.txt
  72. +42 −0 tests/span/test_registered_span.py
  73. +1 −0 tests/span/test_span.py
  74. +384 −0 tests/test_options.py
  75. +1 −1 tests/test_tracer.py
  76. +3 −1 tests/test_tracer_provider.py
  77. +15 −0 tests/util/test_span_utils.py
  78. +0 −22 tests/util/test_traceutils.py
  79. +6 −0 tests_autowrapt/test_autowrapt.py
271 changes: 94 additions & 177 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: 2.1

# More about orbs: https://circleci.com/docs/2.0/using-orbs/
# orbs:
# ruby: circleci/ruby@1.1.2

commands:
check-if-tests-needed:
steps:
@@ -29,19 +25,26 @@ commands:
}
pip-install-deps:
parameters:
requirements:
default: "tests/requirements.txt"
type: string
steps:
- run:
name: Install Python Dependencies
command: |
python -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install 'wheel>=0.29.0'
pip install 'wheel==0.45.1'
pip install -r requirements.txt
pip-install-tests-deps:
parameters:
requirements:
default: "tests/requirements.txt"
type: string
steps:
- run:
name: Install Python Tests Dependencies
command: |
. venv/bin/activate
pip install -r <<parameters.requirements>>
run-tests-with-coverage-report:
@@ -52,6 +55,9 @@ commands:
gevent:
default: ""
type: string
kafka:
default: ""
type: string
tests:
default: "tests"
type: string
@@ -61,6 +67,7 @@ commands:
environment:
CASSANDRA_TEST: "<<parameters.cassandra>>"
GEVENT_STARLETTE_TEST: "<<parameters.gevent>>"
KAFKA_TEST: "<<parameters.kafka>>"
command: |
. venv/bin/activate
coverage run --source=instana -m pytest -v --junitxml=test-results <<parameters.tests>>
@@ -117,9 +124,12 @@ commands:
path: htmlcov

jobs:
python38:
python3x:
parameters:
py-version:
type: string
docker:
- image: public.ecr.aws/docker/library/python:3.8
- image: public.ecr.aws/docker/library/python:<<parameters.py-version>>
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
@@ -141,41 +151,14 @@ jobs:
- checkout
- check-if-tests-needed
- pip-install-deps
- pip-install-tests-deps
- run-tests-with-coverage-report
- store-pytest-results
- store-coverage-report

python39:
docker:
- image: public.ecr.aws/docker/library/python:3.9
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: instana_test_db
- image: public.ecr.aws/docker/library/mariadb:11.3.2
environment:
MYSQL_ROOT_PASSWORD: passw0rd
MYSQL_DATABASE: instana_test_db
- image: public.ecr.aws/docker/library/redis:7.2.4-bookworm
- image: public.ecr.aws/docker/library/rabbitmq:3.13.0
- image: public.ecr.aws/docker/library/mongo:7.0.6
- image: quay.io/thekevjames/gcloud-pubsub-emulator:latest
environment:
PUBSUB_EMULATOR_HOST: 0.0.0.0:8681
PUBSUB_PROJECT1: test-project,test-topic
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps
- run-tests-with-coverage-report
- store-pytest-results
- store-coverage-report

python310:
python314:
docker:
- image: public.ecr.aws/docker/library/python:3.10
- image: ghcr.io/pvital/pvital-py3.14.0:latest
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
@@ -196,67 +179,50 @@ jobs:
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run: |
cp -a /root/base/venv ./venv
. venv/bin/activate
pip install 'wheel==0.45.1'
pip install -r requirements.txt
- run-tests-with-coverage-report
- store-pytest-results
- store-coverage-report

python311:
py39cassandra:
docker:
- image: public.ecr.aws/docker/library/python:3.11
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: instana_test_db
- image: public.ecr.aws/docker/library/mariadb:11.3.2
environment:
MYSQL_ROOT_PASSWORD: passw0rd
MYSQL_DATABASE: instana_test_db
- image: public.ecr.aws/docker/library/redis:7.2.4-bookworm
- image: public.ecr.aws/docker/library/rabbitmq:3.13.0
- image: public.ecr.aws/docker/library/mongo:7.0.6
- image: quay.io/thekevjames/gcloud-pubsub-emulator:latest
- image: public.ecr.aws/docker/library/python:3.9
- image: public.ecr.aws/docker/library/cassandra:3.11.16-jammy
environment:
PUBSUB_EMULATOR_HOST: 0.0.0.0:8681
PUBSUB_PROJECT1: test-project,test-topic
MAX_HEAP_SIZE: 2048m
HEAP_NEWSIZE: 512m
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
- pip-install-deps
- pip-install-tests-deps:
requirements: "tests/requirements-cassandra.txt"
- run-tests-with-coverage-report:
cassandra: "true"
tests: "tests/clients/test_cassandra-driver.py"
- store-pytest-results
- store-coverage-report

python312:
py39gevent_starlette:
docker:
- image: public.ecr.aws/docker/library/python:3.12
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: instana_test_db
- image: public.ecr.aws/docker/library/mariadb:11.3.2
environment:
MYSQL_ROOT_PASSWORD: passw0rd
MYSQL_DATABASE: instana_test_db
- image: public.ecr.aws/docker/library/redis:7.2.4-bookworm
- image: public.ecr.aws/docker/library/rabbitmq:3.13.0
- image: public.ecr.aws/docker/library/mongo:7.0.6
- image: quay.io/thekevjames/gcloud-pubsub-emulator:latest
environment:
PUBSUB_EMULATOR_HOST: 0.0.0.0:8681
PUBSUB_PROJECT1: test-project,test-topic
- image: public.ecr.aws/docker/library/python:3.9
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
- pip-install-deps
- pip-install-tests-deps:
requirements: "tests/requirements-gevent-starlette.txt"
- run-tests-with-coverage-report:
# TODO: uncomment once gevent instrumentation is done
# gevent: "true"
# tests: "tests/frameworks/test_gevent.py tests/frameworks/test_starlette.py"
tests: "tests/frameworks/test_starlette.py"
- store-pytest-results
- store-coverage-report

@@ -267,87 +233,56 @@ jobs:
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- pip-install-deps
- pip-install-tests-deps:
requirements: "tests/requirements-aws.txt"
- run-tests-with-coverage-report:
tests: "tests_aws"
- store-pytest-results
- store-coverage-report

python313:
py312kafka:
docker:
- image: public.ecr.aws/docker/library/python:3.13
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: instana_test_db
- image: public.ecr.aws/docker/library/mariadb:11.3.2
environment:
MYSQL_ROOT_PASSWORD: passw0rd
MYSQL_DATABASE: instana_test_db
- image: public.ecr.aws/docker/library/redis:7.2.4-bookworm
- image: public.ecr.aws/docker/library/rabbitmq:3.13.0
- image: public.ecr.aws/docker/library/mongo:7.0.6
- image: quay.io/thekevjames/gcloud-pubsub-emulator:latest
environment:
PUBSUB_EMULATOR_HOST: 0.0.0.0:8681
PUBSUB_PROJECT1: test-project,test-topic
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- run-tests-with-coverage-report
- store-pytest-results
- store-coverage-report

python314:
docker:
- image: public.ecr.aws/docker/library/python:3.14.0a4
- image: public.ecr.aws/docker/library/postgres:16.2-bookworm
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: instana_test_db
- image: public.ecr.aws/docker/library/mariadb:11.3.2
environment:
MYSQL_ROOT_PASSWORD: passw0rd
MYSQL_DATABASE: instana_test_db
- image: public.ecr.aws/docker/library/redis:7.2.4-bookworm
- image: public.ecr.aws/docker/library/rabbitmq:3.13.0
- image: public.ecr.aws/docker/library/mongo:7.0.6
- image: quay.io/thekevjames/gcloud-pubsub-emulator:latest
- image: public.ecr.aws/docker/library/python:3.12
- image: public.ecr.aws/bitnami/kafka:3.9.0
environment:
PUBSUB_EMULATOR_HOST: 0.0.0.0:8681
PUBSUB_PROJECT1: test-project,test-topic
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@localhost:9093
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,EXTERNAL://localhost:9094
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-pre314.txt"
- run-tests-with-coverage-report
- pip-install-deps
- pip-install-tests-deps:
requirements: "tests/requirements-kafka.txt"
- run-tests-with-coverage-report:
kafka: "true"
tests: "tests/clients/kafka/test*.py"
- store-pytest-results
- store-coverage-report

py39cassandra:
autowrapt:
parameters:
py-version:
type: string
docker:
- image: public.ecr.aws/docker/library/python:3.9
- image: public.ecr.aws/docker/library/cassandra:3.11.16-jammy
- image: public.ecr.aws/docker/library/python:<<parameters.py-version>>
environment:
MAX_HEAP_SIZE: 2048m
HEAP_NEWSIZE: 512m
AUTOWRAPT_BOOTSTRAP: instana
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-cassandra.txt"
- pip-install-deps
- pip-install-tests-deps:
requirements: "tests/requirements-minimal.txt"
- run-tests-with-coverage-report:
cassandra: "true"
tests: "tests/clients/test_cassandra-driver.py"
tests: "tests_autowrapt"
- store-pytest-results
- store-coverage-report

@@ -358,52 +293,34 @@ jobs:
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements.txt"
- pip-install-deps
- pip-install-tests-deps
- store-pytest-results
# - run_sonarqube

py39gevent_starlette:
docker:
- image: public.ecr.aws/docker/library/python:3.9
working_directory: ~/repo
steps:
- checkout
- check-if-tests-needed
- pip-install-deps:
requirements: "tests/requirements-gevent-starlette.txt"
- run-tests-with-coverage-report:
# TODO: uncomment once gevent instrumentation is done
# gevent: "true"
# tests: "tests/frameworks/test_gevent.py tests/frameworks/test_starlette.py"
tests: "tests/frameworks/test_starlette.py"
- store-pytest-results
- store-coverage-report

workflows:
version: 2
build:
tests:
jobs:
- python38
- python39
- python310
- python311
- python312
- python313
- python3x:
matrix:
parameters:
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
- python314
- py39cassandra
- py39gevent_starlette
- py312aws
- py312kafka
- autowrapt:
matrix:
parameters:
py-version: ["3.12", "3.13"]
- final_job:
requires:
- python38
- python39
- python310
- python311
- python312
- python313
- python3x
# Uncomment the following when giving real support to 3.14
# - python314
- py39cassandra
- py39gevent_starlette
- py312aws
- py312kafka
- autowrapt
Loading