Skip to content

Commit a8e22f5

Browse files
committed
Reduce boilerplate sprawl for genai instrumentations
1 parent ff7f60e commit a8e22f5

File tree

20 files changed

+586
-315
lines changed

20 files changed

+586
-315
lines changed

.github/workflows/misc_0.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,22 @@ jobs:
194194

195195
- name: Run tests
196196
run: tox -e typecheck
197+
198+
check-genai-readme:
199+
name: check-genai-readme
200+
runs-on: ubuntu-latest
201+
timeout-minutes: 30
202+
steps:
203+
- name: Checkout repo @ SHA - ${{ github.sha }}
204+
uses: actions/checkout@v4
205+
206+
- name: Set up Python 3.11
207+
uses: actions/setup-python@v5
208+
with:
209+
python-version: "3.11"
210+
211+
- name: Install tox
212+
run: pip install tox-uv
213+
214+
- name: Run tests
215+
run: tox -e check-genai-readme

.github/workflows/package-release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
inputs:
55
package:
66
type: choice
7+
# NOTE: This list is static. The workflow validates the selection
8+
# against the dynamically generated list of independent packages
9+
# from scripts/discover_genai_packages.py
710
options:
811
- opentelemetry-opamp-client
912
- opentelemetry-propagator-aws-xray
@@ -36,6 +39,22 @@ jobs:
3639
3740
- uses: actions/checkout@v4
3841

42+
- name: Setup Python for discovery
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: '3.9'
46+
47+
- name: Validate package selection
48+
id: validate
49+
run: |
50+
independent_packages=$(python ./scripts/discover_genai_packages.py --independent-json)
51+
if [[ $(echo "$independent_packages" | jq 'index("${{ inputs.package }}")') == "null" ]]; then
52+
echo "Error: ${{ inputs.package }} is not configured for independent release or does not exist."
53+
echo "Check the [tool.opentelemetry.instrumentation] section in its pyproject.toml"
54+
exit 1
55+
fi
56+
echo "Package ${{ inputs.package }} is valid for independent release."
57+
3958
- name: Set environment variables
4059
run: |
4160
version=$(./scripts/eachdist.py version --package ${{ inputs.package }})

RELEASING.md

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@
2222
> - opentelemetry-propagator-aws-xray
2323
> - opentelemetry-resource-detector-azure
2424
> - opentelemetry-sdk-extension-aws
25-
> - opentelemetry-instrumentation-openai-v2
26-
> - opentelemetry-instrumentation-openai-agents-v2
27-
> - opentelemetry-instrumentation-vertexai
28-
> - opentelemetry-instrumentation-anthropic
29-
> - opentelemetry-instrumentation-claude-agent-sdk
30-
> - opentelemetry-instrumentation-google-genai
31-
> - opentelemetry-instrumentation-langchain
32-
> - opentelemetry-instrumentation-weaviate
33-
> - opentelemetry-util-genai
25+
> - All packages under `instrumentation-genai/` configured for independent release (see below).
3426
>
3527
> These libraries are also excluded from the general release.
3628
29+
To configure an `instrumentation-genai/` package for individual release, add the following to its `pyproject.toml`:
30+
31+
```toml
32+
[tool.opentelemetry.instrumentation]
33+
independent_release = true
34+
```
35+
3736
Package release preparation is handled by the [`[Package] Prepare release`](./.github/workflows/package-prepare-release.yml) workflow that allows
3837
to pick a specific package to release. It follows the same versioning strategy and process as the general release.
3938

@@ -87,21 +86,7 @@ The workflow will create a pull request that should be merged in order to procee
8786
### Releasing individual package
8887

8988
> [!NOTE]
90-
> Per-package patch release is supported for the following packages only:
91-
> - opentelemetry-opamp-client
92-
> - opentelemetry-propagator-aws-xray
93-
> - opentelemetry-resource-detector-azure
94-
> - opentelemetry-sdk-extension-aws
95-
> - opentelemetry-instrumentation-openai-v2
96-
> - opentelemetry-instrumentation-openai-agents-v2
97-
> - opentelemetry-instrumentation-vertexai
98-
> - opentelemetry-instrumentation-anthropic
99-
> - opentelemetry-instrumentation-claude-agent-sdk
100-
> - opentelemetry-instrumentation-google-genai
101-
> - opentelemetry-instrumentation-langchain
102-
> - opentelemetry-instrumentation-weaviate
103-
> - opentelemetry-util-genai
104-
> - opentelemetry-exporter-credential-provider-gcp
89+
> Per-package release is supported for the packages listed in the `[Package] Release` workflow, including GenAI packages configured for independent release.
10590
>
10691
> These libraries are also excluded from the general patch release.
10792

instrumentation-genai/README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
# GenAI Instrumentations
12

2-
| Instrumentation | Supported Packages | Metrics support | Semconv status |
3-
| --------------- | ------------------ | --------------- | -------------- |
4-
| [opentelemetry-instrumentation-anthropic](./opentelemetry-instrumentation-anthropic) | anthropic >= 0.16.0 | No | development
5-
| [opentelemetry-instrumentation-claude-agent-sdk](./opentelemetry-instrumentation-claude-agent-sdk) | claude-agent-sdk >= 0.1.14 | No | development
6-
| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | google-genai >= 1.32.0 | No | development
7-
| [opentelemetry-instrumentation-langchain](./opentelemetry-instrumentation-langchain) | langchain >= 0.3.21 | No | development
8-
| [opentelemetry-instrumentation-openai-agents-v2](./opentelemetry-instrumentation-openai-agents-v2) | openai-agents >= 0.3.3 | No | development
9-
| [opentelemetry-instrumentation-openai-v2](./opentelemetry-instrumentation-openai-v2) | openai >= 1.26.0 | Yes | development
10-
| [opentelemetry-instrumentation-vertexai](./opentelemetry-instrumentation-vertexai) | google-cloud-aiplatform >= 1.64 | No | development
11-
| [opentelemetry-instrumentation-weaviate](./opentelemetry-instrumentation-weaviate) | weaviate-client >= 3.0.0,<5.0.0 | No | development
3+
This directory contains OpenTelemetry instrumentations for Generative AI (GenAI) libraries and frameworks.
4+
5+
<!-- BEGIN GENERATED TABLE -->
6+
| Package | Instrumented Library | Semantic Attributes | Status |
7+
|---|---|---|---|
8+
9+
| [opentelemetry-instrumentation-anthropic](./opentelemetry-instrumentation-anthropic) | Anthropic SDK | Yes | Development |
10+
| [opentelemetry-instrumentation-claude-agent-sdk](./opentelemetry-instrumentation-claude-agent-sdk) | Claude Agent SDK | Yes | Development |
11+
| [opentelemetry-instrumentation-google-genai](./opentelemetry-instrumentation-google-genai) | Google GenAI | No | Development |
12+
| [opentelemetry-instrumentation-langchain](./opentelemetry-instrumentation-langchain) | Langchain | Yes | Development |
13+
| [opentelemetry-instrumentation-openai-agents-v2](./opentelemetry-instrumentation-openai-agents-v2) | OpenAI Agents v2 | Yes | Development |
14+
| [opentelemetry-instrumentation-openai-v2](./opentelemetry-instrumentation-openai-v2) | OpenAI v2 | Yes | Stable |
15+
| [opentelemetry-instrumentation-vertexai](./opentelemetry-instrumentation-vertexai) | Vertex AI | Yes | Beta |
16+
| [opentelemetry-instrumentation-weaviate](./opentelemetry-instrumentation-weaviate) | Weaviate | Yes | Development |
17+
<!-- END GENERATED TABLE -->

instrumentation-genai/opentelemetry-instrumentation-anthropic/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ include = [
5757
[tool.hatch.build.targets.wheel]
5858
packages = ["src/opentelemetry"]
5959

60+
[tool.opentelemetry.instrumentation]
61+
independent_release = true
62+
include_in_bootstrap = false
63+
readme_library = "Anthropic SDK"
64+
readme_sia = "Yes"
65+
readme_status = "Development"
66+
6067
[tool.pytest.ini_options]
6168
testpaths = ["tests"]
6269

instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,12 @@ include = [
5555
[tool.hatch.build.targets.wheel]
5656
packages = ["src/opentelemetry"]
5757

58+
[tool.opentelemetry.instrumentation]
59+
independent_release = true
60+
include_in_bootstrap = false
61+
readme_library = "Claude Agent SDK"
62+
readme_sia = "Yes"
63+
readme_status = "Development"
64+
5865
[tool.pytest.ini_options]
5966
testpaths = ["tests"]

instrumentation-genai/opentelemetry-instrumentation-google-genai/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ include = ["/src", "/tests"]
6464
[tool.hatch.build.targets.wheel]
6565
packages = ["src/opentelemetry"]
6666

67+
[tool.opentelemetry.instrumentation]
68+
independent_release = true
69+
include_in_bootstrap = false
70+
readme_library = "Google GenAI"
71+
readme_sia = "No"
72+
readme_status = "Development"
73+
6774
[tool.pyright]
6875
include = ["src"]
6976
exclude = ["**/__pycache__"]

instrumentation-genai/opentelemetry-instrumentation-langchain/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ include = [
5050
"/tests",
5151
]
5252

53+
[tool.opentelemetry.instrumentation]
54+
independent_release = true
55+
include_in_bootstrap = false
56+
readme_library = "Langchain"
57+
readme_sia = "Yes"
58+
readme_status = "Development"
59+
5360
[tool.hatch.build.targets.wheel]
5461
packages = ["src/opentelemetry"]
5562

instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,12 @@ include = [
5252
"/src",
5353
]
5454

55+
[tool.opentelemetry.instrumentation]
56+
independent_release = true
57+
include_in_bootstrap = false
58+
readme_library = "OpenAI Agents v2"
59+
readme_sia = "Yes"
60+
readme_status = "Development"
61+
5562
[tool.hatch.build.targets.wheel]
5663
packages = ["src/opentelemetry"]

instrumentation-genai/opentelemetry-instrumentation-openai-v2/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,12 @@ include = [
5353
"/tests",
5454
]
5555

56+
[tool.opentelemetry.instrumentation]
57+
independent_release = true
58+
include_in_bootstrap = false
59+
readme_library = "OpenAI v2"
60+
readme_sia = "Yes"
61+
readme_status = "Stable"
62+
5663
[tool.hatch.build.targets.wheel]
5764
packages = ["src/opentelemetry"]

0 commit comments

Comments
 (0)