-
Notifications
You must be signed in to change notification settings - Fork 582
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
Invalid connection pool Prometheus metric format (monitor, mpMetrics) #6058
Comments
@sdaschner , thanks very much for reporting this. Could you please cut/paste the info from your server.xml relevant to your datasource configuration as well? |
Sure: This is the <?xml version="1.0" encoding="UTF-8"?>
<server description="Config example">
<featureManager>
<feature>javaee-8.0</feature>
<feature>mpMetrics-1.1</feature>
<feature>monitor-1.0</feature>
</featureManager>
<!-- Postgres config-example-db definition -->
<dataSource id="DefaultDataSource" jdbcDriverRef="postgresql-driver"
type="javax.sql.ConnectionPoolDataSource" transactional="true">
<properties serverName="config-example-db" portNumber="5432"
databaseName="postgres"
user="${config-example.db.username}"
password="${config-example.db.password}"/>
</dataSource>
<httpEndpoint id="defaultHttpEndpoint" host="*" httpPort="9080" httpsPort="9443"/>
<keyStore id="defaultKeyStore" password="Liberty"/>
<basicRegistry id="basic" realm="MicroProfileMetrics">
<user name="admin" password="admin"/>
<user name="nonadmin" password="guest"/>
</basicRegistry>
<administrator-role>
<user>admin</user>
</administrator-role>
</server> And a file <?xml version="1.0" encoding="UTF-8"?>
<server description="OpenLiberty Java EE 8 Server">
<jdbcDriver id="postgresql-driver"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"
libraryRef="postgresql-library"/>
<library id="postgresql-library">
<fileset id="PostgreSQLFileset" dir="/opt/wlp/lib"
includes="postgresql-9.4.1212.jar"/>
</library>
</server>
|
The cause of the issue is the datasource with id 'DefaultDataSource''s auto-generated jndi name. It gets normalized to data_source[_default_data_source]_connection_manager in Prometheus, which broke the Prometheus format. We need to do some sanitizations of the jndi name to make sure the output will be in compliance with Prometheus format. A temporary workaround is to specify a jndiName field when configuring datasource in the server.xml. For example, the following datasource config will work
Thanks for catching the issue as it's a scenario missed from our tests. We'll target the fix for 19.0.0.1 |
Thanks for the quick response! Yes, the workaround solves this. |
Open Liberty version 18.0.0.4 emits datasource metrics in the Prometheus format under
/metrics
, if themonitor-1.0
, andmpMetrics-1.1
features are enabled.However, the metrics for the default datasource violate the Prometheus format:
This produces an error when Prometheus attempts to scrape the metrics under
/metrics
:invalid metric type "_default_data_source]_connection_manager_in_use_time_total_seconds gauge"
Tested with Open Liberty versions:
18.0.0.4-20181123-2100
and18.0.0.4-20181217-2101
.The invalid metrics format renders the whole Prometheus target unusable, unfortunately.
The text was updated successfully, but these errors were encountered: