Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametrized trace context extraction tests. #456

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

purple4reina
Copy link
Contributor

What does this PR do?

Parameterize some of the trace extraction tests.

Motivation

Clearer. Easier. Prettier.

Testing Guidelines

Additional Notes

There are still more trace extraction tests in there, I am thinking to move those others into this single parameterized test soon.

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@purple4reina purple4reina requested a review from a team as a code owner March 27, 2024 21:37
@@ -96,6 +96,58 @@ def _wrap(*args, **kwargs):
return _wrapper


_test_extract_dd_trace_context = (
("api-gateway", Context(trace_id=12345, span_id=67890, sampling_priority=2)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, is there any difference if we just use the same Context object for all of them? I.e. data is the same, as opposed to changing the trace_id, span_id and sampling_priority all the time?

I see some of them have different sampling priority, but I don't understand why they have different trace_id/span_id, is it important in those cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the reason why the trace/span ids are different is because these values are pulled from the event json itself from the text fixture file. Bringing these into alignment would mean changing those fixtures and could have impacts on other tests as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks – makes sense, appreciate it

@purple4reina purple4reina merged commit 4669117 into main Mar 28, 2024
51 checks passed
@purple4reina purple4reina deleted the rey.abolofia/context-pytest branch March 28, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants