Skip to content

Commit e723ee5

Browse files
keith-deckerwrisaxrmxlukeina2ztammy-baylis-swi
authored
Sync e2e with Main + Rnference PR (#16)
* cherry pick changes from previous PR * move span utils to new file * remove span state, use otel context for parent/child * flatten LLMInvocation to use attributes instead of dict keys * helper function and docstrings * refactor: store span and context token in LLMInvocation instead of SpanGenerator * refactor: rename prompts/chat_generations to input_messages/output_messages for clarity * refactor: simplify TelemetryHandler API by moving invocation data management to LLMInvocation class * refactor: update relative imports to absolute imports * Update handler to use a context manager instead of start_llm and stop_llm * resolve tox -e doc failure * safeguard against empty request-model * fix tox typecheck errors for utils * refactor: move tracer to generator, clean up dead code * remove unused linting hint * back off stricter request-model requirements * reintroduce manual start/stop for langchain callback flow * Fix typecheck in langchain instrumentation (open-telemetry#3773) * fix typecheck * fix ruff and added changelog * added lambda list * Update instrumentation-genai/opentelemetry-instrumentation-langchain/CHANGELOG.md --------- Co-authored-by: Riccardo Magliocchetti <[email protected]> * botocore: Add support for AWS Secrets Manager semantic convention attribute (open-telemetry#3765) * botocore: Add support for AWS Secrets Manager semantic convention attribute AWS Secrets Manager defines semantic convention attribute: AWS_SECRETSMANAGER_SECRET_ARN: Final = "aws.secretsmanager.secret.arn" https://github.com/open-telemetry/semantic-conventions/blob/main/docs/registry/attributes/aws.md#amazon-secrets-manager-attributes Currently, this attribute is not set in the botocore instrumentation library. This PR adds support for them by extracting values from both Request and Response objects. Tests Added new unit tests (passing). Verified with: tox -e py312-test-instrumentation-botocore tox -e spellcheck tox -e lint-instrumentation-botocore tox -e ruff Backward Compatibility This change is backward compatible. It only adds instrumentation for additional AWS resources and does not modify existing behavior in the auto-instrumentation library. * add ChangeLog. * Update instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/secretsmanager.py Co-authored-by: Tammy Baylis <[email protected]> * Update instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_secretsmanager.py --------- Co-authored-by: Tammy Baylis <[email protected]> Co-authored-by: Emídio Neto <[email protected]> Co-authored-by: Riccardo Magliocchetti <[email protected]> * clean up context handler, clarify unit tests * Rename UploadHook -> CompletionHook (open-telemetry#3780) * Add opentelemetry-util-genai to the package release workflow (open-telemetry#3781) * Fix package release workflows version.py finding (open-telemetry#3782) Looking at the files in this repo, the version file is always called version.py (and it should be). Tested the find command locally. ```shell $ for f in $(git ls-files '*version*.py'); do basename $f; done | sort -u test_version.py version.py $ find util/opentelemetry-util-genai/ -type f -path "**/version.py" util/opentelemetry-util-genai/src/opentelemetry/util/genai/version.py ``` * Adjust opentelemetry-instrumentation-vertexai dependency on opentelemetry-genai-util (open-telemetry#3785) This fixes the CI failure on the release PRs for opentelemetry-util-genai - open-telemetry#3784 (needs cherry pick) - open-telemetry#3783 * Fix exception handling for JSON decoding (open-telemetry#3787) * Add rstcheck in pre-commit (open-telemetry#3777) * Fix a bunch of rstcheck warnings * Add rstcheck to pre-commit * Ignore automodule * Update changelog and contributing * tox -e ruff -> tox -e precommit But keep the old name for compat * remove generator concept * update token types * Update opentelemetry-util-genai version to v0.2b0 (open-telemetry#3783) Co-authored-by: otelbot <[email protected]> Co-authored-by: Aaron Abbott <[email protected]> --------- Co-authored-by: wrisa <[email protected]> Co-authored-by: Riccardo Magliocchetti <[email protected]> Co-authored-by: Luke (GuangHui) Zhang <[email protected]> Co-authored-by: Tammy Baylis <[email protected]> Co-authored-by: Emídio Neto <[email protected]> Co-authored-by: Aaron Abbott <[email protected]> Co-authored-by: Charlie Jonas <[email protected]> Co-authored-by: otelbot[bot] <197425009+otelbot[bot]@users.noreply.github.com> Co-authored-by: otelbot <[email protected]>
1 parent 93ecfc1 commit e723ee5

File tree

32 files changed

+236
-206
lines changed

32 files changed

+236
-206
lines changed

.github/workflows/misc_0.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ jobs:
157157
- name: Run tests
158158
run: tox -e shellcheck
159159

160-
ruff:
161-
name: ruff
160+
precommit:
161+
name: precommit
162162
runs-on: ubuntu-latest
163163
timeout-minutes: 30
164164
steps:
@@ -174,7 +174,7 @@ jobs:
174174
run: pip install tox-uv
175175

176176
- name: Run tests
177-
run: tox -e ruff
177+
run: tox -e precommit
178178

179179
typecheck:
180180
name: typecheck

.github/workflows/package-prepare-patch-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- opentelemetry-instrumentation-openai-v2
1212
- opentelemetry-instrumentation-vertexai
1313
- opentelemetry-instrumentation-google-genai
14+
- opentelemetry-util-genai
1415
description: 'Package to be released'
1516
required: true
1617
permissions:
@@ -48,7 +49,7 @@ jobs:
4849
4950
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})
5051
51-
version_file=$(find $path -type f -path "*version*.py")
52+
version_file=$(find $path -type f -path "**/version.py")
5253
file_count=$(echo "$version_file" | wc -l)
5354
5455
if [ "$file_count" -ne 1 ]; then

.github/workflows/package-prepare-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- opentelemetry-instrumentation-openai-v2
1212
- opentelemetry-instrumentation-vertexai
1313
- opentelemetry-instrumentation-google-genai
14+
- opentelemetry-util-genai
1415
description: 'Package to be released'
1516
required: true
1617

@@ -60,7 +61,7 @@ jobs:
6061
6162
version=${version_dev%.dev}
6263
63-
version_file=$(find $path -type f -path "*version*.py")
64+
version_file=$(find $path -type f -path "**/version.py")
6465
file_count=$(echo "$version_file" | wc -l)
6566
6667
if [ "$file_count" -ne 1 ]; then

.github/workflows/package-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- opentelemetry-instrumentation-openai-v2
1212
- opentelemetry-instrumentation-vertexai
1313
- opentelemetry-instrumentation-google-genai
14+
- opentelemetry-util-genai
1415
description: 'Package to be released'
1516
required: true
1617
permissions:

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ repos:
1313
rev: 0.6.0
1414
hooks:
1515
- id: uv-lock
16+
- repo: https://github.com/rstcheck/rstcheck
17+
rev: 77490ffa33bfc0928975ae3cf904219903db755d # frozen: v6.2.5
18+
hooks:
19+
- id: rstcheck
20+
additional_dependencies: ['rstcheck[sphinx]']
21+
args: ["--report-level", "warning"]

.rstcheck.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[rstcheck]
2+
ignore_directives = automodule

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
### Added
1717
- `opentelemetry-instrumentation`: botocore: Add support for AWS Secrets Manager semantic convention attribute
1818
([#3765](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3765))
19+
- Add `rstcheck` to pre-commit to stop introducing invalid RST
20+
([#3777](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3777))
21+
1922

2023
## Version 1.37.0/0.58b0 (2025-09-11)
2124

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ You can run `tox` with the following arguments:
8484
* `tox -e lint-some-package` to run lint checks on `some-package`
8585
* `tox -e generate-workflows` to run creation of new CI workflows if tox environments have been updated
8686
* `tox -e ruff` to run ruff linter and formatter checks against the entire codebase
87+
* `tox -e precommit` to run all `pre-commit` actions
8788

88-
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
89+
`ruff check` and `ruff format` are executed when `tox -e ruff` is run. We strongly recommend you to configure [pre-commit](https://pre-commit.com/) locally to run `ruff` and `rstcheck` automatically before each commit by installing it as git hooks. You just need to [install pre-commit](https://pre-commit.com/#install) in your environment:
8990

9091
```console
9192
pip install pre-commit -c dev-requirements.txt

_template/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OpenTelemetry <REPLACE ME> Instrumentation
2-
===========================
2+
==========================================
33

44
|pypi|
55

@@ -20,5 +20,5 @@ Installation
2020
References
2121
----------
2222

23-
* `OpenTelemetry <REPLACE ME>/ Tracing <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/<REPLACE ME>/<REPLACE ME>.html>`_
23+
* `OpenTelemetry REPLACE ME/ Tracing <https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/REPLACE ME/REPLACE ME.html>`_
2424
* `OpenTelemetry Project <https://opentelemetry.io/>`_

docs/instrumentation-genai/util.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OpenTelemetry Python - GenAI Util
2121
:undoc-members:
2222
:show-inheritance:
2323

24-
.. automodule:: opentelemetry.util.genai.upload_hook
24+
.. automodule:: opentelemetry.util.genai.completion_hook
2525
:members:
2626
:undoc-members:
2727
:show-inheritance:

0 commit comments

Comments
 (0)