Skip to content

Commit 73c5a8b

Browse files
povilasvbitnahiansrikanthccvshalevropentelemetrybot
committed
merge upstream changes to coralogix-python-dev (#6)
* Add otelTraceSampled to instrumetation-logging (open-telemetry#1773) * Add otelTraceSampled to instrumetation-logging * Updated code with black * Added to CHANGELOG.md --------- Co-authored-by: Srikanth Chekuri <[email protected]> * Expand sqlalchemy pool.name to follow the semantic conventions (open-telemetry#1778) * Skip requests tests for pypy3 (open-telemetry#1806) * Update version to 1.19.0.dev/0.40b0.dev (open-telemetry#1797) Co-authored-by: Diego Hurtado <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> * Resource detector for container properties (open-telemetry#1584) Co-authored-by: Diego Hurtado <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Leighton Chen <[email protected]> * botocore: always use x-ray for http header injection (open-telemetry#1741) Co-authored-by: Diego Hurtado <[email protected]> * Refactor CODEOWNERS file (open-telemetry#1804) * Refactor CODEOWNERS file Fixes open-telemetry#1803 * Remove CODEOWNERS * Refactor component owners configuration * Refactor CODEOWNERS to select any file but the ones in instrumentation --------- Co-authored-by: Shalev Roda <[email protected]> * Update maintainers list (open-telemetry#1817) * skip urllib3 test on pypy3 (open-telemetry#1826) * Fix celery docker tests (open-telemetry#1841) * Use HTTP mock server for aiohttp tests (open-telemetry#1849) Fixes open-telemetry#1842 * Use HTTP mock server for tornado tests (open-telemetry#1855) * Use HTTP mock server for tornado tests Fixes open-telemetry#1681 * Fix lint * Remove use of httpbin (open-telemetry#1854) * Use `request_ctx` to determine whether or not `_teardown_request` should end flask span (open-telemetry#1692) Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * remove srikanthccv from maintainers (open-telemetry#1792) Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * Sanitize redis db_statement by default (open-telemetry#1776) Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> * Relax httpx version to allow >= 0.18.0 (open-telemetry#1748) * Issue open-telemetry#1757 - Update HTTP server/client instrumentation span names (open-telemetry#1759) Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> * Fix falcon usage of Span Status (open-telemetry#1840) * Fix falcon usage of Span Status to only set the description if the status code is ERROR * Update changelog * Update CHANGELOG.md Co-authored-by: Srikanth Chekuri <[email protected]> * fix lint * Use fewer variables to satisfy R0914 lint rule --------- Co-authored-by: Srikanth Chekuri <[email protected]> * Request Flask attributes passed to Sampler (open-telemetry#1784) * Request Flask attributes passed to Sampler * Update changelog * Lint * Fix botocore test keyerror * Revert "Fix botocore test keyerror" This reverts commit fd03c55. * botocore test does get_queue_url * Revert "botocore test does get_queue_url" This reverts commit 9530cd2. * Update changelog --------- Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> * Fixed urllib3 instrumentation example in instrumentation documentation (open-telemetry#1793) * corrected instrumentation example in urllib3 * Remove changelog entry --------- Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * Fix Invalid type NoneType for attribute X error | AWS-Lambda instrumentation (open-telemetry#1785) * Add None checking to the aws-lambda logic * Update changelog. * Change .get() check to 'key' in dict check. * Fix consistency issues. * Update changelog. --------- Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> * Add metrics instrumentation celery (open-telemetry#1679) Co-authored-by: Shalev Roda <[email protected]> * Add support for confluent_kafka until 2.1.1 version (open-telemetry#1815) * Add support for confulent_kafka until 2.1.1 version * Include 2.1.1 version * update CHANGELOG.md * run: 'tox -e generate' * resolve comments * update top version to 2.2.0 --------- Co-authored-by: Ran Nozik <[email protected]> * fix redis doc (open-telemetry#1808) doc string rendered at https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/redis/redis.html refers to `opentelemetry-instrumentation` executable which appears to be a typo Co-authored-by: Shalev Roda <[email protected]> * Add http.server.response.size metric to ASGI implementation. (open-telemetry#1789) * Add http.server.response.size metric to ASGI implementation. Add new unit tests. * Update changelog. * Fix linting by disabling too-many-nested-blocks * Put new logic in a new method * Refactor the placement of new logic. * Fixed the unit tests in FastAPI and Starlette * Update changelog. * FIx lint errors. * Refactor getting content-length header * Refactor getting content-length header --------- Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * fix: Update falcon instrumentation to follow semantic conventions (open-telemetry#1824) * fix: Update falcon instrumentation to follow semantic conventions * docs: Update changelog * fix linter errors * Disable falcon.HTTP_200 pylint checck --------- Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> * Bump requests from 2.28.1 to 2.31.0 (open-telemetry#1818) Bumps [requests](https://github.com/psf/requests) from 2.28.1 to 2.31.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](psf/requests@v2.28.1...v2.31.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shalev Roda <[email protected]> * fix(grpc): Allow gRPC connections via Unix socket (open-telemetry#1833) * fix(grpc): Allow gRPC connections via Unix socket This commit addresses issue open-telemetry#1832. The way `NET_PEER_IP` and `NET_PEER_PORT` are retrieved raises a `ValueError` when gRPC connections are handled via Unix sockets. ```py ip, port = ( context.peer().split(",")[0].split(":", 1)[1].rsplit(":", 1) ) ``` When using an address like `unix:///tmp/grpc.sock` the value of `context.peer()` is `"unix:"`. Substituting that in the function above... ```py ip, port = "unix:".split(",")[0].split(":", 1)[1].rsplit(":", 1) ip, port = ["unix:"][0].split(":", 1)[1].rsplit(":", 1) ip, port = "unix:".split(":", 1)[1].rsplit(":", 1) ip, port = ["unix", ""][1].rsplit(":", 1) ip, port = "".rsplit(":", 1) ip, port = [""] # ValueError ``` I "addressed" the issue by guarding the retrieval of `net.peer.*` values under an `if` statement that checks if we are using a Unix socket. I extended the `server_interceptor` tests to run against TCP and Unix socket configurations. --- **Open Questions** - [ ] The socket tests will fail on Windows. Is there a way to annotate that? - [ ] Are there other span values we should be setting for the unix socket? * Update CHANGELOG * Add placeholder attributes for linter * fix lint --------- Co-authored-by: Matt Oberle <[email protected]> Co-authored-by: Shalev Roda <[email protected]> * Add http.server.request.size for ASGI metric implementation (open-telemetry#1867) * Update changelog file. * Update changelog file. * Add new request.size metric for ASGI middleware. * Clean-up. * Refactor try except section. --------- Co-authored-by: Shalev Roda <[email protected]> * Fix elastic-search sanitization for bulk queries (open-telemetry#1870) * support sanitization for str body response * add CHANGELOG entry --------- Co-authored-by: Shalev Roda <[email protected]> * Add conditional elastic_transport import (open-telemetry#1810) * Add conditional elastic_transport import * Update changelog * Add future es8 tests * Update CHANGELOG.md Co-authored-by: Diego Hurtado <[email protected]> * Add license, rm pylint disable * Consistent elastic version check * lint import * Update CHANGELOG.md --------- Co-authored-by: Diego Hurtado <[email protected]> Co-authored-by: Shalev Roda <[email protected]> * Fix async redis clients tracing (open-telemetry#1830) * Fix async redis clients tracing * Update changelog * Add functional integration tests and fix linting issues --------- Co-authored-by: Shalev Roda <[email protected]> * Update maintainers list (open-telemetry#1874) * Use a weak reference to sqlalchemy Engine to avoid memory leak (open-telemetry#1771) * Use a weak reference to sqlalchemy Engine to avoid memory leak Closes open-telemetry#1761 By using a weak reference to the `Engine` object, we can avoid the memory leak as disposed `Engines` get properly deallocated. Whenever `SQLAlchemy` is uninstrumented, we only trigger a removal for those event listeners which are listening for objects that haven't been garbage-collected yet. * Made a mistake in resolving the weak reference * Fixed formatting issues * Updated changelog * Added unit test to check that engine was garbage collected * Do not save engine in EngineTracer to avoid memory leak * Add an empty line to satisfy black formatter * Fix isort complaints * Fixed the issue when pool name is not set and =None * Fix formatting issue * Rebased after changes in a recent commit * Updated PR number in changelog --------- Co-authored-by: Shalev Roda <[email protected]> * sqlalchemy wrap_create_engine now accepts sqlcommenter options (open-telemetry#1873) * sqlalchemy wrap_create_engine accepts sqlcommenter options * Changelog * Lint * Fix default val * Add sqlalchemy tests * Change a default in _instrument get * Lint * More lint * Update default Co-authored-by: Shalev Roda <[email protected]> * Update args doc * lintttt --------- Co-authored-by: Shalev Roda <[email protected]> * Add statement of maintainership (open-telemetry#1859) Co-authored-by: Shalev Roda <[email protected]> * urllib3: Add instrumentation support for version 2 (open-telemetry#1879) * urllib3: Add instrumentation support for version 2 * changelog * Distro selection (open-telemetry#1823) * fix(django): avoid empty span name on empty path (open-telemetry#1788) Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * Instrument mysqlclient library (open-telemetry#1744) Co-authored-by: Diego Hurtado <[email protected]> * Update version to 1.20.0.dev/0.41b0.dev (open-telemetry#1885) Co-authored-by: Diego Hurtado <[email protected]> * Fix pyyaml version (open-telemetry#1892) * update awslambda to use _X_AMZN_TRACE_ID as a Span Link (open-telemetry#1657) Co-authored-by: Ron Yishai <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> * Fix UnboundLocalError local variable 'start' referenced before assignment (open-telemetry#1889) Co-authored-by: Pablo Collins <[email protected]> * Merge pull request from GHSA-5rv5-6h4r-h22v * Fix unbound cardinality for label http_method in wsgi based middlewares * cr: rename file * cr: change label UNKNOWN to NONSTANDARD * Update instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py --------- Co-authored-by: Diego Hurtado <[email protected]> * Fix errors introduced in regression (open-telemetry#1913) * Azure resource detectors (open-telemetry#1901) * Revert "update awslambda to use _X_AMZN_TRACE_ID as a Span Link" (open-telemetry#1911) Co-authored-by: Diego Hurtado <[email protected]> * feat(confluent-kafka): Add instrumentation to consume method (open-telemetry#1786) Co-authored-by: Diego Hurtado <[email protected]> * Add Cassandra instrumentation (open-telemetry#1902) * Unwrap Celery's `ExceptionInfo` (open-telemetry#1863) * Unwrap `ExceptionInfo` and `ExceptionWithTraceback` Instead of reporting the `ExceptionInfo` and `ExceptionWithTraceback` wrappers raised by Celery, report the exceptions that they wrap. This ensures that the exception in the OpenTelemetry span has a type and traceback that are meaningful and relevant to the developer. * Fix typo The exception is expected, not excepted. Well, I guess it is also excepted, because it's an exception, but you get what I mean. * Reformat file with `black` Reformat the `__init__.py` file in the Celery instrumentation using `black`, fixing a CI linter error. * Address review feedback Use the VERSION attribute exposed by Billiard to decide whether to import ExceptionWithTraceback. Add a test for a failing task and check that the exceptions' type and message are preserved. * Amend ExceptionWithTraceback import * doc: fix `commenter_options` type (open-telemetry#1926) Co-authored-by: Shalev Roda <[email protected]> * Update version to 1.21.0.dev/0.42b0.dev (open-telemetry#1930) Co-authored-by: Diego Hurtado <[email protected]> * Modify eachdist and build script for container packages (open-telemetry#1949) * Update pyproject.toml (open-telemetry#1950) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Nahian-Al Hasan <[email protected]> Co-authored-by: Srikanth Chekuri <[email protected]> Co-authored-by: Shalev Roda <[email protected]> Co-authored-by: OpenTelemetry Bot <[email protected]> Co-authored-by: Diego Hurtado <[email protected]> Co-authored-by: Sanket Mehta <[email protected]> Co-authored-by: Leighton Chen <[email protected]> Co-authored-by: Tristan Sloughter <[email protected]> Co-authored-by: Matthew Grossman <[email protected]> Co-authored-by: Nimrod Shlagman <[email protected]> Co-authored-by: Phillip Verheyden <[email protected]> Co-authored-by: Maciej Nachtygal <[email protected]> Co-authored-by: Filip Nikolovski <[email protected]> Co-authored-by: Tammy Baylis <[email protected]> Co-authored-by: Yashaswi Makula <[email protected]> Co-authored-by: Iman Shafiei <[email protected]> Co-authored-by: Akochavi <[email protected]> Co-authored-by: David Gonoradsky <[email protected]> Co-authored-by: Ran Nozik <[email protected]> Co-authored-by: Pablo Collins <[email protected]> Co-authored-by: Iman Shafiei <[email protected]> Co-authored-by: Michael <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matt Oberle <[email protected]> Co-authored-by: Matt Oberle <[email protected]> Co-authored-by: Vivanov98 <[email protected]> Co-authored-by: Rytis Bagdziunas <[email protected]> Co-authored-by: Mario Jonke <[email protected]> Co-authored-by: Jeremy Voss <[email protected]> Co-authored-by: Marc Dougherty <[email protected]> Co-authored-by: Alexandre Papin <[email protected]> Co-authored-by: Ron Yishai <[email protected]> Co-authored-by: Thomas LÉVEIL <[email protected]> Co-authored-by: Jakub Warczarek <[email protected]> Co-authored-by: Raphael Philipe Mendes da Silva <[email protected]> Co-authored-by: Javier Fernández Rodríguez <[email protected]> Co-authored-by: mattcontinisio <[email protected]> Co-authored-by: Noemi <[email protected]> Co-authored-by: João Thallis <[email protected]>
1 parent 1cf47e1 commit 73c5a8b

File tree

13 files changed

+1613
-2
lines changed

13 files changed

+1613
-2
lines changed

.github/workflows/test.yml

+84-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,89 @@ env:
99
CORE_REPO_SHA: 955c92e91b5cd4bcfb43c39efcef086b040471d2
1010

1111
jobs:
12+
build:
13+
env:
14+
# We use these variables to convert between tox and GHA version literals
15+
py37: 3.7
16+
py38: 3.8
17+
py39: 3.9
18+
py310: "3.10"
19+
py311: "3.11"
20+
pypy3: "pypy3.7"
21+
RUN_MATRIX_COMBINATION: ${{ matrix.python-version }}-${{ matrix.package }}-${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
25+
matrix:
26+
python-version: [ py37, py38, py39, py310, py311, pypy3 ]
27+
package: ["instrumentation", "distro", "exporter", "sdkextension", "propagator", "resource"]
28+
os: [ ubuntu-20.04 ]
29+
steps:
30+
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
31+
uses: actions/checkout@v2
32+
- name: Set up Python ${{ env[matrix.python-version] }}
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ env[matrix.python-version] }}
36+
- name: Install tox
37+
run: pip install tox==3.27.1 tox-factor
38+
- name: Cache tox environment
39+
# Preserves .tox directory between runs for faster installs
40+
uses: actions/cache@v1
41+
with:
42+
path: |
43+
.tox
44+
~/.cache/pip
45+
key: v7-build-tox-cache-${{ env.RUN_MATRIX_COMBINATION }}-${{ hashFiles('tox.ini', 'gen-requirements.txt', 'dev-requirements.txt') }}
46+
- name: run tox
47+
run: tox -f ${{ matrix.python-version }}-${{ matrix.package }} -- --benchmark-json=${{ env.RUN_MATRIX_COMBINATION }}-benchmark.json
48+
# - name: Find and merge ${{ matrix.package }} benchmarks
49+
# # TODO: Add at least one benchmark to every package type to remove this (#249)
50+
# if: matrix.package == 'sdkextension' || matrix.package == 'propagator'
51+
# run: >-
52+
# mkdir -p benchmarks;
53+
# jq -s '.[0].benchmarks = ([.[].benchmarks] | add)
54+
# | if .[0].benchmarks == null then null else .[0] end'
55+
# **/**/tests/*${{ matrix.package }}*-benchmark.json > benchmarks/output_${{ matrix.package }}.json
56+
# - name: Upload all benchmarks under same key as an artifact
57+
# if: ${{ success() }}
58+
# uses: actions/upload-artifact@v2
59+
# with:
60+
# name: benchmarks
61+
# path: benchmarks/output_${{ matrix.package }}.json
62+
# combine-benchmarks:
63+
# runs-on: ubuntu-latest
64+
# needs: build
65+
# if: ${{ always() }}
66+
# name: Combine benchmarks from previous build job
67+
# steps:
68+
# - name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
69+
# uses: actions/checkout@v2
70+
# - name: Download all benchmarks as artifact using key
71+
# uses: actions/download-artifact@v2
72+
# with:
73+
# name: benchmarks
74+
# path: benchmarks
75+
# - name: Find and merge all benchmarks
76+
# run: >-
77+
# jq -s '.[0].benchmarks = ([.[].benchmarks] | add)
78+
# | if .[0].benchmarks == null then null else .[0] end'
79+
# benchmarks/output_*.json > output.json;
80+
# - name: Report on benchmark results
81+
# uses: benchmark-action/github-action-benchmark@v1
82+
# with:
83+
# name: OpenTelemetry Python Benchmarks - Python ${{ env[matrix.python-version ]}} - ${{ matrix.package }}
84+
# tool: pytest
85+
# output-file-path: output.json
86+
# github-token: ${{ secrets.GITHUB_TOKEN }}
87+
# max-items-in-chart: 100
88+
# # Alert with a commit comment on possible performance regression
89+
# alert-threshold: 200%
90+
# fail-on-alert: true
91+
# # Make a commit on `gh-pages` with benchmarks from previous step
92+
# auto-push: ${{ github.ref == 'refs/heads/main' }}
93+
# gh-pages-branch: gh-pages
94+
# benchmark-data-dir-path: benchmarks
1295
misc:
1396
strategy:
1497
fail-fast: false
@@ -24,7 +107,7 @@ jobs:
24107
with:
25108
python-version: "3.10"
26109
- name: Install tox
27-
run: pip install tox
110+
run: pip install tox==3.27.1
28111
- name: Install libsnappy-dev
29112
if: ${{ matrix.tox-environment == 'lint' }}
30113
run: sudo apt-get install -y libsnappy-dev

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

+10
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,16 @@ def __init__(
510510
unit="By",
511511
description="Measures the size of HTTP request messages (compressed).",
512512
)
513+
self.server_response_size_histogram = self.meter.create_histogram(
514+
name=MetricInstruments.HTTP_SERVER_RESPONSE_SIZE,
515+
unit="By",
516+
description="measures the size of HTTP response messages (compressed).",
517+
)
518+
self.server_request_size_histogram = self.meter.create_histogram(
519+
name=MetricInstruments.HTTP_SERVER_REQUEST_SIZE,
520+
unit="By",
521+
description="Measures the size of HTTP request messages (compressed).",
522+
)
513523
self.active_requests_counter = self.meter.create_up_down_counter(
514524
name=MetricInstruments.HTTP_SERVER_ACTIVE_REQUESTS,
515525
unit="requests",

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def _patched_api_call(self, original_func, instance, args, kwargs):
234234
attributes["rpc.request.payload"] = limit_string_size(self.payload_size_limit,json.dumps(body, default=str))
235235
elif call_context.service == "events" and call_context.operation == "PutEvents":
236236
call_context.span_kind = SpanKind.PRODUCER
237+
attributes["rpc.request.payload"] = limit_string_size(self.payload_size_limit, json.dumps(call_context.params, default=str))
237238
else:
238239
attributes["rpc.request.payload"] = limit_string_size(self.payload_size_limit, json.dumps(call_context.params, default=str))
239240
except Exception as ex:
@@ -483,7 +484,7 @@ def set(
483484
val = {"DataType": "String", "StringValue": value}
484485
carrier[key] = val
485486

486-
def limit_string_size(s: str, max_size: int) -> str:
487+
def limit_string_size(max_size: int, s: str) -> str:
487488
if len(s) > max_size:
488489
return s[:max_size]
489490
else:

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)