Skip to content

feat(telemetry): attach serialized config proto to User-Agent for Get… - #5078

Draft
PranjalC100 wants to merge 1 commit into
masterfrom
feat-telemetry-user-agent
Draft

PranjalC100 wants to merge 1 commit into
masterfrom
feat-telemetry-user-agent

Conversation

@PranjalC100

@PranjalC100 PranjalC100 commented Sep 3, 2026

Copy link
Copy Markdown
Member

Description

  • Replaces the legacy 6-bit configuration bitmask (Cfg:<b1>:<b2>:<b3>:<b4>:<b5>:<b6>) in User-Agent with URL-safe base64 serialized Protobuf telemetry (CfgProto:<payload>).
  • Adds ConfigUserAgent to storageutil.StorageClientConfig to isolate the configuration payload to the control client used for GetStorageLayout.
  • Isolates ConfigUserAgent to rawStorageControlClientForStorageLayout, ensuring the standard rawStorageControlClient (used for folder operations) and all data-path storage clients retain the clean, minimal UserAgent (gcsfuse/<version> (GPN:gcsfuse[-<appName>]) (mount-id:<id>)).
  • Updates cmd/legacy_main.go to construct userAgent (standard) and configUserAgent (with CfgProto), eliminating legacy bitmask generation helpers (getConfigForUserAgent, boolToBin).
  • Updates unit tests in cmd and internal/storage to validate both standard and telemetry-enabled user agents across environment variable configurations and nil-receiver scenarios.

Link to the issue in case of a bug fix.

b/558662750

Testing details

  1. Manual - make fmt
  2. Unit tests - Executed unit test suites.
  3. Integration tests - Kokoro

Any backward incompatible change? If so, please explain.

N/A - Replaces legacy internal bitmask header string with proto header string for control client initialization.

@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 introduces a new ConfigUserAgent field to include serialized configuration details in the user agent string for storage control client operations. This is achieved by adding getUserAgentWithConfig to serialize and format the configuration, updating the storage client configuration, and creating a separate storage control client when a distinct config-based user agent is provided. The reviewer suggested refactoring getUserAgentWithConfig to reuse the existing getUserAgent logic, which avoids duplicating complex formatting and adds error logging for configuration serialization failures.

Comment thread cmd/legacy_main.go Outdated
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 30.95890% with 504 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.70%. Comparing base (e67225a) to head (696592d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cfg/pb/config.pb.go 6.06% 496 Missing ⚠️
cmd/legacy_main.go 73.68% 5 Missing ⚠️
internal/storage/storage_handle.go 84.61% 2 Missing ⚠️
cfg/config_proto.go 99.41% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5078      +/-   ##
==========================================
- Coverage   86.79%   84.70%   -2.10%     
==========================================
  Files         176      178       +2     
  Lines       18868    19575     +707     
==========================================
+ Hits        16377    16581     +204     
- Misses       2490     2993     +503     
  Partials        1        1              
Flag Coverage Δ
unittests 84.70% <30.95%> (-2.10%) ⬇️

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.

@PranjalC100
PranjalC100 force-pushed the feat-telemetry-user-agent branch from c0c5983 to 78fb856 Compare September 4, 2026 04:32
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-user-agent branch from 78fb856 to bab407f Compare September 8, 2026 13:51
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-user-agent branch from bab407f to e7326ed Compare September 9, 2026 11:08
Base automatically changed from feat-telemetry-proto-serialization to master September 23, 2026 04:56
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-user-agent branch 2 times, most recently from 1094b7b to 5af9c55 Compare September 23, 2026 08:59
* feat(cfg): compile protobuf and implement config serialization

* build(proto): pin protoc v36.1 and protoc-gen-go via setup script

Remove redundant go fmt directive from main.go and unify dev/CI proto compiler installation.

* refactor(cfg): make ToProto and SerializeConfigToProtoBase64 receiver methods

* test(cfg): replace cyclic and reflection tests with table-driven unit tests

* test(cfg): split proto base64 serialization assertions into AAA subtests

* build(proto): replace protoc setup script with zero-setup go run buf

* test(cfg): replace proto byte assertions with base64 format check

Remove non-deterministic proto serialization tests and fold base64 format checks into TestToProto_AllDataTypes.

* feat(cfg): wrap config protobuf in UserAgentConfig envelope

* post rebasing generated code

* change name to ConfigPayload

* test(config-gen): co-locate inputs and expected outputs in type_template_data_gen_test

* test(config-gen): simplify proto mapping tests and separate deprecated param checks
@PranjalC100
PranjalC100 force-pushed the feat-telemetry-user-agent branch from 5af9c55 to 696592d Compare September 23, 2026 11:28
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.

1 participant