-
Notifications
You must be signed in to change notification settings - Fork 873
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
Micrometer instrumentation, part 2 #5001
Micrometer instrumentation, part 2 #5001
Conversation
new OpenTelemetryDistributionSummary( | ||
id, clock, distributionStatisticConfig, scale, otelMeter); | ||
if (distributionSummary.isUsingMicrometerHistograms()) { | ||
HistogramGauges.registerWithCommonFormat(distributionSummary, this); |
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.
ah, this is the magic that registers the internal gauges back with our meter registry
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.
Yep, exactly!
...java/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/AsyncInstrumentRegistry.java
Show resolved
Hide resolved
countMeterName = id.getName() + "." + Statistic.COUNT.getTagValueRepresentation(); | ||
totalTimeMeterName = id.getName() + "." + Statistic.TOTAL_TIME.getTagValueRepresentation(); | ||
|
||
asyncInstrumentRegistry.buildLongCounter( |
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.
@jack-berg I think this is a good use case for an async batch API
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.
What advantage do you seek from a batch API vs the existing API here?
} | ||
|
||
void removeDoubleCounter(String name, Attributes attributes) { | ||
synchronized (doubleCounters) { |
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.
#nit: can move the synchronization to inside removeMeasurement
to DRY up the code a bit.
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.
Unfortunately errorprone doesn't allow to compile it (because of @GuardedBy
), so I have to duplicate this synchronized
block.
@Override | ||
public double max() { | ||
UnsupportedReadLogger.logWarning(); | ||
return Double.NaN; |
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.
Do you want to return Double.NaN
here or 0
?
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.
I think I would prefer returning NaN
everywhere - since it clearly implies that the value returned by this method should not ever be used.
@Override | ||
public double totalTime(TimeUnit unit) { | ||
UnsupportedReadLogger.logWarning(); | ||
return Double.NaN; |
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.
Double.NaN
or 0?
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.
See #5001 (comment)
...a/io/opentelemetry/javaagent/instrumentation/micrometer/v1_5/OpenTelemetryFunctionTimer.java
Outdated
Show resolved
Hide resolved
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.
Couple of minor comments but looks good.
bbcd54d
to
94cdb9a
Compare
Merged that PR to unblock the next one (since there's a couple of approvals here); if you have any further comments, don't hesitate to add them here - I can address them in later PRs. |
* Micrometer instrumentation, part 2 * use double counter instead of gauge in FunctionTimer * code review suggestions * fix errorprone * rebase and fix compilation failure
Continuation of #4919
This PR contains the implementations of following micrometer instruments:
DistributionSummary
FunctionCounter
FunctionTimer
LongTaskTimer
and customMeter
are still missing, they'll be added in the next PR.