Skip to content

Commit 995e9c4

Browse files
committed
Release 0.0.1.dev0
1 parent 1304fed commit 995e9c4

File tree

8 files changed

+7
-743
lines changed

8 files changed

+7
-743
lines changed

instrumentation-genai/opentelemetry-instrumentation-google-genai/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

instrumentation-genai/opentelemetry-instrumentation-google-genai/README.rst

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,10 @@ OpenTelemetry Google GenAI SDK Instrumentation
66
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-google-genai.svg
77
:target: https://pypi.org/project/opentelemetry-instrumentation-google-genai/
88

9-
This library adds instrumentation to the `Google GenAI SDK library <https://pypi.org/project/google-genai/>`_
10-
to emit telemetry data following `Semantic Conventions for GenAI systems <https://opentelemetry.io/docs/specs/semconv/gen-ai/>`_.
11-
It adds trace spans for GenAI operations, events/logs for recording prompts/responses, and emits metrics that describe the
12-
GenAI operations in aggregate.
9+
This library is a work in progress and is not ready to use. Follow along at
10+
https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3260.
1311

1412

15-
Installation
16-
------------
17-
18-
If your application is already instrumented with OpenTelemetry, add this
19-
package to your requirements.
20-
::
21-
22-
pip install opentelemetry-instrumentation-google-genai
23-
24-
If you don't have a Google GenAI SDK application, yet, try our `examples <examples>`_.
25-
26-
Check out `zero-code example <examples/zero-code>`_ for a quick start.
27-
28-
Usage
29-
-----
30-
31-
This section describes how to set up Google GenAI SDK instrumentation if you're setting OpenTelemetry up manually.
32-
Check out the `manual example <examples/manual>`_ for more details.
33-
34-
Instrumenting all clients
35-
*************************
36-
37-
When using the instrumentor, all clients will automatically trace GenAI `generate_content` operations.
38-
You can also optionally capture prompts and responses as log events.
39-
40-
Make sure to configure OpenTelemetry tracing, logging, metrics, and events to capture all telemetry emitted by the instrumentation.
41-
42-
.. code-block:: python
43-
44-
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
45-
from google.genai import Client
46-
47-
GoogleGenAiSdkInstrumentor().instrument()
48-
49-
50-
client = Client()
51-
response = client.models.generate_content(
52-
model="gemini-1.5-flash-002",
53-
contents="Write a short poem on OpenTelemetry.")
54-
55-
Enabling message content
56-
*************************
57-
58-
Message content such as the contents of the prompt and response
59-
are not captured by default. To capture message content as log events, set the environment variable
60-
`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` to `true`.
61-
62-
Uninstrument
63-
************
64-
65-
To uninstrument clients, call the uninstrument method:
66-
67-
.. code-block:: python
68-
69-
from opentelemetry.instrumentation.google_genai import GoogleGenAiSdkInstrumentor
70-
71-
GoogleGenAiSdkInstrumentor().instrument()
72-
# ...
73-
74-
# Uninstrument all clients
75-
GoogleGenAiSdkInstrumentor().uninstrument()
76-
7713
References
7814
----------
7915
* `Google Gen AI SDK Documentation <https://ai.google.dev/gemini-api/docs/sdks>`_

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
5-
# You may obtain a copy of the License at
6-
#
5+
# You may obtain a copy of the License at #
76
# http://www.apache.org/licenses/LICENSE-2.0
87
#
98
# Unless required by applicable law or agreed to in writing, software
@@ -34,18 +33,16 @@ classifiers = [
3433
"Programming Language :: Python :: 3",
3534
"Programming Language :: Python :: 3.10",
3635
"Programming Language :: Python :: 3.11",
37-
"Programming Language :: Python :: 3.12"
36+
"Programming Language :: Python :: 3.12",
3837
]
3938
dependencies = [
4039
"opentelemetry-api >=1.30.0, <2",
4140
"opentelemetry-instrumentation >=0.51b0, <2",
42-
"opentelemetry-semantic-conventions >=0.51b0, <2"
41+
"opentelemetry-semantic-conventions >=0.51b0, <2",
4342
]
4443

4544
[project.optional-dependencies]
46-
instruments = [
47-
"google-genai >= 1.0.0"
48-
]
45+
instruments = ["google-genai >= 1.0.0"]
4946

5047
[project.entry-points.opentelemetry_instrumentor]
5148
google-genai = "opentelemetry.instrumentation.google_genai:GoogleGenAiSdkInstrumentor"
@@ -58,10 +55,7 @@ Repository = "https://github.com/open-telemetry/opentelemetry-python-contrib"
5855
path = "src/opentelemetry/instrumentation/google_genai/version.py"
5956

6057
[tool.hatch.build.targets.sdist]
61-
include = [
62-
"/src",
63-
"/tests",
64-
]
58+
include = ["/src"]
6559

6660
[tool.hatch.build.targets.wheel]
6761
packages = ["src/opentelemetry"]

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/__init__.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/flags.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)