Skip to content

feat(storage): add grpc metrics experimental options#10984

Merged
frankyn merged 18 commits into
mainfrom
exp-options
Oct 18, 2024
Merged

feat(storage): add grpc metrics experimental options#10984
frankyn merged 18 commits into
mainfrom
exp-options

Conversation

@frankyn

@frankyn frankyn commented Oct 11, 2024

Copy link
Copy Markdown
Contributor

No description provided.

@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Oct 11, 2024
@frankyn frankyn changed the title feat(storage): experimental options feat(storage): add experimental options Oct 11, 2024
@frankyn frankyn marked this pull request as ready for review October 11, 2024 20:49
@frankyn frankyn requested review from a team October 11, 2024 20:49

@tritone tritone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great overall, thanks for figuring this out Frank!

Comment thread storage/experimental/experimental.go Outdated
"google.golang.org/api/option"
)

// WithMetricInterval how often to emit metrics when using NewPeriodicReader

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make it clear that these options are supposed to be used with storage.NewClient.

@tritone

tritone commented Oct 11, 2024

Copy link
Copy Markdown
Contributor

Also, looks like your unit test fails... can you investigate?

@frankyn frankyn requested a review from tritone October 15, 2024 16:28
@tritone tritone changed the title feat(storage): add experimental options feat(storage): add grpc metrics experimental options Oct 17, 2024

@tritone tritone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple minor nits/questions, overall looks good

Comment thread storage/experimental/experimental.go Outdated

// WithMetricInterval provides a [ClientOption] that may be passed to [storage.NewGrpcClient].
// It sets how often to emit metrics when using NewPeriodicReader and must be
// greater than 1 minute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this the minimum? Not sure why this requires validation, users might have their own systems with higher rate limits.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point; could pass along a value if it's non-zero.

Comment thread storage/experimental/experimental.go Outdated
"google.golang.org/api/option"
)

// WithMetricInterval provides a [ClientOption] that may be passed to [storage.NewGrpcClient].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

typo: should be storage.NewGRPCClient (here and below)

Comment thread storage/experimental/experimental.go Outdated
// WithMetricInterval provides a [ClientOption] that may be passed to [storage.NewGrpcClient].
// It sets how often to emit metrics when using NewPeriodicReader and must be
// greater than 1 minute.
// https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric#NewPeriodicReader

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

leave an empty line (with a // only) between links if you want them to not wrap in the godoc.

Comment thread storage/experimental/experimental.go Outdated

// WithMetricExporter provides a [ClientOption] that may be passed to [storage.NewGrpcClient].
// Set an alternate client-side metric Exporter to emit metrics through.
// Must implement interface metric.Exporter:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just do [metric.Exporter] and the godoc should autolink.

Comment thread storage/option.go Outdated
package storage

import (
"time"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure why this got moved but it will probably break formatting presubmits

Comment thread storage/experimental/experimental.go Outdated
"google.golang.org/api/option"
)

// WithMetricInterval provides a [ClientOption] that may be passed to [storage.NewGrpcClient].

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: what does ClientOption link to?

@tritone tritone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One more doc comment, otherwise LGTM

// WithReadStallTimeout provides a [ClientOption] that may be passed to [storage.NewClient].
// WithMetricInterval provides a [option.ClientOption] that may be passed to [storage.NewGRPCClient].
// It sets how often to emit metrics [metric.WithInterval] when using
// [metric.NewPeriodicReader]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think removing the minimum setting is good. Maybe suggest time.Minute or higher as an interval in the godoc if exporting to cloud monitoring.

@frankyn frankyn enabled auto-merge (squash) October 18, 2024 14:24
@frankyn frankyn merged commit 5b7397b into main Oct 18, 2024
@frankyn frankyn deleted the exp-options branch October 18, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants