Skip to content

Commit 3b383cd

Browse files
Merge branch 'main' into db-statement-with-sqlcomment
2 parents 6c14f72 + 3109724 commit 3b383cd

File tree

40 files changed

+3534
-744
lines changed

40 files changed

+3534
-744
lines changed

.github/component_owners.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ components:
6666

6767
processor/opentelemetry-processor-baggage:
6868
- codeboten
69+
70+
instrumentation-genai/:
71+
- karthikscale3
72+
- lmolkova
73+
- lzchen

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3636
([#2922](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2922))
3737
- `opentelemetry-instrumentation-celery` Don't detach context without a None token
3838
([#2927](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2927))
39+
- `opentelemetry-exporter-prometheus-remote-write`: sort labels before exporting
40+
([#2940](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2940))
41+
- `opentelemetry-instrumentation-dbapi` sqlcommenter key values created from PostgreSQL, MySQL systems
42+
([#2897](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2897))
3943

4044
### Breaking changes
4145

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Please also read the [OpenTelemetry Contributor Guide](https://github.com/open-t
3434
* [Testing against a different Core repo branch/commit](#testing-against-a-different-core-repo-branchcommit)
3535
* [Style Guide](#style-guide)
3636
* [Guideline for instrumentations](#guideline-for-instrumentations)
37+
* [Guidance for GenAI instrumentations](#guideline-for-genai-instrumentations)
3738
* [Expectations from contributors](#expectations-from-contributors)
3839

3940
## Find a Buddy and get Started Quickly
@@ -272,6 +273,18 @@ Below is a checklist of things to be mindful of when implementing a new instrume
272273
- ex. <https://github.com/open-telemetry/opentelemetry-python-contrib/blob/60fb936b7e5371b3e5587074906c49fb873cbd76/instrumentation/opentelemetry-instrumentation-grpc/tests/test_aio_server_interceptor.py#L84>
273274
- 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.
274275

276+
## Guidance for GenAI instrumentations
277+
278+
Instrumentations that relate to [Generative AI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) systems will be placed in the [genai](./instrumentation/genai) folder. This section covers contributions related to those instrumentations. Please note that the [guidelines for instrumentations](#guideline-for-instrumentations) and [expectations from contributors](#expectations-from-contributors) still apply.
279+
280+
### Get Involved
281+
282+
* Reviewing PRs: If you would like to be tagged as reviewer in new PRs related to these instrumentations, please submit a PR to add your GitHub handle to [component_owners.yml](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2944/.github/component_owners.yml) under the corresponding instrumentation folder(s).
283+
284+
* Approving PRs: If you would like to be able to approve PRs related to these instrumentations, you must join [opentelemetry-python-contrib-approvers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-approvers) team. Please ask one of the [Python contrib maintainers](https://github.com/orgs/open-telemetry/teams/opentelemetry-python-contrib-maintainers) to be accepted into the team.
285+
286+
* Tracking and Creating Issues: For tracking issues related to Generative AI, please filter or add the label [gen-ai](https://github.com/open-telemetry/opentelemetry-python-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Agen-ai) when creating or searching issues. If you do not see an issue related to an instrumentation you would like to contribute to, please create a new tracking issue so the community is aware of its progress.
287+
275288
## Expectations from contributors
276289

277290
OpenTelemetry is an open source community, and as such, greatly encourages contributions from anyone interested in the project. With that being said, there is a certain level of expectation from contributors even after a pull request is merged, specifically pertaining to instrumentations. The OpenTelemetry Python community expects contributors to maintain a level of support and interest in the instrumentations they contribute. This is to ensure that the instrumentation does not become stale and still functions the way the original contributor intended. Some instrumentations also pertain to libraries that the current members of the community are not so familiar with, so it is necessary to rely on the expertise of the original contributing parties.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ Emeritus Approvers:
133133
Maintainers ([@open-telemetry/python-maintainers](https://github.com/orgs/open-telemetry/teams/python-maintainers)):
134134

135135
- [Aaron Abbott](https://github.com/aabmass), Google
136-
- [Diego Hurtado](https://github.com/ocelotl), Lightstep
137136
- [Leighton Chen](https://github.com/lzchen), Microsoft
138137
- [Riccardo Magliocchetti](https://github.com/xrmx), Elastic
139138
- [Shalev Roda](https://github.com/shalevr), Cisco
140139

141140
Emeritus Maintainers:
142141

143142
- [Alex Boten](https://github.com/codeboten), Lightstep
143+
- [Diego Hurtado](https://github.com/ocelotl), Lightstep
144144
- [Owais Lone](https://github.com/owais), Splunk
145145
- [Yusuke Tsutsumi](https://github.com/toumorokoshi), Google
146146

exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import re
1717
from collections import defaultdict
1818
from itertools import chain
19-
from typing import Dict, Sequence
19+
from typing import Dict, Mapping, Sequence
2020

2121
import requests
2222
import snappy
@@ -253,12 +253,14 @@ def _parse_metric(
253253
return self._convert_to_timeseries(sample_sets, resource_labels)
254254

255255
def _convert_to_timeseries(
256-
self, sample_sets: Sequence[tuple], resource_labels: Sequence
256+
self, sample_sets: Mapping[tuple, Sequence], resource_labels: Sequence
257257
) -> Sequence[TimeSeries]:
258258
timeseries = []
259259
for labels, samples in sample_sets.items():
260260
ts = TimeSeries()
261-
for label_name, label_value in chain(resource_labels, labels):
261+
for label_name, label_value in sorted(
262+
chain(resource_labels, labels)
263+
):
262264
# Previous implementation did not str() the names...
263265
ts.labels.append(self._label(label_name, str(label_value)))
264266
for value, timestamp in samples:

exporter/opentelemetry-exporter-prometheus-remote-write/tests/test_prometheus_remote_write_exporter.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
PrometheusRemoteWriteMetricsExporter,
2323
)
2424
from opentelemetry.exporter.prometheus_remote_write.gen.types_pb2 import ( # pylint: disable=E0611
25+
Label,
26+
Sample,
2527
TimeSeries,
2628
)
2729
from opentelemetry.sdk.metrics.export import (
@@ -155,6 +157,38 @@ def test_parse_metric(metric, prom_rw):
155157
assert sample.value in values
156158

157159

160+
def test_convert_to_timeseries(prom_rw):
161+
resource_labels = (("service_name", "foo"), ("bool_value", True))
162+
sample_sets = {
163+
(("foo", "bar"), ("baz", 42), ("__name__", "test_histogram_tu")): [
164+
(1, 1641946016139)
165+
],
166+
(("baz", "42"), ("foo", "bar")): [(4, 1641946016139)],
167+
}
168+
timeseries = prom_rw._convert_to_timeseries(sample_sets, resource_labels)
169+
assert timeseries == [
170+
TimeSeries(
171+
labels=[
172+
Label(name="__name__", value="test_histogram_tu"),
173+
Label(name="baz", value="42"),
174+
Label(name="bool_value", value="True"),
175+
Label(name="foo", value="bar"),
176+
Label(name="service_name", value="foo"),
177+
],
178+
samples=[Sample(value=1, timestamp=1641946016139)],
179+
),
180+
TimeSeries(
181+
labels=[
182+
Label(name="baz", value="42"),
183+
Label(name="bool_value", value="True"),
184+
Label(name="foo", value="bar"),
185+
Label(name="service_name", value="foo"),
186+
],
187+
samples=[Sample(value=4, timestamp=1641946016139)],
188+
),
189+
]
190+
191+
158192
class TestValidation(unittest.TestCase):
159193
# Test cases to ensure exporter parameter validation works as intended
160194
def test_valid_standard_param(self):
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## Unreleased
9+
10+
- Update OpenAI instrumentation to Semantic Conventions v1.28.0: add new attributes
11+
and switch prompts and completions to log-based events.
12+
([#2925](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2925))
13+
14+
- Initial OpenAI instrumentation
15+
([#2759](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2759))

instrumentation/opentelemetry-instrumentation-openai-v2/README.rst renamed to instrumentation-genai/opentelemetry-instrumentation-openai-v2/README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
OpenTelemetry OpenAI Instrumentation
2-
====================================
2+
====================================
33

44
|pypi|
55

66
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-openai-v2.svg
77
:target: https://pypi.org/project/opentelemetry-instrumentation-openai-v2/
88

9-
Instrumentation with OpenAI that supports the openai library and is
9+
Instrumentation with OpenAI that supports the OpenAI library and is
1010
specified to trace_integration using 'OpenAI'.
1111

1212

0 commit comments

Comments
 (0)