micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.45k stars 980 forks source link

Better documentation for @Timed and @Counted #4623

Open dbnex14 opened 3 years ago

dbnex14 commented 3 years ago

I have read lots of articles but all of them were lacking information on how to remove cross-cutting concerns using annotations. I believe, I managed to only find information on this for @timed but from what I read, there are also counters, gauges and metered annotations?

It seem to be great functionality to have, no doubt in that, and it would help to have good examples to help everyone move into the direction of using micrometer for their projects and embrace the technology.

jonatan-ivanov commented 3 years ago

@dbnex14 Is this a duplicate: https://github.com/micrometer-metrics/micrometer-docs/issues/170? Micrometer only has @Timed and @Counted (also related: https://github.com/micrometer-metrics/micrometer/issues/2632), if you think that @Timed is documented properly, we can close this issue and only keep https://github.com/micrometer-metrics/micrometer-docs/issues/170, right?

dbnex14 commented 3 years ago

@dbnex14 Is this a duplicate: micrometer-metrics/micrometer-docs#170? Micrometer only has @Timed and @Counted (also related: micrometer-metrics/micrometer#2632), if you think that @Timed is documented properly, we can close this issue and only keep micrometer-metrics/micrometer-docs#170, right?

Yes, it is same thing really. I would recommend creating good example on how to use them both with annotations so we dont have to pollute code by adding calls to registry all over the place. It is up to you, I was able to find couple of examples online for @Timed although I could not get them working, so it seem to be a good opportunity to improve on that.

ebullient commented 3 years ago

The problem here (as far as micrometer goes) is that annotation support is framework/runtime dependent. Just because the annotations exist does not mean they do anything.

You have to be using a runtime or framework that will support their use for them to do anything.

So the doc for annotations w/in micrometer could be improved, sure.. but it will have to have caveats all over it.