Skip to content

ZOOKEEPER-5036: Add Timeline Metrics Provider for external metrics collection systems#2371

Open
himanshumaurya09876 wants to merge 1 commit intoapache:masterfrom
himanshumaurya09876:zookeeper-5036
Open

ZOOKEEPER-5036: Add Timeline Metrics Provider for external metrics collection systems#2371
himanshumaurya09876 wants to merge 1 commit intoapache:masterfrom
himanshumaurya09876:zookeeper-5036

Conversation

@himanshumaurya09876
Copy link
Copy Markdown

Added a new Timeline Metrics Provider that enables ZooKeeper to export metrics to external Timeline-based metrics collection systems such as Apache Ambari Metrics Collector and YARN Timeline Service.
Validated it using Ambari Metrics, I was able to receive Zookeeper Metrics in Ambari and visualise it on Grafana dashboards.
Jira :- ZOOKEEPER-5036

@himanshumaurya09876
Copy link
Copy Markdown
Author

/build

@himanshumaurya09876
Copy link
Copy Markdown
Author

Hi @anmolnar @PDavid
Kindly review and merge this PR.

Copy link
Copy Markdown
Contributor

@PDavid PDavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks, looks really nice already. 👍

I really like the clean separation of concerns: Provider/Sink/Snapshot are well-decomposed. 💪

Can you please add unit tests for the new classes?

Also, in order to be able to load the metrics provider when running from the source clone, we have to add it to the classpath. See:

<parent>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper-metrics-providers</artifactId>
<version>3.9.3</version>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this match with other projects to refer to 3.10.0-SNAPSHOT?

Suggested change
<version>3.9.3</version>
<version>3.10.0-SNAPSHOT</version>

This also seems to cause Maven compilation problem.

/**
* Returns all counter metrics in this snapshot.
*
* @return an unmodifiable view of the counters map
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This claims to return "an unmodifiable view" but return the raw HashMap directly. Should be wrapped with Collections.unmodifiableMap() or remove this claim here?

The same applies to getGauges(), getSummaries().

Comment on lines +393 to +395
* <p>This context reuses existing metric implementations from zookeeper-server
* (SimpleCounter, AvgMinMaxCounter, etc.) to ensure consistent behavior with
* other metrics providers.</p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you reused the existing metric classes (SimpleCounter, AvgMinMaxCounter, etc.) 👍

Comment on lines +157 to +160
LOG.warn("Timeline sink class not found: {}. Timeline metrics will be disabled. "
+ "To enable Timeline metrics, ensure the sink implementation JAR is available on the classpath. "
+ "ZooKeeper will continue to operate normally without Timeline metrics.", sinkClassName);
this.sink = null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I see when the sink class isn't found, the provider logs a warning but continues. It can be like that but PrometheusMetricsProvider throws an Exception when misconfigured and ZooKeeper will fail to start. Would it maybe make sense to be consistent in behavior? What do you all think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants