use of org.hyperledger.besu.metrics.opentelemetry.OpenTelemetrySystem in project besu by hyperledger.
the class MetricsSystemFactory method create.
/**
* Creates and starts a new metric system to observe the behavior of the client
*
* @param metricsConfiguration the configuration of the metric system
* @return a new metric system
*/
public static ObservableMetricsSystem create(final MetricsConfiguration metricsConfiguration) {
LOG.trace("Creating a metric system with {}", metricsConfiguration.getProtocol());
if (!metricsConfiguration.isEnabled() && !metricsConfiguration.isPushEnabled()) {
return new NoOpMetricsSystem();
}
if (PROMETHEUS.equals(metricsConfiguration.getProtocol())) {
final PrometheusMetricsSystem metricsSystem = new PrometheusMetricsSystem(metricsConfiguration.getMetricCategories(), metricsConfiguration.isTimersEnabled());
metricsSystem.init();
return metricsSystem;
} else if (OPENTELEMETRY.equals(metricsConfiguration.getProtocol())) {
final OpenTelemetrySystem metricsSystem = new OpenTelemetrySystem(metricsConfiguration.getMetricCategories(), metricsConfiguration.isTimersEnabled(), metricsConfiguration.getPrometheusJob());
metricsSystem.initDefaults();
return metricsSystem;
} else {
throw new IllegalArgumentException("Invalid metrics protocol " + metricsConfiguration.getProtocol());
}
}
Aggregations