Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Conversation

@bruno-garcia
Copy link
Member

@bruno-garcia bruno-garcia commented Jan 19, 2020

This is work to get sentry-core where it can be the base of sentry-java and its integrations.
The long term goal is to merge this repo into sentry-java instead on a orphan branch and keep the 1.7 work on a branch for bug fixing.

Still WIP. Contexts needs a deep copy of the known types.
If it's App, Device etc, we need to call clone() instead of just bringing the reference over.

This was done here:

https://github.com/getsentry/sentry-dotnet-protocol/blob/afd65b92ed7122a628dc3631711b407f56e9a8a8/src/Sentry.Protocol/Context/Contexts.cs#L60

@metlos
Copy link
Contributor

metlos commented Jan 19, 2020

Also, if I'm not mistaken, this still doesn't make this feature-equivalent to Sentry .NET where the scope also includes the Request as a separate field from the Contexts.

@bruno-garcia
Copy link
Member Author

In dotnet and the docs we mention requests is part of the scope, not the contexts.
So this fix is unrelated to requests. We still need to add the class and a property to scope and event.

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

No description provided. :(

Why do we need that? is it for GA as well?

@bruno-garcia
Copy link
Member Author

There's no description because I thought the title was self explanatory.
It's a fix because the Contexts belong on the scope. Right not it's only on the event so we can't do Sentry.configureScope(s -> s.Context["bla"] = ...)

Here's python:

https://github.com/getsentry/sentry-python/blob/e1b55a1b8f44e626309b33a9f1561a0c6808a214/sentry_sdk/scope.py#L183-L197

C#:

https://github.com/getsentry/sentry-dotnet-protocol/blob/7cde43e194acab89ccc8c23b76a72b7a72d99c4b/src/Sentry.Protocol/BaseScope.cs#L90

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

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

LGTM, but CI is not happy, need to fix it.

@marandaneto
Copy link
Contributor

There's no description because I thought the title was self explanatory.
It's a fix because the Contexts belong on the scope. Right not it's only on the event so we can't do Sentry.configureScope(s -> s.Context["bla"] = ...)

Here's python:

https://github.com/getsentry/sentry-python/blob/e1b55a1b8f44e626309b33a9f1561a0c6808a214/sentry_sdk/scope.py#L183-L197

C#:

https://github.com/getsentry/sentry-dotnet-protocol/blob/7cde43e194acab89ccc8c23b76a72b7a72d99c4b/src/Sentry.Protocol/BaseScope.cs#L90

ok got it, but we already talked about it a few times in the past and also recently with @HazAT, it was never needed, at least for GA, why do we need now?

Another thing, if Contexts may be cloned, App/Browser/Device/OperatingSystem/SentryRuntime/Gpu need to implements Cloneable and override the clone method and do the magic as well, otherwise, it will be a shallow copy and we don't want that, right?

@bruno-garcia
Copy link
Member Author

ok got it, but we already talked about it a few times in the past and also recently with @HazAT, it was never needed, at least for GA, why do we need now?

It's not needed for GA, this can stay on a branch that we use for the sentry-java experiments of @metlos then to avoid breaking something now that we're trying to go GA

Another thing, if Contexts may be cloned, App/Browser/Device/OperatingSystem/SentryRuntime/Gpu need to implements Cloneable and override the clone method and do the magic as well, otherwise, it will be a shallow copy and we don't want that, right?

Yeah we need to do clone on all of them, since those might be changed on the new scope and it's typed stuff, known types.

So this PR can't be merged until we do that. Also doesn't need to be merged at all until sentry-core gets closer to becoming new sentry-java dependency. The branch can be used instead.

@bruno-garcia bruno-garcia changed the title fix: Contexts belong on the Scope fix(sentry-java): Contexts belong on the Scope Jan 28, 2020
@marandaneto
Copy link
Contributor

ok got it, but we already talked about it a few times in the past and also recently with @HazAT, it was never needed, at least for GA, why do we need now?

It's not needed for GA, this can stay on a branch that we use for the sentry-java experiments of @metlos then to avoid breaking something now that we're trying to go GA

Another thing, if Contexts may be cloned, App/Browser/Device/OperatingSystem/SentryRuntime/Gpu need to implements Cloneable and override the clone method and do the magic as well, otherwise, it will be a shallow copy and we don't want that, right?

Yeah we need to do clone on all of them, since those might be changed on the new scope and it's typed stuff, known types.

So this PR can't be merged until we do that. Also doesn't need to be merged at all until sentry-core gets closer to becoming new sentry-java dependency. The branch can be used instead.

agreed, cool stuff, we can work on it later on then!

@marandaneto marandaneto marked this pull request as draft May 29, 2020 10:11
this.extra.remove(key);
}

public @NotNull Contexts getContexts() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure we want to expose the whole Contexts, but rather just add items to it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants