Skip to content

Conversation

@AlexDCraig
Copy link
Contributor

@AlexDCraig AlexDCraig commented Jun 13, 2023

Adding RED metrics to cortex-tenant.

processor.go Outdated

var r result
r.code, r.body, r.err = p.send(clientIP, reqID, tenant, wrReq)
r.code, r.body, r.duration, r.err = p.send(clientIP, reqID, tenant, wrReq)
Copy link
Owner

@blind-oracle blind-oracle Jun 14, 2023

Choose a reason for hiding this comment

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

maybe we should switch to just return result struct here? too many fields returned already :)

processor.go Outdated
return
}

duration = float64(time.Since(start).Milliseconds())
Copy link
Owner

Choose a reason for hiding this comment

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

I guess since we anyway are using float64 then it's better to store seconds there, not milliseconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was made milliseconds because it's more likely for this value to be pretty small... I ripped this metric and buckets from the tool Istio

@blind-oracle
Copy link
Owner

Thanks! I've left a few small comments and have a bigger one - maybe we should also add tenant label to Prometheus so that we can actually see numbers per-tenant?

}()
}

go func() {
Copy link
Owner

Choose a reason for hiding this comment

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

There's already cfg.ListenPprof -> maybe we can use that instead of another hardcoded HTTP port? Maybe we can rename cfg.ListenPprof to something more general, like ListenAux or whatever. Or add additional config variable ListenMetrics and use that (with same default value of :9090)

@AlexDCraig
Copy link
Contributor Author

Thanks! I've left a few small comments and have a bigger one - maybe we should also add tenant label to Prometheus so that we can actually see numbers per-tenant?

We can offer it, but may I suggest making it configurable? Some folks may have lots of tenants which would cause a lot of metric cardinality

@blind-oracle
Copy link
Owner

Yeah, probably makes sense, it's safer to either make it configurable or put some limit on the number of tenant metrics.

@AlexDCraig
Copy link
Contributor Author

@blind-oracle ready for another review

config.go Outdated
Listen string `env:"CT_LISTEN"`
ListenPprof string `yaml:"listen_pprof" env:"CT_LISTEN_PPROF"`
ListenMetricsAddress string `yaml:"listen_metrics_address" env: "CT_LISTEN_METRICS_ADDRESS"`
ListenMetricsIncludeTenant bool `yaml:"listen_metrics_include_tenant" env: "CT_LISTEN_METRICS_INCLUDE_TENANT"`
Copy link
Owner

Choose a reason for hiding this comment

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

Let's maybe rename it to smth like MetricsIncludeTenantLabel since it really has nothing to do with listening?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blind-oracle cool, done

@blind-oracle
Copy link
Owner

Super, let's merge it as is, if something comes up we can improve later. Thanks!

@blind-oracle blind-oracle merged commit 1741557 into blind-oracle:main Jun 15, 2023
@AlexDCraig
Copy link
Contributor Author

@blind-oracle would you mind "releasing" (ie publishing the image) so I can use these changes? Thanks!

@blind-oracle
Copy link
Owner

Done, I need to setup some workflow for that... 🤔

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