Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanchon authored and decko committed May 11, 2023
1 parent 57f59b0 commit ceb0d18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ package_dir=
=src
packages=find_namespace:
install_requires =
opentelemetry-api ~= 1.3
opentelemetry-semantic-conventions == 0.28b1
opentelemetry-instrumentation == 0.28b1
opentelemetry-util-http == 0.28b1
opentelemetry-api ~= 1.12
opentelemetry-semantic-conventions == 0.38b0.dev
opentelemetry-instrumentation == 0.38b0.dev
opentelemetry-util-http == 0.38b0.dev

[options.packages.find]
where = src

[options.extras_require]
test =
opentelemetry-test-utils == 0.28b1
opentelemetry-test-utils == 0.38b0.dev


[options.entry_points]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,22 @@ async def middleware(request, handler):
if (
context.get_value("suppress_instrumentation")
or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY)
or _excluded_urls.url_disabled(request.url)
or _excluded_urls.url_disabled(request.url.path)
):
return await handler(request)

token = context.attach(extract(request, getter=getter))
span_name, additional_attributes = get_default_span_details(request)

with tracer.start_as_current_span(
span_name,
kind=trace.SpanKind.SERVER,
) as span:
if span.is_recording():
attributes = collect_request_attributes(request)
attributes.update(additional_attributes)
for key, value in attributes.items():
span.set_attribute(key, value)
try:
resp = await handler(request)
set_status_code(span, resp.status)
finally:
context.detach(token)
return resp
attributes = collect_request_attributes(request)
attributes.update(additional_attributes)
span.setattributes(attributes)
resp = await handler(request)
set_status_code(span, resp.status)
return resp


class _InstrumentedApplication(web.Application):
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.28b1"
__version__ = "0.38b0.dev"

0 comments on commit ceb0d18

Please sign in to comment.