Skip to content

Commit

Permalink
Merge branch 'main' into system-metrics-macos
Browse files Browse the repository at this point in the history
  • Loading branch information
shalevr authored Nov 17, 2023
2 parents b9b9cf9 + 6f6c28d commit 43152a7
Show file tree
Hide file tree
Showing 159 changed files with 1,121 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: d054dff47d2da663a39b9656d106c3d15f344269
CORE_REPO_SHA: 9831afaff5b4d371fd9a14266ab47884546bd971

jobs:
build:
Expand Down
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- `opentelemetry-instrumentation-aiohttp-server` Add instrumentor and auto instrumentation support for aiohttp-server
([#1800](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1800))
### Added

- `opentelemetry-instrumentation` Added Otel semantic convention opt-in mechanism
([#1987](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1987))

## Version 1.21.0/0.42b0 (2023-11-01)

### Added

- `opentelemetry-instrumentation-aiohttp-server` Add instrumentor and auto instrumentation support for aiohttp-server
([#1800](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1800))
- `opentelemetry-instrumentation-botocore` Include SNS topic ARN as a span attribute with name `messaging.destination.name` to uniquely identify the SNS topic
([#1995](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1995))
- `opentelemetry-instrumentation-system-metrics` Add support for collecting process metrics
([#1948](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1948))
- Added schema_url (`"https://opentelemetry.io/schemas/1.11.0"`) to all metrics and traces
([#1977](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1977))

### Fixed

Expand Down Expand Up @@ -54,6 +63,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1824](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1824))
- Fix sqlalchemy instrumentation wrap methods to accept sqlcommenter options
([#1873](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1873))
- Exclude background task execution from root server span in ASGI middleware
([#1952](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1952))

### Added

Expand All @@ -63,7 +74,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1744](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1744))
- Fix async redis clients not being traced correctly
([#1830](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1830))
- Make Flask request span attributes available for `start_span`.
- Make Flask request span attributes available for `start_span`.
([#1784](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1784))
- Fix falcon instrumentation's usage of Span Status to only set the description if the status code is ERROR.
([#1840](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1840))
Expand Down Expand Up @@ -1385,6 +1396,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `opentelemetry-ext-wsgi` Updates for core library changes
- `opentelemetry-ext-http-requests` Updates for core library changes

- `Added support for PyPy3` Initial release
## [#1033](https://github.com/open-telemetryopentelemetry-python-contrib/issues/1033)

## Version 0.1a0 (2019-09-30)

### Added
Expand Down
2 changes: 1 addition & 1 deletion _template/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
4 changes: 2 additions & 2 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sortfirst=
ext/*

[stable]
version=1.21.0.dev
version=1.22.0.dev

packages=
opentelemetry-sdk
Expand All @@ -34,7 +34,7 @@ packages=
opentelemetry-api

[prerelease]
version=0.42b0.dev
version=0.43b0.dev

packages=
all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-richconsole/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ classifiers = [
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-sdk ~= 1.12",
"opentelemetry-semantic-conventions == 0.42b0.dev",
"opentelemetry-semantic-conventions == 0.43b0.dev",
"rich>=10.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aio-pika[instruments]",
"opentelemetry-test-utils == 0.42b0.dev",
"opentelemetry-test-utils == 0.43b0.dev",
"pytest",
"wrapt >= 1.0.0, < 2.0.0",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ async def wrapper(wrapped, instance, args, kwargs):
def _instrument(self, **kwargs):
tracer_provider = kwargs.get("tracer_provider", None)
tracer = trace.get_tracer(
_INSTRUMENTATION_MODULE_NAME, __version__, tracer_provider
_INSTRUMENTATION_MODULE_NAME,
__version__,
tracer_provider,
schema_url="https://opentelemetry.io/schemas/1.11.0",
)
self._instrument_queue(tracer)
self._instrument_exchange(tracer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.42b0.dev",
"opentelemetry-semantic-conventions == 0.42b0.dev",
"opentelemetry-util-http == 0.42b0.dev",
"opentelemetry-instrumentation == 0.43b0.dev",
"opentelemetry-semantic-conventions == 0.43b0.dev",
"opentelemetry-util-http == 0.43b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ def create_trace_config(
# Explicitly specify the type for the `request_hook` and `response_hook` param and rtype to work
# around this issue.

tracer = get_tracer(__name__, __version__, tracer_provider)
tracer = get_tracer(
__name__,
__version__,
tracer_provider,
schema_url="https://opentelemetry.io/schemas/1.11.0",
)

def _end_trace(trace_config_ctx: types.SimpleNamespace):
context_api.detach(trace_config_ctx.token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ def test_status_codes(self):

self.memory_exporter.clear()

def test_schema_url(self):
with self.subTest(status_code=200):
host, port = self._http_request(
trace_config=aiohttp_client.create_trace_config(),
url="/test-path?query=param#foobar",
status_code=200,
)

span = self.memory_exporter.get_finished_spans()[0]
self.assertEqual(
span.instrumentation_info.schema_url,
"https://opentelemetry.io/schemas/1.11.0",
)
self.memory_exporter.clear()

def test_not_recording(self):
mock_tracer = mock.Mock()
mock_span = mock.Mock()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.42b0.dev",
"opentelemetry-semantic-conventions == 0.42b0.dev",
"opentelemetry-util-http == 0.42b0.dev",
"opentelemetry-instrumentation == 0.43b0.dev",
"opentelemetry-semantic-conventions == 0.43b0.dev",
"opentelemetry-util-http == 0.43b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.42b0.dev",
"opentelemetry-instrumentation-dbapi == 0.42b0.dev",
"opentelemetry-instrumentation == 0.43b0.dev",
"opentelemetry-instrumentation-dbapi == 0.43b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand All @@ -37,8 +37,8 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aiopg[instruments]",
"opentelemetry-semantic-conventions == 0.42b0.dev",
"opentelemetry-test-utils == 0.42b0.dev",
"opentelemetry-semantic-conventions == 0.43b0.dev",
"opentelemetry-test-utils == 0.43b0.dev",
]

[project.entry-points.opentelemetry_instrumentor]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ classifiers = [
dependencies = [
"asgiref ~= 3.0",
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.42b0.dev",
"opentelemetry-semantic-conventions == 0.42b0.dev",
"opentelemetry-util-http == 0.42b0.dev",
"opentelemetry-instrumentation == 0.43b0.dev",
"opentelemetry-semantic-conventions == 0.43b0.dev",
"opentelemetry-util-http == 0.43b0.dev",
]

[project.optional-dependencies]
Expand All @@ -38,7 +38,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-asgi[instruments]",
"opentelemetry-test-utils == 0.42b0.dev",
"opentelemetry-test-utils == 0.43b0.dev",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,19 @@ def __init__(
meter=None,
):
self.app = guarantee_single_callable(app)
self.tracer = trace.get_tracer(__name__, __version__, tracer_provider)
self.tracer = trace.get_tracer(
__name__,
__version__,
tracer_provider,
schema_url="https://opentelemetry.io/schemas/1.11.0",
)
self.meter = (
get_meter(__name__, __version__, meter_provider)
get_meter(
__name__,
__version__,
meter_provider,
schema_url="https://opentelemetry.io/schemas/1.11.0",
)
if meter is None
else meter
)
Expand Down Expand Up @@ -566,7 +576,7 @@ async def __call__(self, scope, receive, send):
if scope["type"] == "http":
self.active_requests_counter.add(1, active_requests_count_attrs)
try:
with trace.use_span(span, end_on_exit=True) as current_span:
with trace.use_span(span, end_on_exit=False) as current_span:
if current_span.is_recording():
for key, value in attributes.items():
current_span.set_attribute(key, value)
Expand Down Expand Up @@ -620,6 +630,8 @@ async def __call__(self, scope, receive, send):
)
if token:
context.detach(token)
if span.is_recording():
span.end()

# pylint: enable=too-many-branches

Expand All @@ -643,8 +655,11 @@ async def otel_receive():
def _get_otel_send(
self, server_span, server_span_name, scope, send, duration_attrs
):
expecting_trailers = False

@wraps(send)
async def otel_send(message):
nonlocal expecting_trailers
with self.tracer.start_as_current_span(
" ".join((server_span_name, scope["type"], "send"))
) as send_span:
Expand All @@ -658,6 +673,8 @@ async def otel_send(message):
] = status_code
set_status_code(server_span, status_code)
set_status_code(send_span, status_code)

expecting_trailers = message.get("trailers", False)
elif message["type"] == "websocket.send":
set_status_code(server_span, 200)
set_status_code(send_span, 200)
Expand Down Expand Up @@ -693,5 +710,15 @@ async def otel_send(message):
pass

await send(message)
if (
not expecting_trailers
and message["type"] == "http.response.body"
and not message.get("more_body", False)
) or (
expecting_trailers
and message["type"] == "http.response.trailers"
and not message.get("more_trailers", False)
):
server_span.end()

return otel_send
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.42b0.dev"
__version__ = "0.43b0.dev"
Loading

0 comments on commit 43152a7

Please sign in to comment.