This reference provides comprehensive YAML configurations for PostgreSQL monitoring with the New Relic Distribution of OpenTelemetry (NRDOT) Collector. These full-feature configurations include the complete PostgreSQL metric catalog for production environments across self-hosted and Amazon RDS deployments.
重要
Looking to get started quickly? These are advanced configurations for production use. If you're setting up PostgreSQL monitoring for the first time, we recommend starting with the standard configuration in our setup guides and returning to these comprehensive configurations once you've verified basic functionality.
Self-hosted
This configuration enables the complete PostgreSQL metric catalog the nrpostgresql receiver can produce, without adding host-level metrics.
1receivers:2 nrpostgresql:3 endpoint: "postgresql.example.com:5432"4 username: "newrelic"5 password: "YOUR_PASSWORD"6 databases:7 - YOUR_DATABASE_NAME8 collection_interval: 15s9 events:10 db.server.top_query:11 enabled: true12 db.server.query_sample:13 enabled: true14 db.server.query_plan:15 enabled: true16 top_query_collection:17 max_rows_per_query: 100018 top_n_query: 20019 collection_interval: 60s20 allowed_comment_keys: [nr_service_guid]21 query_sample_collection:22 max_rows_per_query: 100023 allowed_comment_keys: [nr_service_guid]24
25 resource_attributes:26 db.system.version:27 enabled: true28 # All metrics disabled by default in the receiver, enabled here for full dashboard coverage29 metrics:30 postgresql.blks_hit:31 enabled: true32 postgresql.blks_read:33 enabled: true34 postgresql.database.locks:35 enabled: true36 postgresql.deadlocks:37 enabled: true38 postgresql.function.calls:39 enabled: true40 postgresql.query.conflicts:41 enabled: true42 postgresql.query.execution.time:43 enabled: true44 postgresql.sequential_scans:45 enabled: true46 postgresql.temp.io:47 enabled: true48 postgresql.temp_files:49 enabled: true50 postgresql.tup_deleted:51 enabled: true52 postgresql.tup_fetched:53 enabled: true54 postgresql.tup_inserted:55 enabled: true56 postgresql.tup_returned:57 enabled: true58 postgresql.tup_updated:59 enabled: true60 postgresql.vector.insert.duration:61 enabled: true62 postgresql.vector.insert.rows:63 enabled: true64 postgresql.vector.search.calls:65 enabled: true66 postgresql.vector.search.duration:67 enabled: true68 postgresql.vector.search.rows_returned:69 enabled: true70 postgresql.wal.delay:71 enabled: true72
73processors:74 batch:75 batch/metrics:76 send_batch_size: 819277 send_batch_max_size: 819278 timeout: 10s79
80exporters:81 otlp/newrelic:82 endpoint: "https://otlp.nr-data.net:4318"83 headers:84 api-key: "YOUR_LICENSE_KEY"85 compression: gzip86 sending_queue:87 enabled: true88 sizer: bytes89 queue_size: 100_000_00090 num_consumers: 1091 batch:92 sizer: bytes93 max_size: 1_000_00094 min_size: 095 flush_timeout: 5s96 retry_on_failure:97 enabled: true98 initial_interval: 5s99 max_interval: 30s100 max_elapsed_time: 300s101
102service:103 telemetry:104 metrics:105 level: none106 pipelines:107 metrics:108 receivers: [nrpostgresql]109 processors: [batch/metrics]110 exporters: [otlp/newrelic]111 logs:112 receivers: [nrpostgresql]113 processors: [batch]114 exporters: [otlp/newrelic]重要
PostgreSQL integration via NRDOT Collector follows standard data ingest pricing. Note that full feature configuration ingests more data than a standard setup, which may increase your overall bill.
RDS
This configuration enables the complete PostgreSQL metric catalog the nrpostgresql receiver can produce, without adding host-level metrics.
1receivers:2 nrpostgresql:3 endpoint: "mydb-instance.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com:5432"4 username: "newrelic"5 password: "YOUR_PASSWORD"6 databases:7 - YOUR_DATABASE_NAME8 # top_query/query_sample scan pg_stat_statements/pg_stat_activity cluster-wide9 # regardless of the databases list above; on RDS/Aurora, exclude reserved10 # databases the monitoring user can never reach.11 exclude_databases:12 - rdsadmin13 collection_interval: 15s14 events:15 db.server.top_query:16 enabled: true17 db.server.query_sample:18 enabled: true19 db.server.query_plan:20 enabled: true21 top_query_collection:22 max_rows_per_query: 100023 top_n_query: 20024 collection_interval: 60s25 allowed_comment_keys: [nr_service_guid]26 query_sample_collection:27 max_rows_per_query: 100028 allowed_comment_keys: [nr_service_guid]29
30 resource_attributes:31 db.system.version:32 enabled: true33 # All metrics disabled by default in the receiver, enabled here for full dashboard coverage34 metrics:35 postgresql.blks_hit:36 enabled: true37 postgresql.blks_read:38 enabled: true39 postgresql.database.locks:40 enabled: true41 postgresql.deadlocks:42 enabled: true43 postgresql.function.calls:44 enabled: true45 postgresql.query.conflicts:46 enabled: true47 postgresql.query.execution.time:48 enabled: true49 postgresql.sequential_scans:50 enabled: true51 postgresql.temp.io:52 enabled: true53 postgresql.temp_files:54 enabled: true55 postgresql.tup_deleted:56 enabled: true57 postgresql.tup_fetched:58 enabled: true59 postgresql.tup_inserted:60 enabled: true61 postgresql.tup_returned:62 enabled: true63 postgresql.tup_updated:64 enabled: true65 postgresql.vector.insert.duration:66 enabled: true67 postgresql.vector.insert.rows:68 enabled: true69 postgresql.vector.search.calls:70 enabled: true71 postgresql.vector.search.duration:72 enabled: true73 postgresql.vector.search.rows_returned:74 enabled: true75 postgresql.wal.delay:76 enabled: true77
78processors:79 batch:80 batch/metrics:81 send_batch_size: 819282 send_batch_max_size: 819283 timeout: 10s84
85exporters:86 otlp/newrelic:87 endpoint: "https://otlp.nr-data.net:4318"88 headers:89 api-key: "YOUR_LICENSE_KEY"90 compression: gzip91 sending_queue:92 enabled: true93 sizer: bytes94 queue_size: 100_000_00095 num_consumers: 1096 batch:97 sizer: bytes98 max_size: 1_000_00099 min_size: 0100 flush_timeout: 5s101 retry_on_failure:102 enabled: true103 initial_interval: 5s104 max_interval: 30s105 max_elapsed_time: 300s106
107service:108 telemetry:109 metrics:110 level: none111 pipelines:112 metrics:113 receivers: [nrpostgresql]114 processors: [batch/metrics]115 exporters: [otlp/newrelic]116 logs:117 receivers: [nrpostgresql]118 processors: [batch]119 exporters: [otlp/newrelic]重要
PostgreSQL integration via NRDOT Collector follows standard data ingest pricing. Note that full feature configuration ingests more data than a standard setup, which may increase your overall bill.