macbre / phantomas

Headless Chromium-based web performance metrics collector and monitoring tool
https://www.npmjs.com/package/phantomas
BSD 2-Clause "Simplified" License
2.26k stars 141 forks source link

InfluxData reporter #630

Open macbre opened 8 years ago

macbre commented 8 years ago

Introduce phantomas-reporter-influxdata

Relates to #593

Integration tests using TravisCI

EFF commented 8 years ago

good idea !

@macbre how did you imagine that one ? write every metric to a single serie ? write a single point to multiple series where every metric correspond to a serie ? or you might want to be super flexible which I don't really recommend ...

What I would do is write each metric as a point to a single serie where the serie could be a parameter and defaults to phantomas-

macbre commented 8 years ago

Let's try the following approach:

database: phantomas
name: phantomas_<serie name>
tags: metric=<metric name>,url=<url>,tag=<optional tag value>
fields: value=125.64 1434055562000000000

https://docs.influxdata.com/influxdb/v1.1/introduction/getting_started/

https://docs.influxdata.com/influxdb/v1.1/concepts/schema_and_data_layout/:

Every InfluxDB use case is special and your schema will reflect that uniqueness. There are, however, general guidelines to follow and pitfalls to avoid when designing your schema.

  • Encode meta data in tags Tags are indexed and fields are not indexed. This means that queries on tags are more performant than those on fields. In general, your queries should guide what gets stored as a tag and what gets stored as a field:
  • Store data in tags if they’re commonly-queried meta data
  • Store data in tags if you plan to use them with GROUP BY()
  • Store data in fields if you plan to use them with an InfluxQL function
  • Store data in fields if you need them to be something other than a string - tag values are always interpreted as strings

Use https://github.com/node-influx/node-influx

npm install --save influx@next

Integration tests: https://github.com/crodas/InfluxPHP/blob/master/.travis.yml

anlutro commented 8 years ago

I suggest pushing more than one metric into the same measurement, if those metrics are related, as that makes it possible to easily do maths on them (for example, subtract one loading time from another).

macbre commented 7 years ago

@anlutro, what if we push all metrics as fields in a single measurement?