Skip to content

Commit

Permalink
update docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
macieyng committed Apr 16, 2023
1 parent a749e77 commit 2c056d9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ def set_status_code(span, status_code):


def get_default_span_details(scope: dict) -> Tuple[str, dict]:
"""Default implementation for get_default_span_details
"""
Default span name is the HTTP method and URL path, or just the method.
https://github.com/open-telemetry/opentelemetry-specification/pull/3165
https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/http/#name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ def update_expected_server(expected):
SpanAttributes.HTTP_URL: "http://0.0.0.0/",
}
)
# TODO:self possibly update span name to just method
return expected

self.scope["server"] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,17 @@ def _get_attributes_from_request(request):


def _get_default_span_name(request):
"""
Default span name is the HTTP method and URL path, or just the method.
https://github.com/open-telemetry/opentelemetry-specification/pull/3165
https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/http/#name
Args:
request: Tornado request object.
Returns:
Default span name.
"""

path = request.path
method = request.method
if method and path:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def add_response_attributes(

def get_default_span_name(environ):
"""
Default implementation for name_callback.
Default span name is the HTTP method and URL path, or just the method.
https://github.com/open-telemetry/opentelemetry-specification/pull/3165
https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/http/#name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ def test_wsgi_metrics(self):
)
self.assertTrue(number_data_point_seen and histogram_data_point_seen)

# Question: How often request method can be lost?
def test_default_span_name_missing_path_info(self):
"""Test that default span_names with missing path info."""
self.environ.pop("PATH_INFO")
Expand Down

0 comments on commit 2c056d9

Please sign in to comment.