helm-controller icon indicating copy to clipboard operation
helm-controller copied to clipboard

Added duration in seconds as logger attribute

Open or-shachar opened this issue 2 years ago • 3 comments

I'm trying to monitor reconciliation durations using the structured log objects, and I found it hard to extract it out of the plain message. I suggest adding another field to the log object with durationSeconds that can be easily turned into a metric.

I'm not quite sure how to test this new code though, seems like the logging is uncovered by the tests anyhow. Any advice would be appreciated!

or-shachar avatar Aug 30 '21 12:08 or-shachar

@mvoitko Sorry for the late response. Marked this as ready to review and rebased the branch on top of main.

or-shachar avatar Apr 28 '22 09:04 or-shachar

We have a Prometheus histogram for this, please see the docs here https://fluxcd.io/docs/guides/monitoring/#metrics

If we decide to add the durationSeconds to structured logs, then this must be done across all Flux controllers.

stefanprodan avatar Apr 28 '22 09:04 stefanprodan

@stefanprodan - Actually when I opened it we didn't have prometheus scraper within the cluster but only logs scraper. We used a different solution for metric reporting.

Now we do use Prometheus so it's not that important for us and indeed we use that historgram.

Do you think it's still valuable to do it across all Flux controllers? The pro is that it allows collecting data even without Prometheus. I don't know if our use case was unique or not.

or-shachar avatar May 01 '22 15:05 or-shachar