Class IipEcospherePrometheusExporter
java.lang.Object
de.iip_ecosphere.platform.monitoring.MonitoringReceiver
de.iip_ecosphere.platform.monitoring.prometheus.IipEcospherePrometheusExporter
public class IipEcospherePrometheusExporter
extends de.iip_ecosphere.platform.monitoring.MonitoringReceiver
Observes IIP-Ecosphere standard transport channels and feeds the information into Prometheus. [public for testing]
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classExhibits creating a custom meter.protected classImplements a specialized exporter for prometheus.private static classThe default metrics servlet.static classA simple metrics servlet for a given local, bridged metrics registry.Nested classes/interfaces inherited from class de.iip_ecosphere.platform.monitoring.MonitoringReceiver
de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.catalina.Contextstatic final Stringstatic final Stringprivate static final io.micrometer.core.instrument.config.MeterFilter[]private Supplier<ConfigModifier> private intprivate org.apache.catalina.startup.Tomcatprivate File -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddServlet(String id, javax.servlet.Servlet servlet) Adds a servlet to the tomcat instance.protected de.iip_ecosphere.platform.monitoring.MonitoringReceiver.ExportercreateExporter(String id) private StringReturns the servlet mapping path.protected voidnotifyExporterAdded(de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter exporter) protected voidnotifyExporterRemoved(de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter exporter) protected voidremoveServlet(String id) Removes the given servlet from the server container.voidsetModifierSupplier(Supplier<ConfigModifier> modifier) Defines the modifier supplier.voidstart()voidstop()private voidChanges the prometheus configuration for modified scrape setup.Methods inherited from class de.iip_ecosphere.platform.monitoring.MonitoringReceiver
exporters, notifyMeterAdded, notifyMeterReception, notifyStatusReceived, obtainExporter
-
Field Details
-
DEFAULT_METRICS_SERVLET_NAME
- See Also:
-
DEFAULT_METRICS_ENDPOINT
- See Also:
-
METER_FILTERS
private static final io.micrometer.core.instrument.config.MeterFilter[] METER_FILTERS -
server
private org.apache.catalina.startup.Tomcat server -
context
private org.apache.catalina.Context context -
modifier
-
port
private int port -
webapps
-
-
Constructor Details
-
IipEcospherePrometheusExporter
public IipEcospherePrometheusExporter()Creates a prometheus exporter.- See Also:
-
-
Method Details
-
setModifierSupplier
Defines the modifier supplier.- Parameters:
modifier- the modifier supplier
-
start
public void start()- Overrides:
startin classde.iip_ecosphere.platform.monitoring.MonitoringReceiver
-
stop
public void stop()- Overrides:
stopin classde.iip_ecosphere.platform.monitoring.MonitoringReceiver
-
addServlet
Adds a servlet to the tomcat instance. Tomcat must at least be initialized:- Parameters:
id- the id of the servlet, also used for the pathservlet- the servlet instance- Returns:
- the path to the servlet
-
getPath
Returns the servlet mapping path.- Parameters:
id- the servlet id- Returns:
- the mapping path
-
removeServlet
Removes the given servlet from the server container.- Parameters:
id- the servlet id
-
createExporter
protected de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter createExporter(String id) - Specified by:
createExporterin classde.iip_ecosphere.platform.monitoring.MonitoringReceiver
-
notifyExporterAdded
protected void notifyExporterAdded(de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter exporter) - Overrides:
notifyExporterAddedin classde.iip_ecosphere.platform.monitoring.MonitoringReceiver
-
notifyExporterRemoved
protected void notifyExporterRemoved(de.iip_ecosphere.platform.monitoring.MonitoringReceiver.Exporter exporter) - Overrides:
notifyExporterRemovedin classde.iip_ecosphere.platform.monitoring.MonitoringReceiver
-
writeScrapeConfig
private void writeScrapeConfig()Changes the prometheus configuration for modified scrape setup.
-