Skip to content

feat(metrics): align metrics schema with Cloud Metric Descriptor conventions (k8s_gcs_fuse_volume) - #5100

Merged
alleaditya merged 1 commit into
masterfrom
gcsfuse_volume_metrics_schema
Oct 13, 2026
Merged

alleaditya merged 1 commit into
masterfrom
gcsfuse_volume_metrics_schema

Conversation

@alleaditya

@alleaditya alleaditya commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR aligns GCSFuse OpenTelemetry metric names with the k8s_gcs_fuse_volume Monitored Resource schema in Google Cloud Monitoring while supporting flag-controlled fallback to the legacy metric name:

  1. Adds the --metrics-enable-new-metrics-schema CLI flag / metrics.enable-new-metrics-schema config option (default: true, reusing proto-tag: 130 in cfg/params.yaml) so callers such as the GKE GCSFuse CSI driver can explicitly toggle between the new fs/ops_latencies metric name (true) and the legacy fs/ops_latency metric name (false).
  2. Uses OpenTelemetry Views (metric.WithView / metric.NewView in internal/monitor/otelexporters.go) to rename fs/ops_latency to fs/ops_latencies when metrics.enable-new-metrics-schema is true, avoiding any changes to metrics/metrics.yaml, tools/metrics-gen, or generated metrics/ code.
  3. Updates Prometheus monitoring integration tests (tools/integration_tests/monitoring/prom_test.go), config validation tests (cmd/root_test.go, cmd/config_validation_test.go), OTel view unit tests (internal/monitor/otelexporters_test.go), and VM metrics scripts (perfmetrics/scripts/vm_metrics/vm_metrics.py) to match the updated metric schema.

Link to the issue in case of a bug fix.

b/483847747

Testing details

  1. Manual - N/A
  2. Unit tests - go test -race ./internal/monitor/... ./metrics/... ./cmd/... ./cfg/... and python3 -m unittest perfmetrics/scripts/vm_metrics/vm_metrics_test.py
  3. Integration tests - tools/integration_tests/monitoring/prom_test.go
  4. [CI] Integration and Performance test - Sponge

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request renames the "fs/ops_latency" metric to "fs/ops_latencies" across the codebase, adds size-check guards before updating reader sizes in "internal/fs/handle/file.go", and enhances the metrics generator to format output files and search fallback paths for templates. The review feedback highlights a critical data race vulnerability in "internal/fs/handle/file.go" where reader sizes are modified under a read lock; it is recommended to return false and let the caller acquire a write lock instead. Additionally, the metrics generator should fail fast on formatting errors rather than silently ignoring them to prevent writing invalid Go code.

Comment thread internal/fs/handle/file.go Resolved
Comment thread internal/fs/handle/file.go Resolved
Comment thread tools/metrics-gen/main.go Resolved
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.92%. Comparing base (6ad50ad) to head (e6bfc8a).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
cfg/pb/config.pb.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5100       +/-   ##
===========================================
+ Coverage        0   84.92%   +84.92%     
===========================================
  Files           0      178      +178     
  Lines           0    19651    +19651     
===========================================
+ Hits            0    16689    +16689     
- Misses          0     2961     +2961     
- Partials        0        1        +1     
Flag Coverage Δ
unittests 84.92% <94.11%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alleaditya
alleaditya force-pushed the gcsfuse_volume_metrics_schema branch 2 times, most recently from 925ff2c to 43fc09f Compare September 21, 2026 08:24
@alleaditya
alleaditya marked this pull request as ready for review September 21, 2026 08:48
@alleaditya
alleaditya requested review from a team, anushka567 and meet2mky as code owners September 21, 2026 08:48
@github-actions github-actions Bot added the remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR. label Sep 21, 2026
@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

14 similar comments
@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@github-actions

Copy link
Copy Markdown

Hi @anushka567, @meet2mky, @kislaykishore, your feedback is needed to move this pull request forward. This automated reminder was triggered because there has been no activity for over 24 hours. Please provide your input when you have a moment. Thank you!

@alleaditya alleaditya added execute-integration-tests Run only integration tests execute-perf-test Execute performance test in PR and removed execute-integration-tests Run only integration tests labels Oct 12, 2026
@alleaditya
alleaditya force-pushed the gcsfuse_volume_metrics_schema branch from 43fc09f to 776eb12 Compare October 12, 2026 11:32
@alleaditya
alleaditya force-pushed the gcsfuse_volume_metrics_schema branch 3 times, most recently from e41592d to 9051597 Compare October 12, 2026 13:34
Comment thread metrics/metrics.yaml Resolved
@alleaditya
alleaditya force-pushed the gcsfuse_volume_metrics_schema branch from 9051597 to c101a3c Compare October 12, 2026 18:04
@alleaditya
alleaditya force-pushed the gcsfuse_volume_metrics_schema branch from c101a3c to e6bfc8a Compare October 12, 2026 18:04
@alleaditya
alleaditya enabled auto-merge (squash) October 13, 2026 15:21
@alleaditya alleaditya self-assigned this Oct 13, 2026
@alleaditya
alleaditya merged commit e5947f1 into master Oct 13, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

execute-integration-tests Run only integration tests execute-perf-test Execute performance test in PR remind-reviewers Auto remind reviewers in attention set for review post 24hrs of inactivity on PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

⌂ 换网址