Skip to content

Commit

Permalink
stream_status to use the same terms with http_requests_total
Browse files Browse the repository at this point in the history
  • Loading branch information
hfukada committed May 30, 2022
1 parent 4d0b15c commit b619f75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion kong/plugins/prometheus/exporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ else
labels_table[1] = service_name
labels_table[2] = route_name
labels_table[3] = message.session.status
labels_table[4] = kong.response.get_source()

if kong.response.get_source() == "service" then
labels_table[4] = "service"
else
labels_table[4] = "kong"
end

latency_labels_table[1] = service_name
latency_labels_table[2] = route_name
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/26-prometheus/02-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ describe("Plugin: prometheus (access) per-consumer metrics", function()
return body:find('http_requests_total{service="mock-service",route="http-route",code="200",source="service",consumer="alice"} 1', nil, true)
end)

assert.matches('http_requests_total{service="mock-service",route="http-route",code="401",source="exit",consumer=""} 1', body, nil, true)
assert.matches('http_requests_total{service="mock-service",route="http-route",code="401",source="kong",consumer=""} 1', body, nil, true)

assert.matches('kong_nginx_metric_errors_total 0', body, nil, true)
end)
Expand Down

0 comments on commit b619f75

Please sign in to comment.