envoyproxy / envoyproxy/gateway

cluster_upstream_rq_total metric doesn't include directResponse HTTPRouteFilters

Open
#9,097 4 comments 0 reactions 0 assignees View on GitHub
stale triage
Dominant language
Go
Stars
3k
Forks
864
Avg merge
2d 2h
Merged PRs (30d)
140

Description

*Description*:

When an `HTTPRoute` has a `directResponse`, the `directResponse` status code is not included in the exported metrics.

*Repro steps*:

(This assumes a Gateway and OpenTelemetry metrics sink are configured).

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: default-404
namespace: default
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: gateway
rules:
- filters:
- extensionRef:
group: gateway.envoyproxy.io
kind: HTTPRouteFilter
name: direct-response-404
type: ExtensionRef
matches:
- path:
type: PathPrefix
value: /
name: default
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: HTTPRouteFilter
metadata:
name: direct-response-404
namespace: default
spec:
directResponse:
body:
inline: Not found 2
type: Inline
contentType: text/plain
statusCode: 404
```

```shell
curl http://example.com/this-is-not-found
```

This outputs `Not found 2`, but `cluster_upstream_rq_total` does not increment `envoy_response_code=404`

*Note:*
The reason for this configuration, which is no different from the default behavior, is that we like to have metrics for `404`s, as that can indicate a client/server misconfiguration. It makes sense to not include the default `404`s in metrics, it seems explicitly configuration a catch-all route should cause them to be included.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.