Skip to content

Let callers override gRPC-code-to-zap-level mapping - #38

Merged
sduchesneau merged 1 commit into
developfrom
feature/child-of-noble-peak-jay
Sep 29, 2026
Merged

sduchesneau merged 1 commit into
developfrom
feature/child-of-noble-peak-jay

Conversation

@maoueh

@maoueh maoueh commented Sep 29, 2026

Copy link
Copy Markdown
Contributor
  • Add server.WithCodeLevelFunc(func(codes.Code) zapcore.Level) option, consumed by dgrpc/server/standard's newGRPCServer in place of the built-in defaultServerCodeLevel when set.
  • Leaves default behavior (package-level standard.Verbosity) unchanged for every existing caller; this is opt-in per server instance.
  • Motivated by substreams tier2 workers logging codes.ResourceExhausted at Info on every backpressure refusal — a high-QPS, expected condition for services doing admission control. With this option a caller can demote just that code (or remap the whole table) without dgrpc hardcoding a demotion for everyone.

Standard server's grpc_zap interceptor always maps codes.ResourceExhausted
to Info with no way to override it, which is noisy for services doing
admission control (e.g. substreams tier2 backpressure refusals). Callers
can now supply their own code-to-level mapping via server.Options; default
behavior (package Verbosity) is unchanged when unset.
@dfuse-bot
dfuse-bot requested a review from billettc September 29, 2026 19:11

@sduchesneau sduchesneau 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.

LGTM

@sduchesneau
sduchesneau merged commit 99e2089 into develop Sep 29, 2026
3 checks passed
@sduchesneau
sduchesneau deleted the feature/child-of-noble-peak-jay branch September 29, 2026 19:19
maoueh added a commit to streamingfast/substreams that referenced this pull request Sep 29, 2026
Cuts Cloud Logging volume on substreams-workers: these two log lines
accounted for ~37% of sampled bytes on every backpressure refusal.
Refusal rate/reason stays visible via substreams_tier2_rejected_request_counter.

Bumps dgrpc to pick up server.WithCodeLevelFunc (streamingfast/dgrpc#38)
and uses it to demote ResourceExhausted on tier2's gRPC server while
keeping its default code-to-level mapping for every other code.
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.

2 participants