Skip to content

Commit

Permalink
Use static metric label for annotator post errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-soltesz committed Oct 27, 2018
1 parent 401f979 commit 9e91d5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions annotation/geo.go
Expand Up @@ -217,7 +217,11 @@ func ParseJSONGeoDataResponse(jsonBuffer []byte) (*GeoData, error) {
func GetBatchGeoData(url string, data []RequestData) map[string]GeoData {
// Query the service and grab the response safely
// All errors are recorded to metrics, so OK to ignore them here.
annotatorResponse, _ := BatchQueryAnnotationService(url, data)
annotatorResponse, err := BatchQueryAnnotationService(url, data)
if err != nil {
log.Println("BatchQueryAnnotationService Error:", err)
return nil
}

// Safely parse the JSON response and pass it back to the caller
geoDataFromResponse, err := BatchParseJSONGeoDataResponse(annotatorResponse)
Expand Down Expand Up @@ -257,7 +261,7 @@ func BatchQueryAnnotationService(url string, data []RequestData) ([]byte, error)
// Catch http errors
if err != nil {
metrics.AnnotationErrorCount.
With(prometheus.Labels{"source": err.Error()}).Inc()
With(prometheus.Labels{"source": "Post Error"}).Inc()
return nil, err
}

Expand Down

0 comments on commit 9e91d5a

Please sign in to comment.