-
-
Notifications
You must be signed in to change notification settings - Fork 445
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
Hubs/Scopes Merge 27 - Discussions #3352
Changes from all commits
305baf5
95f5e1b
27f2398
ce3c14f
ce615f4
22ddc00
305c217
da927bc
8279276
9bfc086
b998e50
739827a
69f2d63
792d482
9bcbce6
3f25a4b
d6fb40a
7752bcc
1e329c5
b0d89ae
cdd414a
98da9ff
2d26033
bbb6700
c714b21
a474402
ae93e33
b01298b
b64e688
d06fc50
f0af5c3
2f02001
2b05019
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -663,6 +663,7 @@ public void setUnknown(@Nullable Map<String, Object> unknown) { | |
@Override | ||
@SuppressWarnings("JavaUtilDate") | ||
public int compareTo(@NotNull Breadcrumb o) { | ||
// TODO also use nano time if equal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To fix breadcrumb ordering across multiple collections when combining scopes - so we can maintain insertion order as well as possible. If this isn't good enough we might need some atomic counter we increment for each breadcrumb. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in #3355 |
||
return timestamp.compareTo(o.timestamp); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,7 @@ public void setTag(@NotNull String key, @NotNull String value) { | |
|
||
@Override | ||
public void removeTag(@NotNull String key) { | ||
// TODO should this go to all scopes? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleting certain things from scope can be tricky with new API since deletions might go to the wrong scope. Maybe we should just delete from all scopes. On the other hand a user might just want to shadow something temporarily so maybe deleting everywhere isn't wanted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When calling removeX on current scope where scope has been forked since adding e.g. the tag in a parent scope, the remove only removes it from the current scope, not from the parent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, yeah that's tricky! When retrieving scope values we then would need to change the behavior as well. From ~ return current.value ?: scope.value ?: global.value To something like this ~ return if (current.isSet) {
current.value // can still be null
} else if (scope.isSet) {
scope.value
} else {
global.value
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree on not removing from all and making it behave the same way Not so sure about setting As a workaround for users actually wanting to clear certain values from all scopes, we could offer a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If users want to shadow something in the sense of temporarily unsetting, we'd have to use |
||
getDefaultWriteScope().removeTag(key); | ||
} | ||
|
||
|
@@ -256,6 +257,7 @@ public void setExtra(@NotNull String key, @NotNull String value) { | |
|
||
@Override | ||
public void removeExtra(@NotNull String key) { | ||
// TODO should this go to all scopes? | ||
getDefaultWriteScope().removeExtra(key); | ||
} | ||
|
||
|
@@ -305,10 +307,12 @@ public void setContexts(@NotNull String key, @NotNull Character value) { | |
|
||
@Override | ||
public void removeContexts(@NotNull String key) { | ||
// TODO should this go to all scopes? | ||
getDefaultWriteScope().removeContexts(key); | ||
} | ||
|
||
private @NotNull IScope getDefaultWriteScope() { | ||
// TODO use Scopes.getSpecificScope? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in #3361 |
||
if (ScopeType.CURRENT.equals(getOptions().getDefaultScopeType())) { | ||
return scope; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ | |
public enum ScopeType { | ||
CURRENT, | ||
ISOLATION, | ||
GLOBAL; | ||
GLOBAL, | ||
|
||
// TODO do we need a combined as well so configureScope | ||
COMBINED; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would allow users to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use case would be relevant for reading data from the scope right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, cross platform SDKs (via |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,6 +363,7 @@ public void endSession() { | |
} | ||
|
||
private IScope getCombinedScopeView() { | ||
// TODO create in ctor? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in #3361 |
||
return new CombinedScopeView(getGlobalScope(), isolationScope, scope); | ||
} | ||
|
||
|
@@ -428,6 +429,7 @@ public void addBreadcrumb(final @NotNull Breadcrumb breadcrumb, final @Nullable | |
} | ||
|
||
private IScope getSpecificScope(final @Nullable ScopeType scopeType) { | ||
// TODO extract and reuse | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in #3361 |
||
if (scopeType != null) { | ||
switch (scopeType) { | ||
case CURRENT: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows us to write:
and rely on
AutoClosable
to clean up scopes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 why do you have to disable this warning? Does it complain every time you're not using the API with a try block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It complains about not using the variable (called
ignored
here) inside thetry {}
block.