Skip to content
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

ZOOKEEPER-3091 Prometheus.io Metrics Provider #977

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions conf/zoo_sample.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ clientPort=2181
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<module>zookeeper-docs</module>
<module>zookeeper-jute</module>
<module>zookeeper-server</module>
<module>zookeeper-metrics-providers</module>
<module>zookeeper-client</module>
<module>zookeeper-recipes</module>
<module>zookeeper-assembly</module>
Expand Down
5 changes: 5 additions & 0 deletions zookeeper-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-prometheus-metrics</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-recipes</artifactId>
Expand Down
23 changes: 23 additions & 0 deletions zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,29 @@ options are used to configure the [AdminServer](#sc_adminserver).
The URL for listing and issuing commands relative to the
root URL. Defaults to "/commands".

### Metrics Providers

**New in 3.6.0:** The following options are used to configure metrics.

By default ZooKeeper server exposes useful metrics using the [AdminServer](#sc_adminserver).
and [Four Letter Words](#sc_4lw) interface.

Since 3.6.0 you can configure a different Metrics Provider, that exports metrics
to your favourite system.

Since 3.6.0 ZooKeeper binary package bundles an integration with [Prometheus.io](https://prometheus.io)

* *metricsProvider.className* :
Set to "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider" to
enable Prometheus.io exporter.

* *metricsProvider.httpPort* :
Prometheus.io exporter will start a Jetty server and bind to this port, it default to 7000.
Prometheus end point will be http://hostname:httPort/metrics.

* *metricsProvider.exportJvmInfo* :
If this property is set to **true** Prometheus.io will export useful metrics about the JVM.
The default is true.

<a name="Communication+using+the+Netty+framework"></a>

Expand Down
40 changes: 40 additions & 0 deletions zookeeper-metrics-providers/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.zookeeper</groupId>
<artifactId>parent</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-metrics-providers</artifactId>
<packaging>pom</packaging>
<name>Apache ZooKeeper - Metrics Providers</name>
<description>ZooKeeper Metrics Providers</description>

<modules>
<module>zookeeper-prometheus-metrics</module>
</modules>

</project>
86 changes: 86 additions & 0 deletions zookeeper-metrics-providers/zookeeper-prometheus-metrics/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-metrics-providers</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-prometheus-metrics</artifactId>
<packaging>jar</packaging>
<name>Apache ZooKeeper - Prometheus.io Metrics Provider</name>
<description>ZooKeeper Prometheus.io Metrics Provider implementation</description>

<properties>
<prometheus.version>0.6.0</prometheus.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<!-- we can create a metrics-providers-api package
once we get rid of ant based build
https://issues.apache.org/jira/browse/ZOOKEEPER-3376
-->
<artifactId>zookeeper</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>${prometheus.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>${prometheus.version}</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_servlet</artifactId>
<version>${prometheus.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Loading