Skip to content

GatewayTagsProvider not working as documented #4007

@joelmarty

Description

@joelmarty

Describe the bug

The documentation for the GatewayMetricsFilter states that:

In addition, through the spring.cloud.gateway.metrics.tags.path.enabled property (by default, false), you can activate an extra metric with the path tag: [...]

The property name is deprecated, but when switching the corresponding property spring.cloud.gateway.server.webflux.metrics.tags.path.enabled to true, the metrics contains a "path" tag whose value is enabled 🙃 .

The cause of the issue is that on one hand, the bean creation is activated by the configuration property spring.cloud.gateway.server.webflux.metrics.tags.path.enabled.

On the other hand, spring.cloud.gateway.server.webflux.metrics.tags is mapped to the GatewayMetricsProperties.tags property, which is a Map of arbitrary tags to add to metrics.

The issue still occurs in v5.x of the gateway.

As a workaround, removing the spring.cloud.gateway.server.webflux.metrics.tags.path.enabled property and creating the GatewayPathTagsProvider bean in the app's configuration works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions