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

grafananet: fix FlushSize metric #582

Merged
merged 2 commits into from
Jan 27, 2025
Merged

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Jan 22, 2025

In the grafananetrouter, the definition of the FlushSize metrics says its unit is Bytes. But the router's code observes the actual number of metrics sent out, which is also tracked by the unit=Metric.direction=out counter.

This PR fixes the router to track the number of bytes sent out to the destination with the request. This behaviour looks aligned with other routers, e.g. see KafkaMdm.

Signed-off-by: Vladimir Varankin <[email protected]>
@@ -338,9 +340,9 @@ func (route *GrafanaNet) retryFlush(metrics []*schema.MetricData, buffer *bytes.
// re-instantiate body, since the previous .Do() attempt would have Read it all the way
req.Body = ioutil.NopCloser(bytes.NewReader(body))
}
log.Debugf("GrafanaNet sent metrics in %s -msg size %d", dur, len(metrics))
log.Debugf("GrafanaNet sent %d metrics in %s -msg size %d", len(metrics), dur, len(metrics))
Copy link
Member

Choose a reason for hiding this comment

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

Aren't we printing the number of metrics twice in this message now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call — fixed

Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo requested a review from jesusvazquez January 27, 2025 18:14
Copy link
Member

@jesusvazquez jesusvazquez left a comment

Choose a reason for hiding this comment

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

LGTM!

@jesusvazquez jesusvazquez merged commit df6865f into main Jan 27, 2025
6 checks passed
@jesusvazquez jesusvazquez deleted the vldmr/grafananet-fix-flush-size branch January 27, 2025 20:47
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