lesovsky/pgscv

Number of labels and collected label values does not match, want 0, got 1

autokilla47 opened this issue · 2 comments

Starting pgscv:0.7.5 container in docker with this settings:

    ports:
      - 9890:9890
    environment:
      - PGSCV_LISTEN_ADDRESS=0.0.0.0:9890
      - PGSCV_DISABLE_COLLECTORS=system,postgres/settings
      - POSTGRES_DSN_TST01=postgresql://postgres:pass4word%23@10.10.10.10:5432/postgres

On the same host we have docker container with Postgres:14.0 version.
After start pgscv exporter, errors appear in the logs:

{"level":"info","service":"pgscv","time":"2022-11-16T06:45:11Z","message":"read configuration from environment"}
{"level":"info","service":"pgscv","time":"2022-11-16T06:45:11Z","message":"no-track disabled, for details check the documentation about 'no_track_mode' option."}
{"level":"info","service":"pgscv","time":"2022-11-16T06:45:11Z","message":"registered new service [system:0]"}
{"level":"info","service":"pgscv","time":"2022-11-16T06:45:11Z","message":"registered new service [TST01]"}
{"level":"info","service":"pgscv","time":"2022-11-16T06:45:11Z","message":"listen on http://0.0.0.0:9890"}
{"level":"error","service":"pgscv","time":"2022-11-16T06:45:20Z","message":"number of labels and collected label values does not match, want 0, got 1"}
{"level":"error","service":"pgscv","time":"2022-11-16T06:45:35Z","message":"number of labels and collected label values does not match, want 0, got 1"}
{"level":"error","service":"pgscv","time":"2022-11-16T06:45:50Z","message":"number of labels and collected label values does not match, want 0, got 1"}
{"level":"error","service":"pgscv","time":"2022-11-16T06:46:05Z","message":"number of labels and collected label values does not match, want 0, got 1"}
{"level":"error","service":"pgscv","time":"2022-11-16T06:46:20Z","message":"number of labels and collected label values does not match, want 0, got 1"}

We use Prometheus:v2.24.1 for scraping metrics. In the Prometheus we see that the metrics from the exporter are coming. But errors in the exporter are confusing.
Could you please explain the origin of these errors?

Some kind of metrics cannot be collected by pgSCV due to redundant or extra data fetched from sql views. Could you provide a simple docker-compose.yml with your setup (postgres with used config and pgscv only)

Some kind of metrics cannot be collected by pgSCV due to redundant or extra data fetched from sql views. Could you provide a simple docker-compose.yml with your setup (postgres with used config and pgscv only)

  postgres_exporter:
    image: pgscv:0.7.5
    container_name: pgscv
    ports:
      - 9890:9890
    environment:
      - PGSCV_LISTEN_ADDRESS=0.0.0.0:9890
      - PGSCV_DISABLE_COLLECTORS=system,postgres/settings
      - POSTGRES_DSN_TST01=postgresql://postgres:pass4word@10.10.10.10:5432/postgres
    restart: unless-stopped
 postgres:
    image: "postgres:14.4"
    container_name: postgres-14
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    shm_size: ${POSTGRES_SHM_SIZE}
    command:
      - "postgres"
      - "-c"
      - "shared_preload_libraries=pg_stat_statements"
      - "-c"
      - "pg_stat_statements.track=all"
#      - "-c"
#      - "track_io_timing=on"
      - "-c"
      - "max_connections=${POSTGRES_MAX_CONNECTIONS}"
      - "-c"
      - "shared_buffers=${POSTGRES_SHARED_BUFFERS}"
      - "-c"
      - "effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE}"
      - "-c"
      - "work_mem=${POSTGRES_WORK_MEM}"
      - "-c"
      - "maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM}"
      - "-c"
      - "random_page_cost=${POSTGRES_RANDOM_PAGE_COST}"
      - "-c"
      - "temp_file_limit=${POSTGRES_TEMP_FILE_LIMIT}"
      - "-c"
      - "log_min_duration_statement=${POSTGRES_LOG_MIN_DURATION_STATEMENT}"
      - "-c"
      - "idle_in_transaction_session_timeout=${POSTGRES_IDLE_IN_TRANSACTION_SESSION_TIMEOUT}"
      - "-c"
      - "lock_timeout=${POSTGRES_LOCK_TIMEOUT}"
      - "-c"
      - "pg_stat_statements.max=${POSTGRES_PG_STAT_STATEMENTS_MAX}"

    volumes:
      - /data/pgdata-14:/var/lib/postgresql/data
      - ./init.db:/docker-entrypoint-initdb.d
      - /data:/data
    ports:
      - $POSTGRES_EXTERNAL_PORT:5432