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 a9067ad
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)

Check failure on line 125 in cmd/query/app/http_handler.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofumpt)
}

func (aH *APIHandler) getQualityMetrics(w http.ResponseWriter, r *http.Request) {
data := []map[string]any{

Check failure on line 129 in cmd/query/app/http_handler.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofmt)
{
"serviceName": "sample-service-A",
"totalSpans": 50,
"errorSpans": 4,
"instrumentationQuality": "dummy-data-A",
},
{
"serviceName": "sample-service-B",
"totalSpans": 25,
"errorSpans": 1,
"instrumentationQuality": "dummy-data-B",
},
}

structuredRes := structuredResponse{

Check failure on line 144 in cmd/query/app/http_handler.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (goimports)
Data: data,
Errors: []structuredError{},
}
aH.writeJSON(w, r, &structuredRes)

Check warning on line 148 in cmd/query/app/http_handler.go

View check run for this annotation

Codecov / codecov/patch

cmd/query/app/http_handler.go#L128-L148

Added lines #L128 - L148 were not covered by tests
}

func (aH *APIHandler) handleFunc(
Expand Down

0 comments on commit a9067ad

Please sign in to comment.