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

Start refactor of storage (chunks) clients metrics into structs #5057

Merged
merged 8 commits into from
Jan 25, 2022
Merged

Start refactor of storage (chunks) clients metrics into structs #5057

merged 8 commits into from
Jan 25, 2022

Conversation

cstyan
Copy link
Contributor

@cstyan cstyan commented Jan 5, 2022

I've started a refactor of metrics for each of our chunks storage clients, which can be continued in follow up PRs. Ideally, we should try to avoid package global metrics that are registered via package init functions. Here I've added an BlobStorageMetrics struct in the azure package, and a ClientsMetric struct. The latter will eventually contain one of each chunk client implementations metrics structs. I'll also likely modify each so that the registerer can be passed in as well, rather than always using the default prometheus registerer. Maybe this is just personal preference but setting metrics up this way feels cleaner to me. It also makes reuse of these packages within other projects easier.

Signed-off-by: Callum Styan callumstyan@gmail.com

struct), add an azure client metric for total egress bytes.

Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan cstyan requested a review from a team as a code owner January 5, 2022 23:38
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan cstyan requested a review from owen-d January 5, 2022 23:39
Copy link
Collaborator

@kavirajk kavirajk left a comment

Choose a reason for hiding this comment

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

LGTM. Few minor nits and suggestions.

pkg/storage/chunk/azure/blob_storage_client.go Outdated Show resolved Hide resolved

// Unregister unregisters the blob storage metrics with the prometheus default registerer, useful for tests
// where we frequently need to create multiple instances of the metrics struct, but not globally.
func (bm *BlobStorageMetrics) Unregister() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice :)

pkg/storage/hack/main.go Outdated Show resolved Hide resolved
pkg/storage/stores/shipper/compactor/compactor_test.go Outdated Show resolved Hide resolved
Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@cstyan cstyan changed the title Add an Azure client metric for egress bytes Start refactor of storage (chunks) clients metrics into structs Jan 7, 2022
Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
Signed-off-by: Callum Styan <callumstyan@gmail.com>
@owen-d owen-d merged commit bfef7ba into grafana:main Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants