Tuesday

Toggling metrics capture within web services

When creating reusable web services, if you have set up an architecture that stores metrics about every request that comes into the system there are a few traps to avoid. One of the issues our team ran into recently was when a web service called another major web service. We noted that the metrics from the inner service overwrote any metrics set by the calling web service. The work around was to reset all the metrics as they were after the inner service was called, for which a lot of redundant code had to be written.

The solution is to build a metrics toggle into your web services. This flag determines whether metrics should be recorded or not. But a big drawback is exposing such a schema to a client. If a client wanted to, they could misuse the service by setting the metrics flag - effectively rendering your metrics capture useless.

Can't think of a better solution for now. Just a reminder to not quit my day job.

No comments:

Post a Comment