fix finding SpanExporterFactory by exporterName with underscore e.g. "otlp_span" (#1404)

* #1401 fix finding SpanExporterFactory by exporterName with underscore e.g. "otlp_span"

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>

* #1401 change exporterName of "otlp_span" and "otlp_metric" only

Signed-off-by: Sergei Malafeev <sergei@malafeev.org>
This commit is contained in:
Sergei Malafeev 2020-10-20 19:51:07 +08:00 committed by GitHub
parent a5aba2d8f5
commit 1674b46d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -93,9 +93,8 @@ public class TracerInstaller {
if (metricExporterFactory if (metricExporterFactory
.getClass() .getClass()
.getSimpleName() .getSimpleName()
.replace("_", "")
.toLowerCase() .toLowerCase()
.startsWith(exporterName.toLowerCase())) { .startsWith(exporterName(exporterName).toLowerCase())) {
return metricExporterFactory; return metricExporterFactory;
} }
} }
@ -110,9 +109,8 @@ public class TracerInstaller {
if (metricServer if (metricServer
.getClass() .getClass()
.getSimpleName() .getSimpleName()
.replace("_", "")
.toLowerCase() .toLowerCase()
.startsWith(exporterName.toLowerCase())) { .startsWith(exporterName(exporterName).toLowerCase())) {
return metricServer; return metricServer;
} }
} }
@ -127,15 +125,18 @@ public class TracerInstaller {
if (spanExporterFactory if (spanExporterFactory
.getClass() .getClass()
.getSimpleName() .getSimpleName()
.replace("_", "")
.toLowerCase() .toLowerCase()
.startsWith(exporterName.toLowerCase())) { .startsWith(exporterName(exporterName).toLowerCase())) {
return spanExporterFactory; return spanExporterFactory;
} }
} }
return null; return null;
} }
private static String exporterName(String exporterName) {
return exporterName.replace("otlp_span", "otlpspan").replace("otlp_metric", "otlpmetric");
}
private static synchronized void installExportersFromJar(String exporterJar, Properties config) { private static synchronized void installExportersFromJar(String exporterJar, Properties config) {
URL url; URL url;
try { try {