Skip to content

Commit

Permalink
Merge pull request #59 from iqm-finland/comp-338-opentelemetry-support
Browse files Browse the repository at this point in the history
OpenTelemetry support
  • Loading branch information
kukushechkin authored Nov 25, 2022
2 parents 4137583 + 5fc54db commit a5943f4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

[mypy-mockito.*]
ignore_missing_imports = True

[mypy-opentelemetry.*]
ignore_missing_imports = True
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

Version 9.3
===========

* Support OpenTelemetry trace propagation. `#59 <https://github.com/iqm-finland/iqm-client/pull/59>`_

Version 9.2
===========

Expand Down
11 changes: 11 additions & 0 deletions src/iqm_client/iqm_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,17 @@ def submit_circuits(
if bearer_token:
headers['Authorization'] = bearer_token

try:
# check if someone is trying to profile us with OpenTelemetry
# pylint: disable=import-outside-toplevel
# pylint: disable=import-error
from opentelemetry import propagate

propagate.inject(headers)
except ImportError as _:
# no OpenTelemetry, no problem
pass

result = requests.post(
join(self._base_url, 'jobs'), json=data.dict(exclude_none=True), headers=headers, timeout=REQUESTS_TIMEOUT
)
Expand Down

0 comments on commit a5943f4

Please sign in to comment.