Skip to content

Commit 554acdb

Browse files
wconti27mabdinur
andauthored
feat: add missing component tag to aiohttp connection patch (#5195)
Adds missing component tag that should be present for aiohttp. ## Checklist - [ ] Change(s) are motivated and described in the PR description. - [ ] Testing strategy is described if automated tests are not included in the PR. - [ ] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [ ] Change is maintainable (easy to change, telemetry, documentation). - [ ] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/contributing.html#Release-Note-Guidelines) are followed. - [ ] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [ ] Author is aware of the performance implications of this PR as reported in the benchmarks PR comment. ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer is aware of, and discussed the performance implications of this PR as reported in the benchmarks PR comment. --------- Co-authored-by: Munir Abdinur <[email protected]>
1 parent 35ab4b7 commit 554acdb

11 files changed

+43
-2
lines changed

ddtrace/contrib/aiohttp/patch.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ def __init__(self, obj, pin):
4848

4949
async def connect(self, req, *args, **kwargs):
5050
pin = Pin.get_from(self)
51-
with pin.tracer.trace("%s.connect" % self.__class__.__name__):
51+
with pin.tracer.trace("%s.connect" % self.__class__.__name__) as span:
52+
# set component tag equal to name of integration
53+
span.set_tag(COMPONENT, config.aiohttp.integration_name)
5254
result = await self.__wrapped__.connect(req, *args, **kwargs)
5355
return result
5456

5557
async def _create_connection(self, req, *args, **kwargs):
5658
pin = Pin.get_from(self)
57-
with pin.tracer.trace("%s._create_connection" % self.__class__.__name__):
59+
with pin.tracer.trace("%s._create_connection" % self.__class__.__name__) as span:
60+
# set component tag equal to name of integration
61+
span.set_tag(COMPONENT, config.aiohttp.integration_name)
5862
result = await self.__wrapped__._create_connection(req, *args, **kwargs)
5963
return result
6064

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
features:
3+
- |
4+
aiohttp: Add missing component meta tag to aiohttp server spans.

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_200_request.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 7026000,
4245
"start": 1646414759575827000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_200_request_post.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 2740000,
4245
"start": 1646794689782860000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_500_request.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 2061000,
4245
"start": 1646414759680240000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_auth_200_request.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 1426000,
4245
"start": 1673646330399204000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_configure_global_service_name_env.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 4452000,
4245
"start": 1646721315459826000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_configure_service_name_pin.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 18051000,
4245
"start": 1646721987369091000
4346
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_trace_multiple.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
"parent_id": 1,
3939
"type": "",
4040
"error": 0,
41+
"meta": {
42+
"component": "aiohttp"
43+
},
4144
"duration": 26278000,
4245
"start": 1646794505598411000
4346
}],
@@ -81,6 +84,9 @@
8184
"parent_id": 1,
8285
"type": "",
8386
"error": 0,
87+
"meta": {
88+
"component": "aiohttp"
89+
},
8490
"duration": 70000,
8591
"start": 1646794505627940000
8692
}],
@@ -124,6 +130,9 @@
124130
"parent_id": 1,
125131
"type": "",
126132
"error": 0,
133+
"meta": {
134+
"component": "aiohttp"
135+
},
127136
"duration": 136000,
128137
"start": 1646794505631851000
129138
}]]

tests/snapshots/tests.contrib.aiohttp.test_aiohttp_client.test_trace_parenting.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
"parent_id": 2,
5353
"type": "",
5454
"error": 0,
55+
"meta": {
56+
"component": "aiohttp"
57+
},
5558
"duration": 2464000,
5659
"start": 1646794413226798000
5760
}]]

0 commit comments

Comments
 (0)