Skip to content

Conversation

@Broderick-Westrope
Copy link

@Broderick-Westrope Broderick-Westrope commented May 8, 2025

Summary by Sourcery

Add comprehensive gRPC support to GoVisual, enabling request logging, visualization, and instrumentation for gRPC services and clients

New Features:

  • Add gRPC interceptors for server and client request logging
  • Support for different gRPC method types (unary, streaming)
  • Extend dashboard to display gRPC request details
  • Add gRPC-specific filtering and statistics

Enhancements:

  • Extend request model to support gRPC request metadata
  • Update dashboard UI to handle gRPC request visualization
  • Add support for logging gRPC request and response data
  • Implement gRPC method type detection

Documentation:

  • Update README with gRPC support documentation
  • Add example gRPC application with detailed README

Tests:

  • Add gRPC example application demonstrating visualization capabilities
  • Implement gRPC method type and streaming support tests

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 8, 2025

Reviewer's Guide

This pull request integrates gRPC support by introducing client and server interceptors to capture gRPC call details. The data model (RequestLog) was extended with gRPC-specific fields, and the dashboard UI was updated to display these requests, including new filters, statistics, and a dedicated detail view for gRPC calls with stream message support. A shared data store mechanism was implemented, allowing both HTTP and gRPC logs to be viewed in a unified dashboard. Public APIs were added for easy integration with gRPC services.

File-Level Changes

Change Details Files
Implemented gRPC server/client interceptors for capturing call metadata, messages, status, and timing.
  • Created unary and stream interceptors for both server and client-side gRPC calls.
  • Interceptors log request/response metadata, message data (if enabled), peer information, status codes, and duration.
  • Handled different gRPC method types (unary, client/server/bidi streaming).
internal/grpc/interceptors.go
grpc.go
Enhanced RequestLog model and dashboard UI (filters, table, stats, detail view) to handle and display gRPC requests, including streamed messages.
  • Added Type, GRPCService, GRPCMethod, GRPCMethodType, GRPCMessages, and other gRPC-specific fields to RequestLog struct.
  • Introduced RequestType and GRPCMethodType enums.
  • Updated dashboard HTML and JavaScript to filter, display, and detail gRPC requests.
  • Added new CSS for gRPC-specific UI elements.
  • Created a new template for gRPC request details view including stream message display.
  • Modified statistics to include gRPC-specific counts alongside HTTP ones.
internal/model/request.go
internal/dashboard/templates/layout.html
internal/dashboard/templates/dashboard.html
internal/dashboard/templates/components/filters.html
internal/dashboard/templates/components/stats.html
internal/dashboard/templates/components/grpc-details.html
Enabled a shared data store for unified HTTP and gRPC request visualization.
  • Introduced a public Store interface and NewStore factory function.
  • Added WithSharedStore option to allow passing a pre-configured store.
  • Modified HTTP wrapper and new gRPC interceptor setup to use the shared store if provided.
store.go
wrap.go
options.go
grpc.go
cmd/examples/grpc/main.go
Added public API functions for gRPC integration.
  • Added WithGRPC, WithGRPCRequestDataLogging, WithGRPCResponseDataLogging, WithIgnoreGRPCMethods options.
  • Provided WrapGRPCServer, NewGRPCServer, DialGRPCWithVisualizer, and GRPCDialContext for easier integration by users.
grpc.go
options.go
Included a new gRPC example application.
  • Added a fully functional gRPC client/server example demonstrating GoVisual integration.
  • Included protobuf definitions, generated code, and build tooling for the example.
cmd/examples/grpc/
cmd/examples/README.md
Updated dependencies.
  • Updated google.golang.org/grpc, github.com/mattn/go-sqlite3, and other related dependencies.
go.mod
go.sum

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Broderick-Westrope Broderick-Westrope force-pushed the feature/issue-8/add-gRPC-support branch from b463a23 to b84202f Compare May 13, 2025 08:51
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