Skip to content

Commit 85ca0a6

Browse files
authored
Change meta data service timeout to 200ms (open-telemetry#2387)
1 parent 805c72c commit 85ca0a6

File tree

2 files changed

+17
-4
lines changed
  • resource/opentelemetry-resource-detector-azure

2 files changed

+17
-4
lines changed
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/vm.py

+2-4
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)