Skip to content

Add Metrics#68

Open
renaz6 wants to merge 4 commits intomainfrom
addMetrics
Open

Add Metrics#68
renaz6 wants to merge 4 commits intomainfrom
addMetrics

Conversation

@renaz6
Copy link
Member

@renaz6 renaz6 commented Mar 2, 2026

Closes #26

@renaz6 renaz6 requested a review from piccione99 March 2, 2026 17:45
@renaz6 renaz6 requested a review from piccione99 March 4, 2026 20:31
if p.config.maxBufferedRecords > 0 {
p.metricEmitter.Notify(metrics.Event{
Name: metrics.KafkaBufferUtilization,
Value: 0, // Initial value
Copy link
Contributor

Choose a reason for hiding this comment

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

this metric currently doesn't do anything and will always return 0. The way it's set up in talaria is the gauge function will be called for every prometheus scrape. metrics.go sets up a default GaugeFunction that does basically nothing by default other than a nil check to see if the real gaugeFunction has been set.

https://github.com/xmidt-org/talaria/blob/main/metrics.go#L392

Then publisher.go conditionally sets up the actual gauge function on Start:

https://github.com/xmidt-org/talaria/blob/main/publisher.go#L274

The reason the gaugeFunc can't be set until later is because it needs the publisher to be created for the BufferedRecords call.

Copy link
Contributor

@piccione99 piccione99 left a comment

Choose a reason for hiding this comment

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

see inline - publisher.go, line 143

piccione99
piccione99 previously approved these changes Mar 5, 2026
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.

Implement Metrics for the Handler and Publisher

2 participants