iZettle / dropwizard-metrics-influxdb

Dropwizard Metrics v3 InfluxDB
Apache License 2.0
88 stars 37 forks source link

Metric naming and measurements #11

Closed nzroller closed 8 years ago

nzroller commented 8 years ago

I think it will be useful to name metrics differently in influxdb. Currently they're named with the fully qualified class name and I wonder if we could have something more general. This, together with a tag for metricName seems to be a good fit.

Example config:

# Measurement mappings
measurements:
  health: "^com.example.*health^" 
  auth: "^com.example.*auth\.[^.]"
  resources: "^com.example.*\.resource\..*$"
  dao: "^com.example.*\.dao\..*$"
  datasources: "^io\.dropwizard\.db\.ManagedPooledDataSource\.db_name$"

This would mean that in influxdb queries you would write

SELECT * FROM resources WHERE metricName =~ /^com.example.resource.*$/
-- or
SELECT * FROM resources WHERE applicationName = 'example-app'

Note that this isn't entirely necessary since influxdb supports regular expressions for the measurements too so I'd like your feedback on this proprosal. And although there isn't much to be found about how we should name our measurements I feel like reading through the documentation this is common practice.

@iZettle/horizons and @fredrikbackstrom

mikaellothman commented 8 years ago

I think this is a good idea, because as I understand you should avoid regular expressions in queries because of performance aspects. This will also make it easier to create generic cross-system queries.

nzroller commented 8 years ago

We went this proposal