Skip to content

Commit 0dcf30c

Browse files
authored
Merge branch 'main' into pika-selectconnection-support
2 parents c1bab03 + 6977da3 commit 0dcf30c

File tree

4 files changed

+78
-42
lines changed

4 files changed

+78
-42
lines changed

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,16 @@ We meet weekly on Thursday at 9AM PT. The meeting is subject to change depending
111111

112112
Meeting notes are available as a public [Google doc](https://docs.google.com/document/d/1CIMGoIOZ-c3-igzbd6_Pnxx1SjAkjwqoYSUWxPY8XIs/edit). For edit access, get in touch on [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-python/discussions).
113113

114-
Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telemetry/teams/python-approvers)):
114+
### Maintainers
115+
116+
- [Aaron Abbott](https://github.com/aabmass), Google
117+
- [Leighton Chen](https://github.com/lzchen), Microsoft
118+
- [Riccardo Magliocchetti](https://github.com/xrmx), Elastic
119+
- [Shalev Roda](https://github.com/shalevr), Cisco
120+
121+
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
122+
123+
### Approvers
115124

116125
- [Emídio Neto](https://github.com/emdneto), PicPay
117126
- [Jeremy Voss](https://github.com/jeremydvoss), Microsoft
@@ -121,34 +130,29 @@ Approvers ([@open-telemetry/python-approvers](https://github.com/orgs/open-telem
121130
- [Srikanth Chekuri](https://github.com/srikanthccv), signoz.io
122131
- [Tammy Baylis](https://github.com/tammy-baylis-swi), SolarWinds
123132

124-
Emeritus Approvers:
125-
126-
- [Ashutosh Goel](https://github.com/ashu658), Cisco
127-
- [Héctor Hernández](https://github.com/hectorhdzg), Microsoft
128-
- [Nikolay Sokolik](https://github.com/oxeye-nikolay), Oxeye
129-
- [Nikolay Sokolik](https://github.com/nikosokolik), Oxeye
130-
- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS
131-
132-
*Find more about the approver role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver).*
133+
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
133134

134-
Maintainers ([@open-telemetry/python-maintainers](https://github.com/orgs/open-telemetry/teams/python-maintainers)):
135-
136-
- [Aaron Abbott](https://github.com/aabmass), Google
137-
- [Leighton Chen](https://github.com/lzchen), Microsoft
138-
- [Riccardo Magliocchetti](https://github.com/xrmx), Elastic
139-
- [Shalev Roda](https://github.com/shalevr), Cisco
140-
141-
Emeritus Maintainers:
135+
### Emeritus Maintainers
142136

143137
- [Alex Boten](https://github.com/codeboten), Lightstep
144138
- [Diego Hurtado](https://github.com/ocelotl), Lightstep
145139
- [Owais Lone](https://github.com/owais), Splunk
146140
- [Yusuke Tsutsumi](https://github.com/toumorokoshi), Google
147141

148-
*Find more about the maintainer role in [community repository](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).*
142+
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
143+
144+
### Emeritus Approvers
145+
146+
- [Ashutosh Goel](https://github.com/ashu658), Cisco
147+
- [Héctor Hernández](https://github.com/hectorhdzg), Microsoft
148+
- [Nikolay Sokolik](https://github.com/oxeye-nikolay), Oxeye
149+
- [Nikolay Sokolik](https://github.com/nikosokolik), Oxeye
150+
- [Nathaniel Ruiz Nowell](https://github.com/NathanielRN), AWS
151+
152+
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
149153

150-
### Thanks to all the people who already contributed
154+
### Thanks to all of our contributors!
151155

152156
<a href="https://github.com/open-telemetry/opentelemetry-python-contrib/graphs/contributors">
153-
<img src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-python-contrib" />
157+
<img alt="Repo contributors" src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-python-contrib" />
154158
</a>

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# pylint: disable=too-many-locals
14+
# pylint: disable=too-many-locals,too-many-lines
1515

1616
"""
1717
The opentelemetry-instrumentation-asgi package provides an ASGI middleware that can be used
@@ -81,19 +81,38 @@ async def hello():
8181
8282
.. code-block:: python
8383
84-
def server_request_hook(span: Span, scope: dict[str, Any]):
84+
from opentelemetry.trace import Span
85+
from typing import Any
86+
from asgiref.typing import Scope, ASGIReceiveEvent, ASGISendEvent
87+
from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
88+
89+
async def application(scope: Scope, receive: ASGIReceiveEvent, send: ASGISendEvent):
90+
await send({
91+
'type': 'http.response.start',
92+
'status': 200,
93+
'headers': [
94+
[b'content-type', b'text/plain'],
95+
],
96+
})
97+
98+
await send({
99+
'type': 'http.response.body',
100+
'body': b'Hello, world!',
101+
})
102+
103+
def server_request_hook(span: Span, scope: Scope):
85104
if span and span.is_recording():
86105
span.set_attribute("custom_user_attribute_from_request_hook", "some-value")
87106
88-
def client_request_hook(span: Span, scope: dict[str, Any], message: dict[str, Any]):
107+
def client_request_hook(span: Span, scope: Scope, message: dict[str, Any]):
89108
if span and span.is_recording():
90109
span.set_attribute("custom_user_attribute_from_client_request_hook", "some-value")
91110
92-
def client_response_hook(span: Span, scope: dict[str, Any], message: dict[str, Any]):
111+
def client_response_hook(span: Span, scope: Scope, message: dict[str, Any]):
93112
if span and span.is_recording():
94113
span.set_attribute("custom_user_attribute_from_response_hook", "some-value")
95114
96-
OpenTelemetryMiddleware().(application, server_request_hook=server_request_hook, client_request_hook=client_request_hook, client_response_hook=client_response_hook)
115+
OpenTelemetryMiddleware(application, server_request_hook=server_request_hook, client_request_hook=client_request_hook, client_response_hook=client_response_hook)
97116
98117
Capture HTTP request and response headers
99118
*****************************************

util/opentelemetry-util-http/src/opentelemetry/util/http/__init__.py

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,18 @@
2222
from typing import Callable, Iterable, overload
2323
from urllib.parse import urlparse, urlunparse
2424

25-
from opentelemetry.semconv.trace import SpanAttributes
25+
from opentelemetry.semconv._incubating.attributes.http_attributes import (
26+
HTTP_FLAVOR,
27+
HTTP_HOST,
28+
HTTP_METHOD,
29+
HTTP_SCHEME,
30+
HTTP_SERVER_NAME,
31+
HTTP_STATUS_CODE,
32+
)
33+
from opentelemetry.semconv._incubating.attributes.net_attributes import (
34+
NET_HOST_NAME,
35+
NET_HOST_PORT,
36+
)
2637

2738
OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS = (
2839
"OTEL_INSTRUMENTATION_HTTP_CAPTURE_HEADERS_SANITIZE_FIELDS"
@@ -40,22 +51,22 @@
4051

4152
# List of recommended metrics attributes
4253
_duration_attrs = {
43-
SpanAttributes.HTTP_METHOD,
44-
SpanAttributes.HTTP_HOST,
45-
SpanAttributes.HTTP_SCHEME,
46-
SpanAttributes.HTTP_STATUS_CODE,
47-
SpanAttributes.HTTP_FLAVOR,
48-
SpanAttributes.HTTP_SERVER_NAME,
49-
SpanAttributes.NET_HOST_NAME,
50-
SpanAttributes.NET_HOST_PORT,
54+
HTTP_METHOD,
55+
HTTP_HOST,
56+
HTTP_SCHEME,
57+
HTTP_STATUS_CODE,
58+
HTTP_FLAVOR,
59+
HTTP_SERVER_NAME,
60+
NET_HOST_NAME,
61+
NET_HOST_PORT,
5162
}
5263

5364
_active_requests_count_attrs = {
54-
SpanAttributes.HTTP_METHOD,
55-
SpanAttributes.HTTP_HOST,
56-
SpanAttributes.HTTP_SCHEME,
57-
SpanAttributes.HTTP_FLAVOR,
58-
SpanAttributes.HTTP_SERVER_NAME,
65+
HTTP_METHOD,
66+
HTTP_HOST,
67+
HTTP_SCHEME,
68+
HTTP_FLAVOR,
69+
HTTP_SERVER_NAME,
5970
}
6071

6172

util/opentelemetry-util-http/src/opentelemetry/util/http/httplib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
from opentelemetry import context
3232
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
3333
from opentelemetry.instrumentation.utils import unwrap
34-
from opentelemetry.semconv.trace import SpanAttributes
34+
from opentelemetry.semconv._incubating.attributes.net_attributes import (
35+
NET_PEER_IP,
36+
)
3537
from opentelemetry.trace.span import Span
3638

3739
_STATE_KEY = "httpbase_instrumentation_state"
@@ -111,7 +113,7 @@ def trysetip(
111113
)
112114
else:
113115
for span in spanlist:
114-
span.set_attribute(SpanAttributes.NET_PEER_IP, ip)
116+
span.set_attribute(NET_PEER_IP, ip)
115117
return True
116118

117119

0 commit comments

Comments
 (0)