Skip to content

docs: fix DoHTTPtoGRPC godoc example#32

Merged
ankurs merged 5 commits intomainfrom
fix/dohttptogrpc-godoc
Apr 4, 2026
Merged

docs: fix DoHTTPtoGRPC godoc example#32
ankurs merged 5 commits intomainfrom
fix/dohttptogrpc-godoc

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented Apr 4, 2026

Summary

  • Fix lowercase doHTTPtoGRPC → exported DoHTTPtoGRPC in godoc example
  • Remove redundant e.(error) type assertion (return value is already error)
  • Add description noting this enables in-process HTTP-to-gRPC with full interceptor chain

Test plan

  • make test, make lint, make doc all pass
  • Godoc example now matches actual API usage

Summary by CodeRabbit

  • New Features

    • Added SetFilterMethods() function to configure excluded method substrings with cache rebuilding
    • Added SetResponseTimeLogErrorOnly() function to control response-time logging behavior
  • Deprecated

    • FilterMethods variable is now deprecated; use SetFilterMethods() instead
  • Documentation

    • Expanded HTTP-to-gRPC integration documentation with usage examples and configuration guidance
    • Clarified New Relic interceptor pass-through behavior when app is nil

Fix two issues in the code example:
- doHTTPtoGRPC (lowercase) → DoHTTPtoGRPC (exported name)
- e.(error) redundant assertion → just return err directly

Also add description noting this enables in-process HTTP-to-gRPC calls
with the full interceptor chain.
Copilot AI review requested due to automatic review settings April 4, 2026 06:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 4, 2026

📝 Walkthrough

Walkthrough

The pull request updates API documentation for deprecated functions (GRPCClientInterceptor, FilterMethods), adds new configuration functions (SetFilterMethods, SetResponseTimeLogErrorOnly), reorganizes code in interceptors.go, and introduces comprehensive testing for DoHTTPtoGRPC functionality including error handling, interceptor chaining, and caching behavior.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md
Marked FilterMethods as deprecated with cache invalidation notes; updated GRPCClientInterceptor signature to use blank identifier; documented two new functions SetFilterMethods() and SetResponseTimeLogErrorOnly(); expanded DoHTTPtoGRPC documentation with grpc-gateway usage example; updated cross-references and line anchors throughout.
Code Organization
interceptors.go
Reordered prometheus import; reformatted global var block for filter and interceptor toggles; relocated httpToGRPCOnce/getHTTPtoGRPCInterceptor() cached interceptor state; updated documentation comment; removed minor whitespace; added trailing newline.
Test Suite Expansion
interceptors_test.go
Extended resetGlobals() with sync/atomic import to clear HTTP→gRPC interceptor state; added six new test functions validating DoHTTPtoGRPC error propagation, method/server passing, input passthrough, concurrent execution, and interceptor caching behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #22: Introduces the same package-level cached HTTP→gRPC interceptor (httpToGRPCOnce/getHTTPtoGRPCInterceptor) used by DoHTTPtoGRPC with associated documentation and testing around cached interceptor behavior.
  • PR #25: Covers the same GRPCClientInterceptor deprecation and no-op signature change (blank identifier for parameters).
  • PR #27: Modifies the same filter/config API surface—introducing SetFilterMethods() and deprecating FilterMethods with cache invalidation behavioral notes.

Poem

🐰 The paths are rearranged, the cache now sealed,
New config functions make the filter's truth revealed,
Tests hop through every flow with care and grace,
Deprecated tokens fade—progress takes their place! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references 'DoHTTPtoGRPC godoc example' but the changeset includes substantial functional changes beyond documentation: new exported functions (SetFilterMethods, SetResponseTimeLogErrorOnly), FilterMethods deprecation, comprehensive test additions, and code refactoring. Revise the title to reflect the full scope of changes, such as 'Add SetFilterMethods and SetResponseTimeLogErrorOnly functions with comprehensive tests' or provide separate PRs for documentation-only changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/dohttptogrpc-godoc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the documentation around DoHTTPtoGRPC so the published examples match the exported API and current behavior.

Changes:

  • Update the DoHTTPtoGRPC doc comment/example to call the exported DoHTTPtoGRPC and remove a redundant error type assertion.
  • Regenerate/update README.md (gomarkdoc output) to reflect current API signatures, anchors, and newly documented items (e.g., SetFilterMethods, SetResponseTimeLogErrorOnly).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
README.md Updates generated API docs/index entries, signatures, and links to match current code.
interceptors.go Adjusts DoHTTPtoGRPC documentation/example text to match exported API usage and describes in-process interceptor chaining.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread interceptors.go Outdated
Move the var block above the comment so gomarkdoc correctly associates
the documentation with the DoHTTPtoGRPC function instead of the
unexported variables.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread interceptors_test.go
Comment thread interceptors_test.go
Comment thread interceptors.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread interceptors_test.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread interceptors_test.go Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 190-205: The fenced code block showing the Echo and echo functions
lacks a language tag; update the markdown fence starting before the Echo
function to include "go" (e.g., ```go) so the example (functions Echo, echo and
usage of DoHTTPtoGRPC with proto.EchoRequest/proto.EchoResponse) is properly
highlighted and satisfies markdownlint MD040.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2149e239-d0a2-43d8-b857-b821531eae8e

📥 Commits

Reviewing files that changed from the base of the PR and between 5a6dd76 and 4a073c2.

📒 Files selected for processing (3)
  • README.md
  • interceptors.go
  • interceptors_test.go

Comment thread README.md
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ankurs ankurs merged commit 6490269 into main Apr 4, 2026
11 checks passed
@ankurs ankurs deleted the fix/dohttptogrpc-godoc branch April 4, 2026 09:18
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