tektoncd / triggers

Event triggering with Tekton!
Apache License 2.0
556 stars 417 forks source link

eventlistener_event_count metric without not status label #1711

Open joaosilva15 opened 6 months ago

joaosilva15 commented 6 months ago

Expected Behavior

eventlistener_event_count for Prometheus exporter should have a status label.

Actual Behavior

eventlistener_event_count has no status label

Steps to Reproduce the Problem

  1. Run eventlistener
  2. Curl the prometheus port on the /metrics path and search for the eventlistener_event_count metric
  3. The metric will be like
    # HELP eventlistener_event_count Number of events sent
    # TYPE eventlistener_event_count counter
    eventlistener_event_count{event_source="",event_type="",name="",namespace_name="",resource_group="",response_code="",response_code_class="",response_error="",response_timeout=""} 1

All labels are empty and thus removed when scraped by Prometheus. You can also see that the status label is not present.

Additional Info

I believe the issue is that this metric is being registered in the default opencensus register and is conflicting with this metric. As the latter metric is registered after the metric created by the event listener the labels are replaced.

I'm happy to open a PR fixing it but I'll need some guidance on how we wish to do it. Should we change the metric name? Or we can change the opencensus register, if possible, and use a non-default one (if possible), but that will complicate the current code a bit.

khrm commented 5 months ago

I'm happy to open a PR fixing it but I'll need some guidance on how we wish to do it. Should we change the metric name?

Please change the name of the metrics. I am happy to review that PR.