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

refactor context setters, and document them properly #133

Closed
wants to merge 1 commit into from

Conversation

beniwohli
Copy link
Contributor

@beniwohli beniwohli commented Jan 15, 2018

This also adds functionality to copy transaction context data to errors that happen during the transaction.

@@ -185,8 +185,49 @@ import elasticapm
elasticapm.set_transaction_data({'billing_amount': product.price * item_count})
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really still set_transaction_data and not set_context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch!

assert message['context']['user'] == {'username': 'foo', 'email': 'foo@example.com', 'id': 42}
assert message['context']['tags'] == {'foo': 'baz'}
assert 'a' in transaction.context['custom']
assert 'foo' not in transaction.context['custom']
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I am missing it but I don't see a test that checks that you can call the update functions multiple times. as described in the api docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent point, I added some tests :)

@beniwohli beniwohli force-pushed the context-setters branch 2 times, most recently from 4c326bb to 4abd829 Compare January 15, 2018 13:26
@beniwohli beniwohli closed this in 9c3b8c8 Jan 15, 2018
beniwohli added a commit that referenced this pull request Jan 15, 2018
This also adds functionality to copy transaction context data to errors
that happen during the transaction.

closes #133
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

2 participants