Skip to content

Commit

Permalink
add attribute for original http method
Browse files Browse the repository at this point in the history
  • Loading branch information
emdneto committed Jul 22, 2024
1 parent 42b15a3 commit a725145
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from opentelemetry.propagate import get_global_textmap, set_global_textmap
from opentelemetry.semconv.attributes.http_attributes import (
HTTP_REQUEST_METHOD,
HTTP_REQUEST_METHOD_ORIGINAL,
HTTP_RESPONSE_STATUS_CODE,
)
from opentelemetry.semconv.attributes.url_attributes import URL_FULL
Expand Down Expand Up @@ -314,6 +315,9 @@ def test_nonstandard_http_method_new_semconv(self):
span = self.assert_span()
self.assertEqual("HTTP", span.name)
self.assertEqual(span.attributes.get(HTTP_REQUEST_METHOD), "_OTHER")
self.assertEqual(
span.attributes.get(HTTP_REQUEST_METHOD_ORIGINAL), "NONSTANDARD"
)
self.assertEqual(span.attributes.get(HTTP_RESPONSE_STATUS_CODE), 405)

@mock.patch("httpretty.http.HttpBaseClass.METHODS", ("NONSTANDARD",))
Expand All @@ -331,6 +335,9 @@ def test_nonstandard_http_method_both_semconv(self):
span.attributes.get(SpanAttributes.HTTP_STATUS_CODE), 405
)
self.assertEqual(span.attributes.get(HTTP_REQUEST_METHOD), "_OTHER")
self.assertEqual(
span.attributes.get(HTTP_REQUEST_METHOD_ORIGINAL), "NONSTANDARD"
)
self.assertEqual(span.attributes.get(HTTP_RESPONSE_STATUS_CODE), 405)

def test_basic_http_non_default_port(self):
Expand Down

0 comments on commit a725145

Please sign in to comment.