Skip to content

Aggregate reporting for an Express default route #112

@kennsippell

Description

@kennsippell

I have a "default route" in my application which proxies requests to another service I think this is a somewhat common pattern -a default route in Express. Something like:

app.get("*", (req, res) => {
  res.send("DEFAULT ROUTE");
});

When I do this, it is causing some noisey routes in monitoring because each unique path which triggers this route is reported and aggregated separely. For example a request to /does-not-exist.txt is reported as route does-not-exist.txt*.

I'm thinking to resolve this by special casing the '*' route and reporting this in Prometheus under the simple consistent value * (no additional path information).

An alternative solution (if this is not a common case encountered for others), would be to provide a public interface which allows me to define my own mapping from route to string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions