Skip to content

Commit

Permalink
Merge pull request #2839 from atlanhq/metric-hist-idxsrch
Browse files Browse the repository at this point in the history
fix: publish 70 histograms to avoid wrong approximation
  • Loading branch information
sumandas0 authored Feb 8, 2024
2 parents 17ce28f + 5c5787f commit 30d6c28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface MetricsRegistry {

void collect(String requestId, String requestUri, AtlasPerfMetrics metrics);

void collect(String requestId, String requestUri, List<AtlasPerfMetrics.Metric> applicationMetrics);
void collectIndexsearch(String requestId, String requestUri, List<AtlasPerfMetrics.Metric> applicationMetrics);

void scrape(PrintWriter writer) throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,11 @@ public void collect(String requestId, String requestUri, AtlasPerfMetrics metric
}
}
//Use this if you want to publish Histograms
public void collect(String requestId, String requestUri, List<AtlasPerfMetrics.Metric> applicationMetrics){
public void collectIndexsearch(String requestId, String requestUri, List<AtlasPerfMetrics.Metric> applicationMetrics){
try {
for(AtlasPerfMetrics.Metric metric : applicationMetrics){
Timer.builder(APPLICATION_LEVEL_METRICS_SUMMARY)
.serviceLevelObjectives(
Duration.ofMillis(500),
Duration.ofMillis(750),
Duration.ofMillis(1000),
Duration.ofMillis(1500),
Duration.ofSeconds(2),
Duration.ofSeconds(3),
Duration.ofSeconds(5),
Duration.ofSeconds(10),
Duration.ofSeconds(15)
)
.publishPercentileHistogram()
.publishPercentiles(PERCENTILES)
.tags(convertToMicrometerTags(metric.getTags()))
.register(getMeterRegistry()).record(metric.getTotalTimeMSecs(), TimeUnit.MILLISECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void clearCache() {
}
if (CollectionUtils.isNotEmpty(applicationMetrics)) {
if (Objects.nonNull(this.metricsRegistry)){
this.metricsRegistry.collect(traceId, this.requestUri, applicationMetrics);
this.metricsRegistry.collectIndexsearch(traceId, this.requestUri, applicationMetrics);
}
applicationMetrics.clear();
}
Expand Down

0 comments on commit 30d6c28

Please sign in to comment.