* Allow reraising the root exception if instrumentation fails
I would rather completely fail startup in my services if instrumentation fails for whatever reason instead of just logging an exception and continuing.
Use case:
from opentelemetry import autoinstrumentation
autoinstrumentation.initialize(swallow_exceptions=False)
* Fix lint
* Type hinting, re-raise original exception
* One more type hint to indicate None return
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* opentelemetry-instrumentation-botocore: fix handling of tool input chunked json in converse_stream
We need to accumulate all the tool input as string before decoding it
otherwise we may end up with invalid json.
* Add changelog
* Remove leftover print
* No need for too-many-statements disable
Amazon Bedrock tool use extraction logic doesn't agree with som of the use cases (conversation construction), such as the case with pre-created assistant message:
'messages': [{"role": "user", "content": "Placeholder text."}, {"role": "assistant", "content": "{"}],
This PR addresses this by adding a dict type check on the message content before attempting to get the value of `tool_use`from the content.
* refactor: migrate http_attributes from SpanAttributes to new semantic conventions and refactor tests
* fix precommit linting
* refactor aws lambda to use new semantics
* refactor tests
* update resourceattributes to cloud attrs
* update main for attrs
* ISSUE-3317: Remove maximum version constraint on starlette, by fixing unit tests. Fixed some warnings in unit tests.
* Updae changelog
* Implement code review remarks: update starlette dependencies in bootstrap/test-requirements. Use setUp/tearDown iso decorator on test class
* Increase minimal version of starlette to 0.37.2 to have functional 'oldest' tests.
* add uv.lock
* Revert "add uv.lock"
This reverts commit 08df2bee1e.
* Prevent massive changes of uv.lock due to newer uv which adds upload-time keyword
* Update test-requirements.in file of starlette instrumentation
* fixes
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* fix tests
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* increase delta
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* using same delta as fastapi
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* commit uv.lock back
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
* Update CHANGELOG.md
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Update CHANGELOG.md
---------
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: emdneto <9735060+emdneto@users.noreply.github.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* opentelemetry-instrumentation-system-metrics: fix running on Google Cloud Run
psutil fails reading context switches fails on Google Cloud Run, so
before setting up the observable counter trying to read the values check
we are actually being able to do so.
* Please pylint
* Ensure spans end on early stream closure for Bedrock Streaming APIs
* Add changelog
* End span only if it's still recording in stream done callbacks. Assert that span status is unset.
* Extract response output and stream content into helper functions
* Update changelog after 1.33.0 release
* Keep track of bedrock stream ending and close spans accordingly
* Move stream output checks to a single method
* Update CHANGELOG.md
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* fix(grpc): Support non-list interceptors
The GRPC integration assumes that if interceptors are provided, they will be
a list, when GRPC itself types them as Sequence. With this change, we're
making the codepaths using interceptors more robust by explicitly turning them
into lists before manipulating them.
* Add a changelog entry
* .
* Run ruff
* Simplify
* Begin work to instrument tool calls.
* Add tests as well as the ability to record function details in span attributes.
* Add tests for the tool call wrapper utility.
* Update the changelog.
* Reformat with ruff.
* Switch to dictionary comprehension per lint output.
* Address generic names foo, bar flagged by lint.
* Reformat with ruff.
* Update to record function details only on the span.
* Reformat with ruff.
* Fix lint issue with refactoring improvement.
* Reformat with ruff.
* Improve attribute handling and align with 'execute_tool' span spec.
* Pass through the extra span arguments.
* Fix lint issues.
* Reformat with ruff.
* Update instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/tool_call_wrapper.py
---------
Co-authored-by: Aaron Abbott <aaronabbott@google.com>
* ref: migrate from SpanAttributes
* B
reverted to SpanAttributes for the SCHEMA_URL
* replace SpanAttributes.SCHEMA_URL
* sort imports
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* refactor(fastapi): migrate HTTP_ROUTE from SpanAttributes to new semantic conventions
Replaced usage of `SpanAttributes.HTTP_ROUTE` with `opentelemetry.semconv.attributes.http_attributes.HTTP_ROUTE`
as part of the migration away from `SpanAttributes`.
Refs: #3475
* refactor(fastapi): refactor tests
* refactor(fastapi): remove duplicated import
* sort imports
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
* Update botocore instrumentation to use semantic convention attribute for cloud region
* Update changelog
* Move cloud region attribute to the breaking changes in the changelog
---------
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>