Skip to content

Commit c89c974

Browse files
authored
Merge branch 'main' into main
2 parents d3f9a16 + fdcbbdd commit c89c974

File tree

6 files changed

+42
-19
lines changed

6 files changed

+42
-19
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
`opentelemetry_resource_detector` entry point
1111
([#2382](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2382))
1212

13+
### Breaking changes
14+
15+
- Rename `type` attribute to `asgi.event.type` in `opentelemetry-instrumentation-asgi`
16+
([#2300](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2300))
17+
1318
## Version 1.24.0/0.45b0 (2024-03-28)
1419

20+
### Added
21+
1522
- `opentelemetry-instrumentation-psycopg` Async Instrumentation for psycopg 3.x
1623
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))
1724

@@ -33,9 +40,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3340
- AwsLambdaInstrumentor sets `cloud.account.id` span attribute
3441
([#2367](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2367))
3542

43+
3644
## Version 1.23.0/0.44b0 (2024-02-23)
3745

38-
- Drop uspport for 3.7
46+
- Drop support for 3.7
3947
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151))
4048
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
4149
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,9 @@ async def otel_receive():
672672
if receive_span.is_recording():
673673
if message["type"] == "websocket.receive":
674674
set_status_code(receive_span, 200)
675-
receive_span.set_attribute("type", message["type"])
675+
receive_span.set_attribute(
676+
"asgi.event.type", message["type"]
677+
)
676678
return message
677679

678680
return otel_receive
@@ -703,7 +705,7 @@ async def otel_send(message: dict[str, Any]):
703705
elif message["type"] == "websocket.send":
704706
set_status_code(server_span, 200)
705707
set_status_code(send_span, 200)
706-
send_span.set_attribute("type", message["type"])
708+
send_span.set_attribute("asgi.event.type", message["type"])
707709
if (
708710
server_span.is_recording()
709711
and server_span.kind == trace.SpanKind.SERVER

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,20 +268,20 @@ def validate_outputs(self, outputs, error=None, modifiers=None):
268268
{
269269
"name": "GET / http receive",
270270
"kind": trace_api.SpanKind.INTERNAL,
271-
"attributes": {"type": "http.request"},
271+
"attributes": {"asgi.event.type": "http.request"},
272272
},
273273
{
274274
"name": "GET / http send",
275275
"kind": trace_api.SpanKind.INTERNAL,
276276
"attributes": {
277277
SpanAttributes.HTTP_STATUS_CODE: 200,
278-
"type": "http.response.start",
278+
"asgi.event.type": "http.response.start",
279279
},
280280
},
281281
{
282282
"name": "GET / http send",
283283
"kind": trace_api.SpanKind.INTERNAL,
284-
"attributes": {"type": "http.response.body"},
284+
"attributes": {"asgi.event.type": "http.response.body"},
285285
},
286286
{
287287
"name": "GET /",
@@ -358,7 +358,7 @@ def add_more_body_spans(expected: list):
358358
more_body_span = {
359359
"name": "GET / http send",
360360
"kind": trace_api.SpanKind.INTERNAL,
361-
"attributes": {"type": "http.response.body"},
361+
"attributes": {"asgi.event.type": "http.response.body"},
362362
}
363363
extra_spans = [more_body_span] * 3
364364
expected[2:2] = extra_spans
@@ -396,12 +396,12 @@ def add_body_and_trailer_span(expected: list):
396396
body_span = {
397397
"name": "GET / http send",
398398
"kind": trace_api.SpanKind.INTERNAL,
399-
"attributes": {"type": "http.response.body"},
399+
"attributes": {"asgi.event.type": "http.response.body"},
400400
}
401401
trailer_span = {
402402
"name": "GET / http send",
403403
"kind": trace_api.SpanKind.INTERNAL,
404-
"attributes": {"type": "http.response.trailers"},
404+
"attributes": {"asgi.event.type": "http.response.trailers"},
405405
}
406406
expected[2:2] = [body_span]
407407
expected[4:4] = [trailer_span] * 2
@@ -582,33 +582,33 @@ def test_websocket(self):
582582
{
583583
"name": "/ websocket receive",
584584
"kind": trace_api.SpanKind.INTERNAL,
585-
"attributes": {"type": "websocket.connect"},
585+
"attributes": {"asgi.event.type": "websocket.connect"},
586586
},
587587
{
588588
"name": "/ websocket send",
589589
"kind": trace_api.SpanKind.INTERNAL,
590-
"attributes": {"type": "websocket.accept"},
590+
"attributes": {"asgi.event.type": "websocket.accept"},
591591
},
592592
{
593593
"name": "/ websocket receive",
594594
"kind": trace_api.SpanKind.INTERNAL,
595595
"attributes": {
596-
"type": "websocket.receive",
596+
"asgi.event.type": "websocket.receive",
597597
SpanAttributes.HTTP_STATUS_CODE: 200,
598598
},
599599
},
600600
{
601601
"name": "/ websocket send",
602602
"kind": trace_api.SpanKind.INTERNAL,
603603
"attributes": {
604-
"type": "websocket.send",
604+
"asgi.event.type": "websocket.send",
605605
SpanAttributes.HTTP_STATUS_CODE: 200,
606606
},
607607
},
608608
{
609609
"name": "/ websocket receive",
610610
"kind": trace_api.SpanKind.INTERNAL,
611-
"attributes": {"type": "websocket.disconnect"},
611+
"attributes": {"asgi.event.type": "websocket.disconnect"},
612612
},
613613
{
614614
"name": "/",
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
- Change meta data service timeout to 200ms
11+
([#2387](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2387))
12+
13+
## Version 0.1.2 (2024-01-25)
14+
15+
- Initial CHANGELOG.md entry

resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
__version__ = "0.1.2"
15+
__version__ = "0.1.4"

resource/opentelemetry-resource-detector-azure/src/opentelemetry/resource/detector/azure/vm.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,8 @@ def _get_azure_vm_metadata():
7171
request = Request(_AZURE_VM_METADATA_ENDPOINT)
7272
request.add_header("Metadata", "True")
7373
try:
74-
# TODO: Changed to 4s to fit into OTel SDK's 5 second timeout.
75-
# Lengthen or allow user input if issue is resolved.
76-
# See https://github.com/open-telemetry/opentelemetry-python/issues/3644
77-
with urlopen(request, timeout=4) as response:
74+
# VM metadata service should not take more than 200ms on success case
75+
with urlopen(request, timeout=0.2) as response:
7876
return loads(response.read())
7977
except URLError:
8078
# Not on Azure VM

0 commit comments

Comments
 (0)