Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@luisazofracabify
Copy link

@luisazofracabify luisazofracabify commented Jan 30, 2026

Description

This PR addresses the lack of observability in the Feast Go Feature Server by implementing comprehensive metrics for both HTTP and gRPC endpoints, and integrating them with the existing OpenTelemetry tracing.

Changes

  • Metrics Implementation: Added Prometheus metrics using gotoprom (a type-safe wrapper for the official Prometheus client) to ensure standardized bucket configuration and label safety.
    • Added internal/feast/metrics/metrics.go to define histograms and counters.
    • Exposed metrics via the /metrics endpoint.
  • HTTP Observability:
    • Implemented a middleware in internal/feast/server/http_server.go to capture request duration and status codes.
    • Note on Design: The middleware logic is encapsulated within http_server.go (instead of main.go) to maintain high cohesion within the server struct and ensure metrics are applied correctly to business endpoints while excluding health checks.
  • gRPC Observability:
    • Added a Unary Interceptor in main.go to capture gRPC specific metrics (latency, status codes, methods).
    • Configured a sidecar HTTP server on port 9090 to expose Prometheus metrics when running in gRPC mode.
  • Tracing:
    • Integrated OpenTelemetry spans within the HTTP handlers to ensure trace propagation.

How Has This Been Tested?

  • Manual Testing: Ran the server in both HTTP and gRPC modes.
    • Verified /metrics endpoint returns valid Prometheus data.
    • Verified /get-online-features increments the counters and updates histograms.
    • Verified panic recovery middleware works as expected without crashing the server.
  • Unit Tests: Added/Verified tests in metrics_test.go.

Checklist

  • My code follows the code style of this project.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the dependencies (go.mod / go.sum).

Why gotoprom

It reduces boilerplate code for histograms and ensures type-safety for labels, preventing runtime panics due to mismatched label cardinality. It wraps the official prometheus client, so it's fully compatible


Open with Devin

@luisazofracabify luisazofracabify requested a review from a team as a code owner January 30, 2026 11:53
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 6 additional flags.

Open in Devin Review

@luisazofracabify luisazofracabify force-pushed the feat/go-server-observability branch from 82aca5b to b876dba Compare January 30, 2026 11:58
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View issue and 9 additional flags in Devin Review.

Open in Devin Review

@luisazofracabify luisazofracabify force-pushed the feat/go-server-observability branch from b876dba to 8b5cd4b Compare January 30, 2026 12:30
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View issue and 12 additional flags in Devin Review.

Open in Devin Review

@luisazofracabify luisazofracabify force-pushed the feat/go-server-observability branch from 8b5cd4b to 847393e Compare January 30, 2026 12:39
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