iamhalje / defectdojo-exporter

Collects Prometheus metrics for vulnerabilities of each product in DefectDojo
MIT License
5 stars 0 forks source link

Feature Request: Add Product Metrics and Product Type Labels #1

Open tidusete opened 1 week ago

tidusete commented 1 week ago

Description

I would like to propose adding a new metric and enhancing existing metrics in the DefectDojo exporter:

  1. dojo_products
    • Purpose: Track products information in DefectDojo
    • Possible implementations:
      • Counter showing total number of products
      • Gauge with labels containing product names

Additional Enhancement

I suggest adding a product_type label to all existing metrics. This would greatly improve the ability to group and analyze metrics by product type in Grafana dashboards.

Benefits

Example Metric Format

# HELP dojo_products Total number of products in DefectDojo
# TYPE dojo_products gauge
dojo_products{product_type="webapp"} 5
dojo_products{product_type="api"} 3

Questions to Consider

Let me know if you need any clarification or have questions about this proposal.

iamhalje commented 1 week ago

It will be possible to display the vulnerabilities by product_type in Grafana and retrieve the necessary product-specific vulnerabilities. Yep, it looks convenient.

Should the metric be a counter or gauge?

I think that is a gauge metric. Since we update the metrics every time, meaning we reset them, this is how all the metrics are currently collected. A counter is not used for this.

Should we include any additional labels besides product_type?

There are no other mandatory fields for the product except for product_type, so this will need to be worked around (or excluded). For now, we can start by adding only product_type.

Would you like to add it yourself? 😊

iamhalje commented 4 days ago

I realize the exporter is not written very well. Maybe I'll find time to rewrite it if I decide to