metrics icon indicating copy to clipboard operation
metrics copied to clipboard

Feature/inline tags for all

Open p3r7 opened this issue 8 years ago • 8 comments

PR to answer enhancement reported in issue https://github.com/beberlei/metrics/issues/53

Implementation details:

  • as all TaggableCollectors are in fact "InlineTaggable", I renamed the interface InlineTaggableGaugeableCollector into TaggableGaugeableCollector
  • I added inline tags support for: Telegraf, InfluxDB and Prometheus
  • I added global tags support for: DogStatsD

Some stuff to look for before merging:

  • I wrote some new UT for InfluxDB and Prometheus but only tested the InfluxDB ones, due to being unable to download the prometheus client lib on my MS Windows station.
  • I made the global tags overridable by passing inline tags with similar keys. This is debatable.

Enjoy!

p3r7 avatar Dec 23 '16 16:12 p3r7

OK, just discovered those automated travis UT checks.

Nevertheless, I'ms struggling to debug my Prometheus UT, due to the aforementioned reasons :anguished:

p3r7 avatar Dec 23 '16 17:12 p3r7

@lyrixx: I would like to pick up this feature for Prometheus. As Prometheus will switch from TaggableCollector to InlineTaggableGaugeableCollector and thus lose setTags(), what is your preference for an upgrade path?

buffcode avatar Mar 30 '17 20:03 buffcode

@buffcode : you do not need to remove the setTags(), it could still be used for global tags, shared by all metrics sent with the Prometheus instance. See my implementation of it: https://github.com/beberlei/metrics/pull/55/files#diff-04d32a4646baea06bfa885af51292796

I sadly didn't quite got the time to work on this branch lately, and would gladly accept someone taking ownership or just helping, specifically with the prometheus UT. I can't debug them on my M$ Windows station, as the prometheus lib won't download via composer on this OS...

p3r7 avatar Mar 31 '17 14:03 p3r7

you do not need to remove the setTags(), it could still be used for global tags, shared by all metrics sent with the Prometheus instance.

:+1:

This PR needs a rebase BTW.

lyrixx avatar Apr 03 '17 13:04 lyrixx

:raised_hands: OK, I merged (rebase wasn't happy, probably due to the deleted InlineTaggableGaugeableCollector.php) and finally managed to debug the failing Prometheus UTs.

I added back the InlineTaggableGaugeableCollector interface, even though no class implement it no more.

Indeed:

  • all classes that were InlineTaggableGaugeableCollector are now TaggableCollector + TaggableGaugeableCollector
  • all classes that were TaggableCollector still are, but now support inline tags, in addition to global ones

@lyrixx : I would like some guidelines regarding how to mark the InlineTaggableGaugeableCollector and what you call providing an upgrade path. Is that a sort of documentation ?

p3r7 avatar Apr 27 '17 18:04 p3r7

OK, I made the DogStatsD collector implement back InlineTaggableGaugeableCollector, and did the same to Telegraf one. I discovered the @deprecated annotation and so deprecated the InlineTaggableGaugeableCollector interface.

This way, we should not have any BC break. @lyrixx, are you OK with this approach ?

p3r7 avatar May 02 '17 08:05 p3r7

Any news concerning this PR ?

p3r7 avatar Nov 09 '17 12:11 p3r7

Ouspy, accidental close

p3r7 avatar Nov 09 '17 12:11 p3r7