You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #7445. Depends on #7446 (the /metrics endpoint + Scope must exist first).
Summary
Add RPC-level Prometheus metrics (request count, error count, latency) to the runs service by attaching a shared Connect interceptor to every service handler.
Background
The runs service is a Connect (connectrpc.com/connect) server. Handlers are mounted in runs/setup.go via calls like:
Apply it to RunService, InternalRunService, TaskService, IdentityService, AuthMetadataService, TriggerService, ProjectService (and RunLogsService when mounted).
Acceptance criteria
After making RPC calls, /metrics exposes per-procedure request count, error count, and latency metrics.
The interceptor is shared/created once and reused across all handlers.
A unit test verifies the interceptor increments the request counter (and error counter on error) for a sample procedure.
Pointers
runs/setup.go — all the sc.Mux.Handle(...) registrations (lines ~78-120+).
Summary
Add RPC-level Prometheus metrics (request count, error count, latency) to the runs service by attaching a shared Connect interceptor to every service handler.
Background
The runs service is a Connect (
connectrpc.com/connect) server. Handlers are mounted inruns/setup.govia calls like:There are currently no interceptors anywhere in the v2 tree, so no RPC metrics are emitted.
What to do
Write a Connect interceptor (a
connect.UnaryInterceptorFunc/connect.Interceptor) that records, per RPC procedure:requests_totallabeled by procedure)connect.CodeOf(err))Scope.MustNewStopWatchstyle timer)Use the
sc.Scopeprovided by [flyte2] Add /metrics endpoint and initialize metrics Scope in the app framework #7446 to create the metrics (e.g. a sub-scopesc.Scope.NewSubScope("grpc")).Pass the interceptor to every
New*ServiceHandler(...)call inruns/setup.goviaconnect.WithInterceptors(...), e.g.:Apply it to RunService, InternalRunService, TaskService, IdentityService, AuthMetadataService, TriggerService, ProjectService (and RunLogsService when mounted).
Acceptance criteria
/metricsexposes per-procedure request count, error count, and latency metrics.Pointers
runs/setup.go— all thesc.Mux.Handle(...)registrations (lines ~78-120+).flytestdlib/promutils/scope.go—Scopehelpers (MustNewCounter,MustNewStopWatch,NewSubScope, etc.).Notes for contributors