-
Notifications
You must be signed in to change notification settings - Fork 521
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
Add new formatting function "add" #2507
Add new formatting function "add" #2507
Conversation
2a6307c
to
a7f3493
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2507 +/- ##
=======================================
Coverage 96.62% 96.63%
=======================================
Files 255 255
Lines 7707 7719 +12
Branches 2003 2004 +1
=======================================
+ Hits 7447 7459 +12
Misses 260 260 ☔ View full report in Codecov by Sentry. |
As described the use case doesn't make sense to me. How does an operator of Jaeger install know what possible time skew might exist? I can see the other use case: you want to see the logs from +-1min of the span timestamp, and need to transform the ts into an interval. If that's what you meant please update the description. As far as implementation, can this be simply an "add" function? It does not care about the units (up to the user), and by allowing negative arguments it can adjust ts in either direction. |
Yes this is what I meant. Will update. Good point about it just being add. Will rename to be more generic |
Signed-off-by: Drew Corlin <[email protected]>
8e2ef57
to
95ae9bd
Compare
} | ||
return (val: T) => formatFunction(val, ...args); | ||
}) | ||
.filter((fn): fn is NonNullable<typeof fn> => fn !== null); |
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.
odd statement, NonNullable is compared against null?
I think you could use flatMap() instead and return []
in cases of errors such that it will be automatically skipped
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 is a type predicate which says that it returns a boolean indicating if fn
is non-null. It may make more sense reading it with a curly brace-wrapped function body
.filter((fn): fn is NonNullable<typeof fn> => {
return fn !== null;
});
I could use flatMap, but would just add more allocations for the same behavior right?
2ede5ab
to
e8a2944
Compare
Signed-off-by: Drew Corlin <[email protected]>
e8a2944
to
0aa811b
Compare
I don't think I can add labels. @yurishkuro would you be able to add the "changelog:bugfix-or-minor-feature" label (or whatever you deem appropriate) |
Which problem is this PR solving?
In addition to #2501 and #2504, allowing any numbers (in my immediate case a date in microseconds since epoch) to be offset by a number is useful to allow users to see logs before/after their span/trace timestamps by a configurable offset.
Description of the changes
This adds a
add
function and gives the ability to chain formatting functions together (eg#{endTime | add 60000000 | epoch_micros_to_date_iso}
)How was this change tested?
Unit tests and with the following UI config
Checklist
jaeger-ui
:yarn lint
andyarn test