Skip to content

Commit 859963e

Browse files
authored
Merge branch 'master' into dependabot/github_actions/dot-github/workflows/actions/download-artifact-4.1.7
2 parents bbffef5 + c7c4ea0 commit 859963e

File tree

12 files changed

+229
-17
lines changed

12 files changed

+229
-17
lines changed

.github/workflows/IntegrationTesting.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
branches:
55
- master
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
711
jobs:
812
build_SDK:
913
name: Build X-Ray Python SDK
@@ -78,10 +82,9 @@ jobs:
7882
run: cp deploy.zip ./terraform
7983

8084
- name: Configure AWS Credentials
81-
uses: aws-actions/configure-aws-credentials@v1
85+
uses: aws-actions/configure-aws-credentials@v4
8286
with:
83-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
84-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
87+
role-to-assume: ${{ secrets.AWS_INTEG_TEST_ROLE_ARN }}
8588
aws-region: us-west-2
8689

8790
- name: Setup Terraform
@@ -126,10 +129,9 @@ jobs:
126129
java-version: 14
127130

128131
- name: Configure AWS Credentials
129-
uses: aws-actions/configure-aws-credentials@v1
132+
uses: aws-actions/configure-aws-credentials@v4
130133
with:
131-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
132-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
134+
role-to-assume: ${{ secrets.AWS_INTEG_TEST_ROLE_ARN }}
133135
aws-region: us-west-2
134136

135137
- name: Checkout test framework

.github/workflows/continuous-monitoring.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
schedule:
55
- cron: '*/10 * * * *'
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
711
jobs:
812
smoke-tests:
913
name: Run smoke tests
@@ -13,10 +17,9 @@ jobs:
1317
uses: actions/checkout@v3
1418

1519
- name: Configure AWS Credentials
16-
uses: aws-actions/configure-aws-credentials@v1
20+
uses: aws-actions/configure-aws-credentials@v4
1721
with:
18-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
19-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
22+
role-to-assume: ${{ secrets.AWS_INTEG_TEST_ROLE_ARN }}
2023
aws-region: us-east-1
2124

2225
- uses: actions/setup-python@v4

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
![Build Status](https://github.com/aws/aws-xray-sdk-python/actions/workflows/IntegrationTesting.yaml/badge.svg)
22
[![codecov](https://codecov.io/gh/aws/aws-xray-sdk-python/branch/master/graph/badge.svg)](https://codecov.io/gh/aws/aws-xray-sdk-python)
33

4-
### :mega: OpenTelemetry Python with AWS X-Ray
4+
# AWS X-Ray SDK for Python
5+
6+
## :mega: Upcoming Maintenance Mode on February 25, 2026
7+
8+
[The AWS X-Ray SDKs will enter maintenance mode on **`February 25, 2026`**][xray-sdk-daemon-timeline]. During maintenance mode, the X-Ray SDKs and Daemon will only receive critical bug fixes and security updates, and will not be updated to support new features.
9+
10+
We recommend that you migrate to [AWS Distro for OpenTelemetry (ADOT) or OpenTelemetry Instrumentation][xray-otel-migration-docs] to generate traces (through manual or zero-code instrumentation) from your application and send them to AWS X-Ray. OpenTelemetry is the industry-wide standard for tracing instrumentation and observability. It has a large open-source community for support and provides more instrumentations and updates. By adopting an OpenTelemetry solution, developers can leverage the latest services and innovations from AWS CloudWatch.
11+
12+
## :mega: End-of-Support on February 25, 2027
13+
14+
[The AWS X-Ray SDKs will reach end-of-support on **`February 25, 2027`**][xray-sdk-daemon-timeline]. After end-of-support, the X-Ray SDKs will no longer receive updates or releases. Previously published releases will continue to be available via public package managers and the source code will remain on GitHub.
15+
16+
[xray-otel-migration-docs]: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-migration.html
17+
[xray-sdk-daemon-timeline]: https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon-eos.html
18+
19+
-------------------------------------
20+
21+
### OpenTelemetry Python with AWS X-Ray
522

623
AWS X-Ray supports using OpenTelemetry Python and the AWS Distro for OpenTelemetry (ADOT) Collector to instrument your application and send trace data to X-Ray. The OpenTelemetry SDKs are an industry-wide standard for tracing instrumentation. They provide more instrumentations and have a larger community for support, but may not have complete feature parity with the X-Ray SDKs. See [choosing between the ADOT and X-Ray SDKs](https://docs.aws.amazon.com/xray/latest/devguide/xray-instrumenting-your-app.html#xray-instrumenting-choosing) for more help with choosing between the two.
724

825
If you want additional features when tracing your Python applications, please [open an issue on the OpenTelemetry Python Instrumentation repository](https://github.com/open-telemetry/opentelemetry-python-contrib/issues/new?labels=feature-request&template=feature_request.md&title=X-Ray%20Compatible%20Feature%20Request).
926

10-
### :mega: Python Versions End-of-Support Notice
27+
### Python Versions End-of-Support Notice
1128

1229
AWS X-Ray SDK for Python versions `>2.11.0` has dropped support for Python 2.7, 3.4, 3.5, and 3.6.
1330

14-
# AWS X-Ray SDK for Python
31+
-------------------------------------
1532

1633
![Screenshot of the AWS X-Ray console](/images/example_servicemap.png?raw=true)
1734

aws_xray_sdk/core/patcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'pymongo',
2424
'pymysql',
2525
'psycopg2',
26+
'psycopg',
2627
'pg8000',
2728
'sqlalchemy_core',
2829
'httpx',
@@ -38,6 +39,7 @@
3839
'pymongo',
3940
'pymysql',
4041
'psycopg2',
42+
'psycopg',
4143
'pg8000',
4244
'sqlalchemy_core',
4345
'httpx',
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .patch import patch
2+
3+
4+
__all__ = ['patch']

aws_xray_sdk/ext/psycopg/patch.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import wrapt
2+
from operator import methodcaller
3+
4+
from aws_xray_sdk.ext.dbapi2 import XRayTracedConn
5+
6+
7+
def patch():
8+
wrapt.wrap_function_wrapper(
9+
'psycopg',
10+
'connect',
11+
_xray_traced_connect
12+
)
13+
14+
wrapt.wrap_function_wrapper(
15+
'psycopg_pool.pool',
16+
'ConnectionPool._connect',
17+
_xray_traced_connect
18+
)
19+
20+
21+
def _xray_traced_connect(wrapped, instance, args, kwargs):
22+
conn = wrapped(*args, **kwargs)
23+
parameterized_dsn = {c[0]: c[-1] for c in map(methodcaller('split', '='), conn.info.dsn.split(' '))}
24+
meta = {
25+
'database_type': 'PostgreSQL',
26+
'url': 'postgresql://{}@{}:{}/{}'.format(
27+
parameterized_dsn.get('user', 'unknown'),
28+
parameterized_dsn.get('host', 'unknown'),
29+
parameterized_dsn.get('port', 'unknown'),
30+
parameterized_dsn.get('dbname', 'unknown'),
31+
),
32+
'user': parameterized_dsn.get('user', 'unknown'),
33+
'database_version': str(conn.info.server_version),
34+
'driver_version': 'Psycopg 3'
35+
}
36+
37+
return XRayTracedConn(conn, meta)

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,6 @@
177177

178178

179179
# Example configuration for intersphinx: refer to the Python standard library.
180-
intersphinx_mapping = {'https://docs.python.org/': None}
180+
intersphinx_mapping = {
181+
'python': ('https://docs.python.org/', None),
182+
}

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Currently supported web frameworks and libraries:
2929
* mysql-connector
3030
* pg8000
3131
* psycopg2
32+
* psycopg (psycopg3)
3233
* pymongo
3334
* pymysql
3435
* pynamodb

sample-apps/flask/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Flask==2.3.3
55
idna==3.7
66
requests==2.32.0
77
urllib3==1.26.19
8-
Werkzeug==3.0.3
8+
Werkzeug==3.0.6
99
flask-sqlalchemy==2.5.1
1010
SQLAlchemy==1.4
1111
aws_xray_sdk==2.6.0

tests/ext/psycopg/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)