Skip to content
Open
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 bin/zkEnv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ for d in "$ZOOBINDIR"/../zookeeper-metrics-providers/zookeeper-prometheus-metric
CLASSPATH="$d:$CLASSPATH"
done

#make it work for developers
for d in "$ZOOBINDIR"/../zookeeper-metrics-providers/zookeeper-timeline-metrics/target/lib/*.jar; do
CLASSPATH="$d:$CLASSPATH"
done

#make it work for developers
CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"

Expand All @@ -122,6 +127,9 @@ CLASSPATH="$ZOOBINDIR/../zookeeper-server/target/classes:$CLASSPATH"
#make it work for developers
CLASSPATH="$ZOOBINDIR/../zookeeper-metrics-providers/zookeeper-prometheus-metrics/target/classes:$CLASSPATH"

#make it work for developers
CLASSPATH="$ZOOBINDIR/../zookeeper-metrics-providers/zookeeper-timeline-metrics/target/classes:$CLASSPATH"

case "$(uname)" in
CYGWIN* | MINGW*) cygwin=true ;;
*) cygwin=false ;;
Expand Down
5 changes: 5 additions & 0 deletions zookeeper-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
<artifactId>zookeeper-prometheus-metrics</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-timeline-metrics</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-recipes</artifactId>
Expand Down
37 changes: 37 additions & 0 deletions zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,43 @@ options are used to configure the [AdminServer](#sc_adminserver).
The enabled protocols to be used in TLS negotiation for PrometheusMetricsProvider.
Default value is Jetty default.

#### Timeline Metrics Provider

**New in 3.10.0:** ZooKeeper includes integration with Timeline-based metrics collection systems
such as Apache Ambari Metrics Collector.

The Timeline Metrics Provider uses a push-based model, actively sending metrics to a collector at
regular intervals, unlike Prometheus which uses a pull-based model.

* *metricsProvider.className* :
Set to "org.apache.zookeeper.metrics.timeline.TimelineMetricsProvider" to
enable Timeline metrics exporter.

* *metricsProvider.timeline.sink.class* :
The fully qualified class name of the sink implementation that sends metrics
to your Timeline Metrics Collector. The class must implement the
`org.apache.zookeeper.metrics.timeline.TimelineMetricsSink` interface and
be available on the ZooKeeper classpath.
Default: "org.apache.hadoop.metrics2.sink.timeline.ZooKeeperTimelineMetricsSink"

* *metricsProvider.timeline.collection.period* :
The interval in seconds at which metrics are collected and sent to the collector.
Default value is 60 seconds.

* *metricsProvider.timeline.hostname* :
The hostname to be reported in the metrics. If not specified, the system hostname
will be automatically detected.

* *metricsProvider.timeline.appId* :
The application ID to identify this ZooKeeper instance in the metrics system.
Default value is "zookeeper".

**Note:** Additional configuration properties with the `metricsProvider.timeline.` prefix
(such as collector hosts, ports, protocols, SSL settings) are passed directly to the sink
implementation. These properties are sink-specific and depend on your metrics collection
system. Refer to your sink implementation documentation (e.g., Ambari Metrics Sink) for
available configuration options.

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

### Communication using the Netty framework
Expand Down
40 changes: 40 additions & 0 deletions zookeeper-docs/src/main/resources/markdown/zookeeperMonitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ limitations under the License.
* [Prometheus](#Prometheus)
* [Alerting with Prometheus](#Alerting)
* [Grafana](#Grafana)
* [Timeline Metrics](#Timeline-Metrics)
* [InfluxDB](#influxdb)

* [JMX](#JMX)
Expand Down Expand Up @@ -263,6 +264,45 @@ To verify raise the log level of PrometheusMetricsProvider to DEBUG and check th
- Then download and import the default ZooKeeper dashboard [template](https://grafana.com/grafana/dashboards/10465) and customize.
- Users can ask for Grafana dashboard account if having any good improvements by writing a email to **dev@zookeeper.apache.org**.

<a name="Timeline-Metrics"></a>

### Timeline Metrics

**New in 3.10.0:** ZooKeeper supports integration with Timeline-based metrics collection systems
such as Apache Ambari Metrics Collector.

### Pre-requisites:
- The Timeline Metrics Provider requires a sink implementation to connect to your metrics collector.
For Ambari Metrics, you'll need the Ambari Metrics Hadoop Sink library in the ZooKeeper classpath.

- Enable the `Timeline MetricsProvider` by setting the following in `zoo.cfg`:
```conf
metricsProvider.className=org.apache.zookeeper.metrics.timeline.TimelineMetricsProvider
metricsProvider.timeline.sink.class=org.apache.hadoop.metrics2.sink.timeline.ZooKeeperTimelineMetricsSink
```

- Configure the collection period (in seconds):
```conf
metricsProvider.timeline.collection.period=60 # Default is 60 seconds
```

- Optionally configure hostname and application ID:
```conf
metricsProvider.timeline.hostname=zk1.example.com # Auto-detected if not specified
metricsProvider.timeline.appId=zookeeper # Default is "zookeeper"
```

- Additional sink-specific configuration properties can be added with the `metricsProvider.timeline.` prefix.
These are passed directly to the sink implementation. For example, Ambari Metrics Sink supports:
```conf
metricsProvider.timeline.collector.hosts=collector.example.com
metricsProvider.timeline.collector.protocol=http
metricsProvider.timeline.collector.port=6188
```

**Note:** Unlike Prometheus which uses a pull-based model, the Timeline Metrics Provider actively
pushes metrics to the collector at the configured interval.

<a name="influxdb"></a>

### InfluxDB
Expand Down
1 change: 1 addition & 0 deletions zookeeper-metrics-providers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

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

</project>
99 changes: 99 additions & 0 deletions zookeeper-metrics-providers/zookeeper-timeline-metrics/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?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.10.0-SNAPSHOT</version>
</parent>

<artifactId>zookeeper-timeline-metrics</artifactId>
<packaging>jar</packaging>
<name>Apache ZooKeeper - Timeline Metrics Provider</name>
<description>ZooKeeper Timeline Metrics Provider implementation</description>

<properties>
<!-- No external dependencies required - pure JDK implementation -->
</properties>
<dependencies>
<!-- Core ZooKeeper dependency for metrics interfaces -->
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${project.version}</version>
</dependency>

<!-- SLF4J for logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>

<!-- Dropwizard Metrics - needed for AvgMinMaxPercentileCounter -->
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<scope>test</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeTransitive>false</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading