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

fix(storage): monitored resource detection #11197

Merged
merged 23 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
19d99e5
fix(storage): populate monitored resource correctly
frankyn Nov 25, 2024
004f8f6
refactor with additional integration tests
frankyn Nov 26, 2024
09fc863
refactor initialization of metricsContext
frankyn Nov 26, 2024
be04e92
remove exporter experimental option and add manual reader for tests
frankyn Nov 26, 2024
ba05e27
Merge branch 'main' into fix-mr-storage
frankyn Nov 26, 2024
256b835
go mod tidy
frankyn Nov 27, 2024
1e2cc6f
dependency inject gcp detector for testing
frankyn Dec 1, 2024
34d53cb
Merge branch 'main' into fix-mr-storage
frankyn Dec 1, 2024
b15c80a
Merge branch 'main' into fix-mr-storage
frankyn Dec 2, 2024
bb67dd3
revert removal of metricExporter option
frankyn Dec 2, 2024
7e4095b
revert changes to metricExporter option tests
frankyn Dec 2, 2024
751b810
use struct embedding
frankyn Dec 2, 2024
3906ab7
pass in resource correctly to exporter
frankyn Dec 3, 2024
1cdfdef
Merge branch 'main' into fix-mr-storage
frankyn Dec 3, 2024
34e04cb
update test using resource value
frankyn Dec 3, 2024
6308f2f
add tests checking resource values
frankyn Dec 4, 2024
b96a540
Merge branch 'main' into fix-mr-storage
frankyn Dec 4, 2024
585b72d
add option to disable exporter in unit tests
frankyn Dec 4, 2024
7749f7a
Merge branch 'main' into fix-mr-storage
frankyn Dec 4, 2024
d503aed
Merge branch 'main' into fix-mr-storage
frankyn Dec 4, 2024
7547a15
Merge branch 'main' into fix-mr-storage
frankyn Dec 20, 2024
3de98fc
address feedback
frankyn Dec 20, 2024
728feae
use project-id not project_id...
frankyn Dec 20, 2024
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
19 changes: 19 additions & 0 deletions storage/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
"google.golang.org/api/transport"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/encoding"
Expand Down Expand Up @@ -118,6 +119,24 @@ type grpcStorageClient struct {
settings *settings
}

func enableClientMetrics(ctx context.Context, s *settings, config storageConfig) (*metricsContext, error) {
var project string
// TODO: use new auth client
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have a bug for this?

c, err := transport.Creds(ctx, s.clientOption...)
if err == nil {
project = c.ProjectID
}
metricsContext, err := newGRPCMetricContext(ctx, metricsConfig{
project: project,
interval: config.metricInterval,
manualReader: config.manualReader},
)
if err != nil {
return nil, fmt.Errorf("gRPC Metrics: %w", err)
}
return metricsContext, nil
}

// newGRPCStorageClient initializes a new storageClient that uses the gRPC
// Storage API.
func newGRPCStorageClient(ctx context.Context, opts ...storageOption) (storageClient, error) {
Expand Down
Loading
Loading