opentracing-contrib / java-metrics

Apache License 2.0
31 stars 9 forks source link

Should 'version' and 'transaction' be included as standard labels #20

Open objectiser opened 7 years ago

objectiser commented 7 years ago

Wondering whether the following metrics labels should be included as standard:

version - provides the version identifier associated with the service - makes it possible to compare metrics across different versions of the same service, and identify when an older version of a service is no longer being used, so can be scaled down

transaction - this label represents a business transaction type - to enable metrics for services when used in a particular business context to be determined - e.g. "placing an order", "checking stock levels", etc. (Happy to debate whether 'transaction' is the right label name).

Currently this example adds a configuration for these two metrics, but they appear generally useful as a way to segment the metrics produced by a set of services.

If not used by the services, then they could simply have default values.

The initial source of information for transaction would be a baggage item of the same name, and for version it would be an environment variable (e.g. VERSION). Both of these sources could still be overridden by the user providing their own label implementation.

jpkrohling commented 7 years ago

I would even go one step further and try to "guess" what's the version, either based on the hostname (for OpenShift), or a Maven file within META-INF. Of course, with the option to disable this version resolution and allowing the target application to override it.

objectiser commented 7 years ago

Sounds possible - just need to work out what the out-of-the-box strategy should be.