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

SetContext is under documented #33175

Closed
rkuska opened this issue Mar 31, 2022 · 3 comments
Closed

SetContext is under documented #33175

rkuska opened this issue Mar 31, 2022 · 3 comments

Comments

@rkuska
Copy link

rkuska commented Mar 31, 2022

Environment

SaaS (https://sentry.io/)

Version

No response

Steps to Reproduce

hub := sentry.CurrentHub().Clone()
hub.ConfigureScope(func(scope *sentry.Scope) {
	scope.SetContext("tx_type", batch.ttype)
	scope.SetContext("strategy", batch.strategy)
})
_ = hub.CaptureMessage("Message")


Expected Result

Values to be rendered correctly.

Actual Result

Screenshot 2022-03-31 at 16 44 18

@rkuska
Copy link
Author

rkuska commented Mar 31, 2022

I searched the repository for usage but it seems the same (the tests are using the same approach as mine above). In online documentation there is a following statement:

The best practice to attach custom data is via structured contexts. A context must always be a dictionary or map, and its values can be arbitrary.

Why the function doesn't have in its signature that it accepts only map[string]interface{} but instead there is interface{}? Current signature seems counter-intuitive.

Also, is there a way to enrich the context under a given key later? Right now the object under the key is being overwritten so the namespace can't be enriched.

@rkuska
Copy link
Author

rkuska commented Mar 31, 2022

It seems like I created an issue by mistake in getsentry/sentry instead of getsentry/sentry-go sorry for that!

@rkuska
Copy link
Author

rkuska commented Mar 31, 2022

I opened a new issue in the correct package so I am closing this one.

@rkuska rkuska closed this as completed Mar 31, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant