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

feat: preregister libhoney metrics #716

Merged
merged 1 commit into from
Jun 16, 2023
Merged
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
15 changes: 15 additions & 0 deletions cmd/refinery/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ func main() {
upstreamMetricsRecorder := metrics.NewMetricsPrefixer("libhoney_upstream")
peerMetricsRecorder := metrics.NewMetricsPrefixer("libhoney_peer")

// these are the metrics that libhoney will emit; we preregister them so that they always appear
libhoneyMetricsName := map[string]string{
"queue_length": "gauge",
"queue_overflow": "counter",
"send_errors": "counter",
"send_retries": "counter",
"batches_sent": "counter",
"messages_sent": "counter",
"response_decode_errors": "counter",
Comment on lines +147 to +153
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little worried about keeping this list up-to-date as libhoney changes. Is there any way to expose a "register" method in libhoney to do this work for us?

I don't want to block on this, but would be nice in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hear that, but libhoney-go is old and really doesn't get new features any more. It did get a dependency bump 2 weeks ago, but the last change before that was last fall. I don't believe anyone but a small number of refinery users cares about this, and the backwards-compatible version of this change is kind of ugly.

}
for name, typ := range libhoneyMetricsName {
upstreamMetricsRecorder.Register(name, typ)
peerMetricsRecorder.Register(name, typ)
}

userAgentAddition := "refinery/" + version
upstreamClient, err := libhoney.NewClient(libhoney.ClientConfig{
Transmission: &transmission.Honeycomb{
Expand Down