Skip to content

Commit

Permalink
Create a /quality-metrics endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: cs-308-2023 <[email protected]>
  • Loading branch information
ADI-ROXX committed Jan 25, 2025
1 parent 5288d8c commit 1415973
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cmd/query/app/http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,31 @@ func (aH *APIHandler) RegisterRoutes(router *mux.Router) {
aH.handleFunc(router, aH.calls, "/metrics/calls").Methods(http.MethodGet)
aH.handleFunc(router, aH.errors, "/metrics/errors").Methods(http.MethodGet)
aH.handleFunc(router, aH.minStep, "/metrics/minstep").Methods(http.MethodGet)
aH.handleFunc(router, aH.getQualityMetrics, "/quality-metrics").Methods(http.MethodGet)

}

func (aH *APIHandler) getQualityMetrics(w http.ResponseWriter, r *http.Request) {
data := []map[string]any{
{
"serviceName": "sample-service-A",
"totalSpans": 42,
"errorSpans": 3,
"instrumentationQuality": "dummy-data-A",
},
{
"serviceName": "sample-service-B",
"totalSpans": 15,
"errorSpans": 1,
"instrumentationQuality": "dummy-data-B",
},
}

structuredRes := structuredResponse{
Data: data,
Errors: []structuredError{},
}
aH.writeJSON(w, r, &structuredRes)
}

func (aH *APIHandler) handleFunc(
Expand Down

0 comments on commit 1415973

Please sign in to comment.