-
Notifications
You must be signed in to change notification settings - Fork 674
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
SOLR-17587: Prometheus Writer duplicate TYPE information in exposition format #2902
base: main
Are you sure you want to change the base?
Changes from all commits
f27803e
5e07534
8abef07
286911b
cf3b2e0
b553839
ed482ab
3ae9106
b700157
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,12 +25,11 @@ | |
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.lang.invoke.MethodHandles; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Consumer; | ||
import java.util.function.Predicate; | ||
import java.util.stream.Collectors; | ||
import org.apache.solr.common.SolrException; | ||
import org.apache.solr.common.util.NamedList; | ||
import org.apache.solr.metrics.AggregateMetric; | ||
import org.apache.solr.metrics.prometheus.SolrPrometheusFormatter; | ||
|
@@ -115,30 +114,22 @@ public static void toPrometheus( | |
Metric dropwizardMetric = dropwizardMetrics.get(metricName); | ||
formatter.exportDropwizardMetric(dropwizardMetric, metricName); | ||
} catch (Exception e) { | ||
// Do not fail entirely for metrics exporting. Log and try to export next metric | ||
log.warn("Error occurred exporting Dropwizard Metric to Prometheus", e); | ||
throw new SolrException( | ||
SolrException.ErrorCode.SERVER_ERROR, | ||
"Error occurred exporting Dropwizard Metric to Prometheus", | ||
e); | ||
Comment on lines
+117
to
+120
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. Also wanted to mention this. I was thinking to just remove the |
||
} | ||
}); | ||
|
||
consumer.accept(formatter); | ||
} | ||
|
||
public static SolrPrometheusFormatter getFormatterType(String registryName) { | ||
String coreName; | ||
boolean cloudMode = false; | ||
String[] parsedRegistry = registryName.split("\\."); | ||
|
||
switch (parsedRegistry[1]) { | ||
case "core": | ||
if (parsedRegistry.length == 3) { | ||
coreName = parsedRegistry[2]; | ||
} else if (parsedRegistry.length == 5) { | ||
coreName = Arrays.stream(parsedRegistry).skip(1).collect(Collectors.joining("_")); | ||
cloudMode = true; | ||
} else { | ||
coreName = registryName; | ||
} | ||
return new SolrPrometheusCoreFormatter(coreName, cloudMode); | ||
return new SolrPrometheusCoreFormatter(); | ||
case "jvm": | ||
return new SolrPrometheusJvmFormatter(); | ||
case "jetty": | ||
|
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.
when you do that, a little comment like
// chop off ___
would be really helpful to the readerThere 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.
Done!