Skip to content

Documentation: add documentation for non-experimental environment variables - #9227

Open
ulascansenturk wants to merge 2 commits into
grpc:masterfrom
ulascansenturk:docs/env-vars
Open

Documentation: add documentation for non-experimental environment variables#9227
ulascansenturk wants to merge 2 commits into
grpc:masterfrom
ulascansenturk:docs/env-vars

Conversation

@ulascansenturk

Copy link
Copy Markdown
Contributor

Adds environment_variables.md at the repository top level, documenting the non-experimental environment variables supported by grpc-go, grouped by area (logging, binary logging, name resolution, xDS, load balancing, security, server, GCP observability).

Variables containing EXPERIMENTAL in their names are intentionally left out, with a note explaining they may change or be removed without notice.

Fixes #9213

RELEASE NOTES: none

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.16%. Comparing base (2a112a8) to head (995de8b).
⚠️ Report is 55 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9227      +/-   ##
==========================================
- Coverage   83.33%   83.16%   -0.18%     
==========================================
  Files         420      423       +3     
  Lines       34028    35139    +1111     
==========================================
+ Hits        28358    29223     +865     
- Misses       4253     4414     +161     
- Partials     1417     1502      +85     

see 65 files with indirect coverage changes

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

@easwars easwars added this to the 1.84 Release milestone Jul 14, 2026
@easwars
easwars requested a review from mbissa July 15, 2026 00:17
@easwars easwars added the Type: Documentation Documentation or examples label Jul 15, 2026
Comment thread environment_variables.md Outdated
Comment on lines +6 to +9
Variables whose names contain `EXPERIMENTAL` are intentionally not documented
here: they guard features that are still in development, and they may change
behavior, change defaults, or be removed entirely in any release without
notice.

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.

Are you intending to say that the documented list here is exhaustive other than EXPERIMENTAL flags?

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.

Yes, that's the intent, and your question caught that it wasn't actually true. I swept every os.Getenv/os.LookupEnv call across the main module and all submodules and found four non-experimental variables missing: GOOGLE_CLOUD_PROJECT (read by gcp/observability, alongside the two config variables already listed) and CSM_CANONICAL_SERVICE_NAME, CSM_WORKLOAD_NAME, CSM_MESH_ID (read by stats/opentelemetry/csm). All four are now documented.

I also made the exhaustiveness claim explicit rather than implied, and broadened the exclusion note to cover TEST_ONLY names as well as EXPERIMENTAL ones. That accounts for GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI, which exists for gRPC's own tests. The 15 variables already in the list all check out against the code, with no stale entries.

@mbissa

mbissa commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

/gemini review

@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 adds a new documentation file, environment_variables.md, which lists and describes the environment variables supported by the grpc-go implementation. The review feedback suggests updating the logging section to include the FATAL severity level in the documentation for GRPC_GO_LOG_SEVERITY_LEVEL to ensure completeness.

Comment thread environment_variables.md
Comment on lines +23 to +24
logger. One of `ERROR`, `WARNING` or `INFO` (e.g. `INFO` enables info,
warning and error logs). Defaults to `ERROR`. Has no effect if the

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.

medium

The FATAL log level is also supported by the default logger's environment variable parser (it maps to fatalLog in grpclog). We should include FATAL in the list of supported severity levels to make the documentation complete.

Suggested change
logger. One of `ERROR`, `WARNING` or `INFO` (e.g. `INFO` enables info,
warning and error logs). Defaults to `ERROR`. Has no effect if the
logger. One of `FATAL`, `ERROR`, `WARNING` or `INFO` (e.g. `INFO` enables info,
warning, error and fatal logs). Defaults to `ERROR`. Has no effect if the

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.

Not taking this one, as FATAL isn't a recognized value. The parser at grpclog/loggerv2.go:66 has cases for only "", ERROR, WARNING and INFO (plus lowercase forms) and no default, so FATAL matches nothing and leaves infoW, warningW and errorW at io.Discard. Since grpclog/internal/loggerv2.go:258 derives the fatal writer as fatalW := errorW, setting FATAL produces no output at any severity rather than fatal-only logging.

It does point at a real gap in the doc, though: an unrecognized value silences the default logger entirely instead of falling back to the ERROR default, which is worth calling out. I've added a note to that effect, including that Fatal* calls still exit the process in that case since exit(1) runs unconditionally after the (discarded) print.

State that the list is exhaustive and broaden the exclusion note to cover
TEST_ONLY variables alongside EXPERIMENTAL ones, then add the non-experimental
variables that were missing: GOOGLE_CLOUD_PROJECT and the three CSM_* labels
read by stats/opentelemetry/csm.

Also document that an unrecognized GRPC_GO_LOG_SEVERITY_LEVEL silences the
default logger entirely rather than falling back to the default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Documentation Documentation or examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for non-experimental env vars

4 participants