Skip to content

Question regarding Prometheus metrics #2899

Description

@paynekw

Forgive me if this is a silly question or if it has been answered before. I did search open and closed issues and found nothing related.

I've enabled the Monitoring UI and Prometheus metrics with the following config:

###############################################################################
#                            Monitoring UI                                     #
###############################################################################

[monitoring_ui]

## Enable the monitoring UI
enabled = true

## Listen address for the monitoring UI
listen_address = [REDACTED]

## Optional username and password for basic authentication
## To disable authentication, set username to an empty string: username = ""
## If both username and password are empty, no authentication is required
# username = "admin"
# password = "changeme"

username = "REDACTED"
password = "REDACTED"

## Optional TLS certificate and key for HTTPS
## If both are empty, HTTP will be used
tls_certificate = ""
tls_key = ""

## Enable query logging in the monitoring UI
## This will show recent queries in the UI
enable_query_log = true

## Privacy level for the monitoring UI
## 0: show all details including client IPs
## 1: anonymize client IPs (default)
## 2: aggregate data only (no individual queries or domains shown)
privacy_level = 1

## Maximum number of recent query log entries to keep in memory
## Helps control memory usage on high-traffic servers
## Default: 100
# max_query_log_entries = 100

## Maximum memory usage in MB for recent query logs
## Automatic cleanup when limit is exceeded
## Default: 1
# max_memory_mb = 1

## Enable Prometheus metrics endpoint
## Default: false
prometheus_enabled = true

## Path for Prometheus metrics endpoint
## Default: /metrics
# prometheus_path = "/metrics"

I have an OTEL Collector configured to scrape the metrics endpoints of 2 dnscrypt-proxy instances and send the metrics to Grafana, like this:

  prometheus:
    config:
      scrape_configs:
        - job_name: 'dnscrypt-proxy'
          scrape_interval: 10s
          static_configs:
            - targets: ['<server_1_hostname>:<server_1_port>','<server_2_hostname>:<server_2_port>']
        - job_name: 'node-exporter'
          scrape_interval: 10s
          static_configs:
            - targets: ['REDACTED']
        - job_name: 'tailscale'
          scrape_interval: 10s
          static_configs:
            - targets: ['REDACTED']
        - job_name: 'otel-collector-metrics'
          scrape_interval: 10s
          static_configs:
            - targets: ['localhost:8888']
          relabel_configs:
            - source_labels: [__address__]
              target_label: instance
              replacement: "otel-collector"

I can access the Monitoring UIs and metrics endpoints of both dnscrypt-proxy instances.

Metrics are showing up in Grafana with the exception of dnscrypt_proxy_blocked_queries_total which is always zero, despite both servers blocking plenty of queries. Is this a bug of sorts or have I done something silly?

Image

The blocklists are working as far as I can tell (I can't access sites in the blocklists) and the rejections are showing up in the dns log and the blocked queries log, so why is the blocked queries metric reporting nothing but zero?

Image

The blocked query response config is:

## Response for blocked queries. Options are `refused`, `hinfo` (default) or
## an IP response. To give an IP response, use the format `a:<IPv4>,aaaa:<IPv6>`.
## Using the `hinfo` option means that some responses will be lies.
## Unfortunately, the `hinfo` option appears to be required for Android 8+

blocked_query_response = 'refused'

Both instance of dnscrypt-proxy are running version 2.1.12.

This log line also keep appearing at every scrape interval, appears to always be for one of the two dnscrypt-proxy instances only. Perhaps one scrape job is needed per dnscrypt-proxy instance, instead of having one scrape job targeting multiple instances?

2025-06-28T13:03:18.173Z        warn    internal/transaction.go:150     Failed to scrape Prometheus endpoint    {"resource": {"service.instance.id": "pi", "service.name": "otelcol-contrib", "service.version": "0.128.0"}, "otelcol.component.id": "prometheus", "otelcol.component.kind": "receiver", "otelcol.signal": "metrics", "scrape_timestamp": 1751115788172, "target_labels": "{__name__=\"up\", instance=\"<server_1_hostname>:<server_1_port>\", job=\"dnscrypt-proxy\"}"}

Anyone have any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions