Skip to content

Commit

Permalink
Rename to in flight grpc requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey-Vervoort-KNMI committed Nov 5, 2024
1 parent b33c150 commit e989c33
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions datastore/datastore/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
reg := prometheus.NewRegistry()
reg.MustRegister(
grpcMetrics,
promservermetrics.ActiveConnections,
promservermetrics.InFlightRequests,
promservermetrics.UptimeCounter,
promservermetrics.ResponseSizeSummary,
collectors.NewGoCollector(),
Expand All @@ -81,7 +81,7 @@ func main() {
server := grpc.NewServer(
grpc.ChainUnaryInterceptor(
reqTimeLogger,
promservermetrics.ConnectionUnaryInterceptor,
promservermetrics.InFlightRequestInterceptor,
promservermetrics.ResponseSizeUnaryInterceptor,
grpcMetrics.UnaryServerInterceptor(),
),
Expand Down
12 changes: 6 additions & 6 deletions datastore/datastore/metrics/promservermetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ var (
Help: "Total uptime of the gRPC server in seconds",
})

ActiveConnections = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "grpc_active_connections",
Help: "Current number of active gRPC connections",
InFlightRequests = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "grpc_in_flight_requests",
Help: "Current number of in-flight gRPC requests",
})

ResponseSizeSummary = prometheus.NewSummaryVec(
Expand All @@ -41,9 +41,9 @@ func TrackUptime() {
}
}

func ConnectionUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
ActiveConnections.Inc() // Increment when a new unary request (connection) is opened
defer ActiveConnections.Dec() // Decrement when the unary request (connection) is completed
func InFlightRequestInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
InFlightRequests.Inc() // Increment at the start of the request
defer InFlightRequests.Dec() // Decrement at the end of the request
return handler(ctx, req)
}

Expand Down
6 changes: 3 additions & 3 deletions grafana/dashboards/grpc-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -1146,14 +1146,14 @@
"uid": "PBFA97CFB590B2093"
},
"editorMode": "code",
"expr": "grpc_active_connections",
"expr": "grpc_in_flight_requests",
"instant": false,
"legendFormat": "Active gRPC connections",
"legendFormat": "In flight requests",
"range": true,
"refId": "A"
}
],
"title": "Active gRPC connections",
"title": "In flight requests",
"type": "timeseries"
},
{
Expand Down

1 comment on commit e989c33

@github-actions
Copy link

Choose a reason for hiding this comment

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

API Unit Test Coverage Report
FileStmtsMissCoverMissing
\_\_init\_\_.py00100% 
datastore_pb2.py614821%34–81
datastore_pb2_grpc.py542750%15–16, 19, 65–80, 121–123, 128–130, 135–137, 142–144, 148–173, 219, 246, 273, 300
export_metrics.py100100% 
grpc_getter.py201145%15–19, 23–26, 30–32, 36–38
locustfile.py15150%1–31
main.py43784%45, 50, 60, 70–71, 81–82
metadata_endpoints.py653152%45–54, 58, 85, 100–219, 223
response_classes.py50100% 
utilities.py1744674%20, 38, 45, 67–70, 78–89, 94–101, 121, 125, 127, 155, 161, 179, 193–194, 198, 214–218, 222–228, 232–234, 264, 268, 290, 295
custom_geo_json
   edr_feature_collection.py60100% 
formatters
   \_\_init\_\_.py110100% 
   covjson.py59198%91
   geojson.py21290%27, 52
openapi
   custom_dimension_examples.py40100% 
   edr_query_parameter_descriptions.py110100% 
   openapi_examples.py130100% 
routers
   \_\_init\_\_.py00100% 
   edr.py101496%348–349, 438–439
   feature.py471960%99–132, 148–153, 159–181
TOTAL72021171% 

API Unit Test Coverage Summary

Tests Skipped Failures Errors Time
30 0 💤 0 ❌ 0 🔥 1.835s ⏱️

Please sign in to comment.