Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Append error tag to the histogram of duration (#74)
Browse files Browse the repository at this point in the history
* Append error tag to the histogram of duration

* Use seperate map
  • Loading branch information
haosong authored and sushantdewan123 committed Aug 26, 2019
1 parent 8918c26 commit 98c3869
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/com/wavefront/opentracing/WavefrontTracer.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,15 @@ void reportWavefrontGeneratedData(WavefrontSpan span) {
wfDerivedReporter.newCounter(new MetricName(sanitize(metricNamePrefix + TOTAL_TIME_SUFFIX),
pointTags)).inc(spanDurationMicros / 1000);
// Support duration in microseconds instead of milliseconds
wfDerivedReporter.newWavefrontHistogram(new MetricName(sanitize(metricNamePrefix + DURATION_SUFFIX),
pointTags)).update(spanDurationMicros);
if (span.isError()) {
Map<String, String> errorPointTags = new HashMap<>(pointTags);
errorPointTags.put("error", "true");
wfDerivedReporter.newWavefrontHistogram(new MetricName(sanitize(metricNamePrefix + DURATION_SUFFIX),
errorPointTags)).update(spanDurationMicros);
} else {
wfDerivedReporter.newWavefrontHistogram(new MetricName(sanitize(metricNamePrefix + DURATION_SUFFIX),
pointTags)).update(spanDurationMicros);
}
}

private String overrideWithSingleValuedSpanTag(WavefrontSpan span, Map<String, String> pointTags,
Expand Down

0 comments on commit 98c3869

Please sign in to comment.