Skip to content

Commit b39fd0c

Browse files
Merge branch 'main' into mysqlconnector-sqlcomment-v4
2 parents cc8ef8e + d2a51b9 commit b39fd0c

File tree

37 files changed

+345
-112
lines changed

37 files changed

+345
-112
lines changed

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ build:
1212

1313
python:
1414
install:
15-
- requirements: docs-requirements.txt
15+
- requirements: rtd-requirements.txt

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Added
1515

16+
- `opentelemetry-instrumentation-starlette` Add type hints to the instrumentation
17+
([#3045](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3045))
1618
- `opentelemetry-distro` default to OTLP log exporter.
1719
([#3042](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3042))
1820
- `opentelemetry-instrumentation-sqlalchemy` Update unit tests to run with SQLALchemy 2
@@ -46,6 +48,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4648
([#3022](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3022))
4749
- Replace all instrumentor unit test `assertEqualSpanInstrumentationInfo` calls with `assertEqualSpanInstrumentationScope` calls
4850
([#3037](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3037))
51+
- `opentelemetry-instrumentation-sqlalchemy` Fixes engines from `sqlalchemy.engine_from_config` not being fully instrumented
52+
([#2816](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2816))
53+
- `opentelemetry-instrumentation-sqlalchemy`: Fix a remaining memory leak in EngineTracer
54+
([#3053](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3053))
55+
- `opentelemetry-instrumentation-sqlite3`: Update documentation on explicit cursor support of tracing
56+
([#3088](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3088))
4957

5058
### Breaking changes
5159

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ Below is a checklist of things to be mindful of when implementing a new instrume
272272
- Isolate sync and async test
273273
- For synchronous tests, the typical test case class is inherited from `opentelemetry.test.test_base.TestBase`. However, if you want to write asynchronous tests, the test case class should inherit also from `IsolatedAsyncioTestCase`. Adding asynchronous tests to a common test class can lead to tests passing without actually running, which can be misleading.
274274
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/60fb936b7e5371b3e5587074906c49fb873cbd76/instrumentation/opentelemetry-instrumentation-grpc/tests/test_aio_server_interceptor.py#L84>
275-
- All instrumentations have the same version. If you are going to develop a new instrumentation it would probably have `X.Y.dev` version and depends on `opentelemetry-instrumentation` and `opentelemetry-semantic-conventions` for the same version. That means that if you want to install your instrumentation you need to install its dependencies from this repo and the core repo also from git.
275+
- Most of the instrumentations have the same version. If you are going to develop a new instrumentation it would probably have `X.Y.dev` version and depends on `opentelemetry-instrumentation` and `opentelemetry-semantic-conventions` for a [compatible version](https://peps.python.org/pep-0440/#compatible-release). That means that you may need to install the instrumentation dependencies from this repo and the core repo from git.
276+
- Documentation
277+
- When adding a new instrumentation remember to add an entry in `docs/instrumentation/` named `<instrumentation>/<instrumentation>.rst` to have the instrumentation documentation referenced from the index. You can use the entry template available [here](./_template/autodoc_entry.rst)
278+
- Testing
279+
- When adding a new instrumentation remember to update `tox.ini` adding appropriate rules in `envlist`, `command_pre` and `commands` sections
276280

277281
## Guideline for GenAI instrumentations
278282

_template/autodoc_entry.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. include:: ../../../instrumentation/opentelemetry-instrumentation-<REPLACE ME>/README.rst
2+
:end-before: References
3+
4+
.. automodule:: opentelemetry.instrumentation.<REPLACE ME>
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs-requirements.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ sphinx==7.1.2
22
sphinx-rtd-theme==2.0.0rc4
33
sphinx-autodoc-typehints==1.25.2
44

5-
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
6-
# doesn't work for pkg_resources.
7-
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-api&subdirectory=opentelemetry-api"
8-
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions"
9-
-e "git+https://github.com/open-telemetry/opentelemetry-python.git#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk"
10-
-e "git+https://github.com/open-telemetry/opentelemetry-python-contrib.git#egg=opentelemetry-util-http&subdirectory=util/opentelemetry-util-http"
11-
./opentelemetry-instrumentation
12-
135
# Required by opentelemetry-instrumentation
146
fastapi>=0.65.2
157
pymemcache~=1.3
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. include:: ../../../instrumentation/opentelemetry-instrumentation-aiohttp-server/README.rst
2+
:end-before: References
3+
4+
.. automodule:: opentelemetry.instrumentation.aiohttp_server
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. include:: ../../../instrumentation/opentelemetry-instrumentation-click/README.rst
2+
:end-before: References
3+
4+
.. automodule:: opentelemetry.instrumentation.click
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:

docs/nitpick-exceptions.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ py-class=
2929
httpx.SyncByteStream
3030
httpx.AsyncByteStream
3131
httpx.Response
32+
aiohttp.web_request.Request
3233
yarl.URL
3334
cimpl.Producer
3435
cimpl.Consumer
@@ -65,7 +66,7 @@ any=
6566

6667
py-obj=
6768
opentelemetry.propagators.textmap.CarrierT
68-
69+
6970
py-func=
7071
poll
7172
flush

instrumentation-genai/opentelemetry-instrumentation-openai-v2/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Coerce openai response_format to semconv format
11+
([#3073](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3073))
1012
- Add example to `opentelemetry-instrumentation-openai-v2`
1113
([#3006](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3006))
1214
- Support for `AsyncOpenAI/AsyncCompletions` ([#2984](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2984))

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/utils.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from os import environ
16-
from typing import Optional, Union
16+
from typing import Mapping, Optional, Union
1717
from urllib.parse import urlparse
1818

1919
from httpx import URL
@@ -202,12 +202,23 @@ def get_llm_request_attributes(
202202
GenAIAttributes.GEN_AI_REQUEST_FREQUENCY_PENALTY: kwargs.get(
203203
"frequency_penalty"
204204
),
205-
GenAIAttributes.GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT: kwargs.get(
206-
"response_format"
207-
),
208205
GenAIAttributes.GEN_AI_OPENAI_REQUEST_SEED: kwargs.get("seed"),
209206
}
210207

208+
if (response_format := kwargs.get("response_format")) is not None:
209+
# response_format may be string or object with a string in the `type` key
210+
if isinstance(response_format, Mapping):
211+
if (
212+
response_format_type := response_format.get("type")
213+
) is not None:
214+
attributes[
215+
GenAIAttributes.GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT
216+
] = response_format_type
217+
else:
218+
attributes[
219+
GenAIAttributes.GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT
220+
] = response_format
221+
211222
set_server_address_and_port(client_instance, attributes)
212223
service_tier = kwargs.get("service_tier")
213224
attributes[GenAIAttributes.GEN_AI_OPENAI_RESPONSE_SERVICE_TIER] = (

0 commit comments

Comments
 (0)