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

Scope values override Event values #326

Closed
rhcarvalho opened this issue Feb 13, 2021 · 0 comments · Fixed by #446
Closed

Scope values override Event values #326

rhcarvalho opened this issue Feb 13, 2021 · 0 comments · Fixed by #446
Assignees
Milestone

Comments

@rhcarvalho
Copy link
Contributor

Summary

In the Go SDK, setting certain fields on the scope override the equivalent fields in events, while in other SDKs the event fields take precedence.

Steps To Reproduce

Compare Scope.ApplyToEvent (Go) and Scope.applyToEvent (JS).

In particular:

Go

	if len(scope.contexts) > 0 {
		if event.Contexts == nil {
			event.Contexts = make(map[string]interface{})
		}


		for key, value := range scope.contexts {
			event.Contexts[key] = value
		}
	}

JavaScript

    if (this._contexts && Object.keys(this._contexts).length) {
      event.contexts = { ...this._contexts, ...event.contexts };
    }

Expected Behavior

SDKs should handle this type of detail consistently.

SDK

  • sentry-go version: 0.9.0
  • Go version: any
  • Using Go Modules? [yes/no] either

Additional context

The spec is not clear about precedence, but seems that the JavaScript behavior is the one replicated elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants