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

Improve gorouter Route Registry Message Metrics #456

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

hoffmaen
Copy link
Contributor

@hoffmaen hoffmaen commented Dec 12, 2024

Summary
Solution for cloudfoundry/routing-release#445.

Backward Compatibility

Breaking Change? No - metrics and log messages for route registry are renamed though.

@hoffmaen hoffmaen force-pushed the route-registry-metrics branch from efa7e82 to 8c017fb Compare December 12, 2024 13:49
@hoffmaen hoffmaen marked this pull request as ready for review December 13, 2024 08:35
@hoffmaen hoffmaen requested a review from a team as a code owner December 13, 2024 08:35
Copy link
Contributor

@peanball peanball left a comment

Choose a reason for hiding this comment

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

most important comment: route registration logging for any result is now Info level and will cause significant increase in logs in production. Please change it back to debug level output for "refreshes" and "no-ops".

Some other smaller suggestions are there but not vital.

metrics/metricsreporter.go Outdated Show resolved Hide resolved
}
m.Batcher.BatchIncrementCounter(componentName)
Copy link
Contributor

Choose a reason for hiding this comment

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

is this equivalent to the previously used m.Sender.IncrementCounter(componentName)?

registry/registry.go Outdated Show resolved Hide resolved
registry/registry.go Outdated Show resolved Hide resolved
Comment on lines 148 to 160
func (m *MetricsReporter) CaptureUnregistryMessage(msg ComponentTagged) {
var componentName string
if msg.Component() == "" {
componentName = "unregistry_message"
} else {
componentName = "unregistry_message." + msg.Component()
}
err := m.Sender.IncrementCounter(componentName)
if err != nil {
m.Logger.Debug("failed-sending-metric", log.ErrAttr(err), slog.String("metric", componentName))
}
}

Copy link
Member

Choose a reason for hiding this comment

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

This would change existing metrics, I don't think we should do this.

Copy link
Contributor

@peanball peanball Dec 16, 2024

Choose a reason for hiding this comment

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

just for my understanding:

Would you then want to have the "old" total metric and new breakdown metrics in addition?

Something like this?

registry_message: 100
registry_message.endpoint-registered: 5
registry_message.endpoint-updated: 94
registry_message.endpoint-unregistered: 1

Copy link
Member

Choose a reason for hiding this comment

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

What I mean is that this change:

https://github.com/cloudfoundry/gorouter/pull/456/files#diff-5593a38c8a92809ab9448ee33f120e244e7fc4c0fd0689e239a9e85dc4ae0933L173-R188

will change the emitted metrics for unregister messages from unregistry_message.* to registry_message.*. This would be a breaking change which doesn't seem to provide much value and could be avoided.

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right. We changed it back.

@b1tamara b1tamara force-pushed the route-registry-metrics branch from fae675a to ab6772f Compare December 18, 2024 09:44
@b1tamara b1tamara force-pushed the route-registry-metrics branch from ab6772f to ef4bebb Compare December 18, 2024 09:51
@peanball peanball dismissed their stale review December 18, 2024 11:30

New commits

componentName = "registry_message." + msg.Component()
componentName = "registry_message." + action + "." + msg.Component()
Copy link
Member

@maxmoehl maxmoehl Dec 18, 2024

Choose a reason for hiding this comment

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

This will probably also change the metric name right? I was hoping that we could preserve the metric name but only add an additional tag to it.

Copy link
Member

Choose a reason for hiding this comment

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

This is what I had in mind. But it seems like the API is a bit cumbersome to use...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants