prometheus / graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Apache License 2.0
354 stars 100 forks source link

Metric not processed due to invalid value #264

Closed ivanov17 closed 4 months ago

ivanov17 commented 4 months ago

Hello. When I try to process graphite metrics from rspamd, I get following errors:

ts=2024-06-21T16:18:44.573Z caller=main.go:85 level=info msg="Starting graphite_exporter" version_info="(version=0.15.1, branch=HEAD, revision=cf47e460f839e7e42f1d6016b1300df2e3d15ad9)"
ts=2024-06-21T16:18:44.574Z caller=main.go:86 level=info build_context="(go=go1.22.0, platform=linux/amd64, user=root@e9d9aba80dbb, date=20240322-16:31:01, tags=netgo)"
ts=2024-06-21T16:18:44.578Z caller=tls_config.go:313 level=info msg="Listening on" address=[::]:9108
ts=2024-06-21T16:18:44.578Z caller=tls_config.go:316 level=info msg="TLS is disabled." http2=false address=[::]:9108
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.add_header nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.add_header nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.greylist nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.greylist nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.no_action nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.no_action nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.reject nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.reject nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.rewrite_subject nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.rewrite_subject nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:131 level=debug msg="Incoming line" line="rspamd.actions.soft_reject nil 1718986725"
ts=2024-06-21T16:18:45.901Z caller=collector.go:166 level=info msg="Invalid value" line="rspamd.actions.soft_reject nil 1718986725"

It looks like the problem is with the nil value which exporter cannot handle. I'm not sure I understand the rspamd module code to see where the nil might appear.

Does it work as intended or this is the bug? If there are no problems on the exporter side, let me know and I will open an issue for rspamd.

Mapping configuration:

mappings:
- match: rspamd.actions.*
  name: rspamd_actions_total
  labels:
    type: $1
...
ivanov17 commented 4 months ago

I just tested receiving graphite metrics from rspamd using socat container (very useful thing, highly recommended for debugging). This is the problem on the rspamd side:

2024/06/23 07:26:00 socat[2] W address is opened in read-write mode but only supports write-only
rspamd.actions.add_header nil 1719127560
rspamd.actions.greylist nil 1719127560
rspamd.actions.no_action nil 1719127560
rspamd.actions.reject nil 1719127560
rspamd.actions.rewrite_subject nil 1719127560
rspamd.actions.soft_reject nil 1719127560
rspamd.bytes_allocated 27822416 1719127560
rspamd.chunks_allocated 113 1719127560
rspamd.chunks_freed 0 1719127560
rspamd.chunks_oversized 1 1719127560
rspamd.connections 0 1719127560
rspamd.control_connections 0 1719127560
rspamd.ham_count 0 1719127560
rspamd.learned 0 1719127560
rspamd.pools_allocated 28 1719127560
rspamd.pools_freed 0 1719127560
rspamd.scanned 0 1719127560
rspamd.shared_chunks_allocated 3 1719127560
rspamd.spam_count 0 1719127560

So, I'm closing this issue.