Skip to content

Commit 6b30587

Browse files
authored
Merge branch 'main' into django-asgi
2 parents beaeb17 + 984f5cd commit 6b30587

File tree

46 files changed

+294
-187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+294
-187
lines changed

.flake8

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[flake8]
22
ignore =
33
E501 # line too long, defer to black
4-
F401 # unused import, defer to pylint
54
W503 # allow line breaks before binary ops
65
W504 # allow line breaks after binary ops
76
E203 # allow whitespace before ':' (https://github.com/psf/black#slices)

.github/component_owners.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
components:
2+
3+
sdk-extension/opentelemetry-sdk-extension-aws:
4+
- NathanielRN
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This action assigns and requires approval from owners of components for
2+
# PRs that are open against those components. Components are defined as
3+
# individual paths within this repository.
4+
name: 'Component Owners'
5+
6+
on:
7+
pull_request_target:
8+
9+
jobs:
10+
run_self:
11+
runs-on: ubuntu-latest
12+
name: Auto Assign Owners
13+
steps:
14+
- uses: dyladan/component-owners@main

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: 3e1c89bcae77c34b9750a1f00608a04a97921c51
9+
CORE_REPO_SHA: c49ad57bfe35cfc69bfa863d74058ca9bec55fc3
1010

1111
jobs:
1212
build:

exporter/opentelemetry-exporter-datadog/tests/test_datadog_exporter.py

+5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414

1515
import itertools
1616
import logging
17+
import sys
1718
import time
1819
import unittest
1920
from unittest import mock
2021

2122
from ddtrace.internal.writer import AgentWriter
2223
from flaky import flaky
24+
from pytest import mark
2325

2426
from opentelemetry import trace as trace_api
2527
from opentelemetry.context import Context
@@ -469,6 +471,9 @@ def test_span_processor_dropped_spans(self):
469471
self.assertEqual(len(datadog_spans), 128)
470472
tracer_provider.shutdown()
471473

474+
@mark.skipif(
475+
sys.platform == "win32", reason="unreliable test on windows",
476+
)
472477
def test_span_processor_scheduled_delay(self):
473478
"""Test that spans are exported each schedule_delay_millis"""
474479
delay = 300

instrumentation/README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
| Instrumentation | Supported Packages |
3+
| --------------- | ------------------ |
4+
| [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 |
5+
| [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 1.3.0 |
6+
| [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 |
7+
| [opentelemetry-instrumentation-asyncpg](./opentelemetry-instrumentation-asyncpg) | asyncpg >= 0.12.0 |
8+
| [opentelemetry-instrumentation-boto](./opentelemetry-instrumentation-boto) | boto~=2.0 |
9+
| [opentelemetry-instrumentation-botocore](./opentelemetry-instrumentation-botocore) | botocore ~= 1.0 |
10+
| [opentelemetry-instrumentation-celery](./opentelemetry-instrumentation-celery) | celery >= 4.0, < 6.0 |
11+
| [opentelemetry-instrumentation-dbapi](./opentelemetry-instrumentation-dbapi) | dbapi |
12+
| [opentelemetry-instrumentation-django](./opentelemetry-instrumentation-django) | django >= 1.10 |
13+
| [opentelemetry-instrumentation-elasticsearch](./opentelemetry-instrumentation-elasticsearch) | elasticsearch >= 2.0 |
14+
| [opentelemetry-instrumentation-falcon](./opentelemetry-instrumentation-falcon) | falcon ~= 2.0 |
15+
| [opentelemetry-instrumentation-fastapi](./opentelemetry-instrumentation-fastapi) | fastapi ~= 0.58 |
16+
| [opentelemetry-instrumentation-flask](./opentelemetry-instrumentation-flask) | flask >= 1.0, < 3.0 |
17+
| [opentelemetry-instrumentation-grpc](./opentelemetry-instrumentation-grpc) | grpcio ~= 1.27 |
18+
| [opentelemetry-instrumentation-httpx](./opentelemetry-instrumentation-httpx) | httpx >= 0.18.0, < 0.19.0 |
19+
| [opentelemetry-instrumentation-jinja2](./opentelemetry-instrumentation-jinja2) | jinja2~=2.7 |
20+
| [opentelemetry-instrumentation-logging](./opentelemetry-instrumentation-logging) | logging |
21+
| [opentelemetry-instrumentation-mysql](./opentelemetry-instrumentation-mysql) | mysql-connector-python ~= 8.0 |
22+
| [opentelemetry-instrumentation-psycopg2](./opentelemetry-instrumentation-psycopg2) | psycopg2 >= 2.7.3.1 |
23+
| [opentelemetry-instrumentation-pymemcache](./opentelemetry-instrumentation-pymemcache) | pymemcache ~= 1.3 |
24+
| [opentelemetry-instrumentation-pymongo](./opentelemetry-instrumentation-pymongo) | pymongo ~= 3.1 |
25+
| [opentelemetry-instrumentation-pymysql](./opentelemetry-instrumentation-pymysql) | PyMySQL ~= 0.10.1 |
26+
| [opentelemetry-instrumentation-pyramid](./opentelemetry-instrumentation-pyramid) | pyramid >= 1.7 |
27+
| [opentelemetry-instrumentation-redis](./opentelemetry-instrumentation-redis) | redis >= 2.6 |
28+
| [opentelemetry-instrumentation-requests](./opentelemetry-instrumentation-requests) | requests ~= 2.0 |
29+
| [opentelemetry-instrumentation-sklearn](./opentelemetry-instrumentation-sklearn) | scikit-learn ~= 0.24.0 |
30+
| [opentelemetry-instrumentation-sqlalchemy](./opentelemetry-instrumentation-sqlalchemy) | sqlalchemy |
31+
| [opentelemetry-instrumentation-sqlite3](./opentelemetry-instrumentation-sqlite3) | sqlite3 |
32+
| [opentelemetry-instrumentation-starlette](./opentelemetry-instrumentation-starlette) | starlette ~= 0.13.0 |
33+
| [opentelemetry-instrumentation-tornado](./opentelemetry-instrumentation-tornado) | tornado >= 6.0 |
34+
| [opentelemetry-instrumentation-urllib](./opentelemetry-instrumentation-urllib) | urllib |
35+
| [opentelemetry-instrumentation-urllib3](./opentelemetry-instrumentation-urllib3) | urllib3 >= 1.0.0, < 2.0.0 |
36+
| [opentelemetry-instrumentation-wsgi](./opentelemetry-instrumentation-wsgi) | wsgi |

instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_instrumentor_connect(self):
6868
span = spans_list[0]
6969

7070
# Check version and name in span's instrumentation info
71-
self.check_span_instrumentation_info(
71+
self.assertEqualSpanInstrumentationInfo(
7272
span, opentelemetry.instrumentation.aiopg
7373
)
7474

@@ -97,7 +97,7 @@ async def _ctx_manager_connect():
9797
span = spans_list[0]
9898

9999
# Check version and name in span's instrumentation info
100-
self.check_span_instrumentation_info(
100+
self.assertEqualSpanInstrumentationInfo(
101101
span, opentelemetry.instrumentation.aiopg
102102
)
103103

@@ -118,7 +118,7 @@ def test_instrumentor_create_pool(self):
118118
span = spans_list[0]
119119

120120
# Check version and name in span's instrumentation info
121-
self.check_span_instrumentation_info(
121+
self.assertEqualSpanInstrumentationInfo(
122122
span, opentelemetry.instrumentation.aiopg
123123
)
124124

@@ -149,7 +149,7 @@ async def _ctx_manager_pool():
149149
span = spans_list[0]
150150

151151
# Check version and name in span's instrumentation info
152-
self.check_span_instrumentation_info(
152+
self.assertEqualSpanInstrumentationInfo(
153153
span, opentelemetry.instrumentation.aiopg
154154
)
155155

instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838

3939
import asyncpg
4040
import wrapt
41-
from asyncpg import exceptions
4241

4342
from opentelemetry import trace
4443
from opentelemetry.instrumentation.asyncpg.package import _instruments

instrumentation/opentelemetry-instrumentation-boto/src/opentelemetry/instrumentation/boto/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
from opentelemetry.instrumentation.boto.version import __version__
5353
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
5454
from opentelemetry.instrumentation.utils import unwrap
55-
from opentelemetry.sdk.trace import Resource
5655
from opentelemetry.semconv.trace import SpanAttributes
5756
from opentelemetry.trace import SpanKind, get_tracer
5857

instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py

+31-21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
import io
1515
import json
16+
import sys
1617
import zipfile
1718
from unittest.mock import Mock, patch
1819

@@ -30,6 +31,7 @@
3031
mock_sts,
3132
mock_xray,
3233
)
34+
from pytest import mark
3335

3436
from opentelemetry import trace as trace_api
3537
from opentelemetry.context import attach, detach, set_value
@@ -128,12 +130,13 @@ def test_s3_client(self):
128130
s3.list_buckets()
129131
s3.list_buckets()
130132

131-
spans = self.memory_exporter.get_finished_spans()
133+
spans = self.get_finished_spans()
132134
assert spans
133-
span = spans[0]
134135
self.assertEqual(len(spans), 2)
135-
self.assertEqual(
136-
span.attributes,
136+
137+
buckets_span = spans.by_attr("aws.operation", "ListBuckets")
138+
self.assertSpanHasAttributes(
139+
buckets_span,
137140
{
138141
"aws.operation": "ListBuckets",
139142
"aws.region": "us-west-2",
@@ -144,22 +147,21 @@ def test_s3_client(self):
144147
)
145148

146149
# testing for span error
147-
self.memory_exporter.get_finished_spans()
148150
with self.assertRaises(ParamValidationError):
149151
s3.list_objects(bucket="mybucket")
150-
spans = self.memory_exporter.get_finished_spans()
152+
spans = self.get_finished_spans()
151153
assert spans
152-
span = spans[2]
153-
self.assertEqual(
154-
span.attributes,
154+
objects_span = spans.by_attr("aws.operation", "ListObjects")
155+
self.assertSpanHasAttributes(
156+
objects_span,
155157
{
156158
"aws.operation": "ListObjects",
157159
"aws.region": "us-west-2",
158160
"aws.service": "s3",
159161
},
160162
)
161163
self.assertIs(
162-
span.status.status_code, trace_api.StatusCode.ERROR,
164+
objects_span.status.status_code, trace_api.StatusCode.ERROR,
163165
)
164166

165167
# Comment test for issue 1088
@@ -172,12 +174,13 @@ def test_s3_put(self):
172174
s3.put_object(**params)
173175
s3.get_object(Bucket="mybucket", Key="foo")
174176

175-
spans = self.memory_exporter.get_finished_spans()
177+
spans = self.get_finished_spans()
176178
assert spans
177179
self.assertEqual(len(spans), 3)
178-
create_bucket_attributes = spans[0].attributes
179-
self.assertEqual(
180-
create_bucket_attributes,
180+
181+
create_span = spans.by_attr("aws.operation", "CreateBucket")
182+
self.assertSpanHasAttributes(
183+
create_span,
181184
{
182185
"aws.operation": "CreateBucket",
183186
"aws.region": "us-west-2",
@@ -186,9 +189,10 @@ def test_s3_put(self):
186189
SpanAttributes.HTTP_STATUS_CODE: 200,
187190
},
188191
)
189-
put_object_attributes = spans[1].attributes
190-
self.assertEqual(
191-
put_object_attributes,
192+
193+
put_span = spans.by_attr("aws.operation", "PutObject")
194+
self.assertSpanHasAttributes(
195+
put_span,
192196
{
193197
"aws.operation": "PutObject",
194198
"aws.region": "us-west-2",
@@ -197,10 +201,12 @@ def test_s3_put(self):
197201
SpanAttributes.HTTP_STATUS_CODE: 200,
198202
},
199203
)
200-
self.assertTrue("params.Body" not in spans[1].attributes.keys())
201-
get_object_attributes = spans[2].attributes
202-
self.assertEqual(
203-
get_object_attributes,
204+
self.assertTrue("params.Body" not in put_span.attributes.keys())
205+
206+
get_span = spans.by_attr("aws.operation", "GetObject")
207+
208+
self.assertSpanHasAttributes(
209+
get_span,
204210
{
205211
"aws.operation": "GetObject",
206212
"aws.region": "us-west-2",
@@ -359,6 +365,10 @@ def get_role_name(self):
359365
Path="/my-path/",
360366
)["Role"]["Arn"]
361367

368+
@mark.skipif(
369+
sys.platform == "win32",
370+
reason="requires docker and Github CI Windows does not have docker installed by default",
371+
)
362372
@mock_lambda
363373
def test_lambda_invoke_propagation(self):
364374

instrumentation/opentelemetry-instrumentation-celery/tests/test_tasks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_task(self):
5050

5151
self.assertEqual(consumer.name, "run/tests.celery_test_tasks.task_add")
5252
self.assertEqual(consumer.kind, SpanKind.CONSUMER)
53-
self.assert_span_has_attributes(
53+
self.assertSpanHasAttributes(
5454
consumer,
5555
{
5656
"celery.action": "run",
@@ -64,7 +64,7 @@ def test_task(self):
6464
producer.name, "apply_async/tests.celery_test_tasks.task_add"
6565
)
6666
self.assertEqual(producer.kind, SpanKind.PRODUCER)
67-
self.assert_span_has_attributes(
67+
self.assertSpanHasAttributes(
6868
producer,
6969
{
7070
"celery.action": "apply_async",

instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
from opentelemetry.instrumentation.utils import unwrap
4949
from opentelemetry.semconv.trace import SpanAttributes
5050
from opentelemetry.trace import SpanKind, TracerProvider, get_tracer
51-
from opentelemetry.trace.status import Status, StatusCode
5251

5352
logger = logging.getLogger(__name__)
5453

instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/middleware.py

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from django.http import HttpRequest, HttpResponse
2222

2323
from opentelemetry.context import attach, detach
24-
from opentelemetry.instrumentation.django.version import __version__
2524
from opentelemetry.instrumentation.propagators import (
2625
get_global_response_propagator,
2726
)

instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
from opentelemetry.instrumentation.utils import unwrap
6161
from opentelemetry.semconv.trace import SpanAttributes
6262
from opentelemetry.trace import SpanKind, get_tracer
63-
from opentelemetry.trace.status import Status, StatusCode
6463

6564
logger = getLogger(__name__)
6665

0 commit comments

Comments
 (0)