Skip to content

Commit

Permalink
update changelog && add test
Browse files Browse the repository at this point in the history
  • Loading branch information
GonzaloGuasch committed Dec 26, 2024
1 parent 9252deb commit 4d90845
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3111](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3111))
- `opentelemetry-instrumentation-falcon` add support version to v4
([#3086](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3086))
- `opentelemetry-instrumentation-wsgi` remove is_recording method to record status code in all metrics
- `opentelemetry-instrumentation-wsgi` always record span status code to have it available in metrics
([#3148](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3148))

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,18 @@ def test_response_attributes(self):
self.span.set_attribute.assert_has_calls(expected, any_order=True)
self.span.set_attribute.assert_has_calls(expected_new, any_order=True)

def test_response_attributes_noop(self):
mock_span = mock.Mock()
mock_span.is_recording.return_value = False

attrs = {}
otel_wsgi.add_response_attributes(mock_span, "404 Not Found", {}, duration_attrs=attrs)

self.assertEqual(mock_span.set_attribute.call_count, 0)
self.assertEqual(mock_span.is_recording.call_count, 2)
self.assertEqual(attrs[SpanAttributes.HTTP_STATUS_CODE], 404)


def test_credential_removal(self):
self.environ["HTTP_HOST"] = "username:password@mock"
self.environ["PATH_INFO"] = "/status/200"
Expand Down

0 comments on commit 4d90845

Please sign in to comment.