diff --git a/receiver/postgresqlreceiver/documentation.md b/receiver/postgresqlreceiver/documentation.md
index e7b2a5870182..9e4f950a5798 100644
--- a/receiver/postgresqlreceiver/documentation.md
+++ b/receiver/postgresqlreceiver/documentation.md
@@ -8,13 +8,13 @@ These are the metrics available for this scraper.
| Name | Description | Unit | Type | Attributes |
| ---- | ----------- | ---- | ---- | ---------- |
-| postgresql.backends | The number of backends. | | Sum |
|
-| postgresql.blocks_read | The number of blocks read. | | Sum | |
-| postgresql.commits | The number of commits. | | Sum | |
-| postgresql.db_size | The database disk usage. | | Sum | |
-| postgresql.operations | The number of db row operations. | | Sum | |
-| postgresql.rollbacks | The number of rollbacks. | | Sum | |
-| postgresql.rows | The number of rows in the database. | | Sum | |
+| postgresql.backends | The number of backends. | 1 | Sum | |
+| postgresql.blocks_read | The number of blocks read. | 1 | Sum | |
+| postgresql.commits | The number of commits. | 1 | Sum | |
+| postgresql.db_size | The database disk usage. | By | Sum | |
+| postgresql.operations | The number of db row operations. | 1 | Sum | |
+| postgresql.rollbacks | The number of rollbacks. | 1 | Sum | |
+| postgresql.rows | The number of rows in the database. | 1 | Sum | |
## Attributes
diff --git a/receiver/postgresqlreceiver/internal/metadata/generated_metrics.go b/receiver/postgresqlreceiver/internal/metadata/generated_metrics.go
index 28df5db2a1c2..450a43463606 100644
--- a/receiver/postgresqlreceiver/internal/metadata/generated_metrics.go
+++ b/receiver/postgresqlreceiver/internal/metadata/generated_metrics.go
@@ -99,7 +99,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.backends")
metric.SetDescription("The number of backends.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -110,7 +110,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.blocks_read")
metric.SetDescription("The number of blocks read.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -121,7 +121,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.commits")
metric.SetDescription("The number of commits.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -132,7 +132,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.db_size")
metric.SetDescription("The database disk usage.")
- metric.SetUnit("")
+ metric.SetUnit("By")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -143,7 +143,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.operations")
metric.SetDescription("The number of db row operations.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -154,7 +154,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.rollbacks")
metric.SetDescription("The number of rollbacks.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(true)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
@@ -165,7 +165,7 @@ var Metrics = &metricStruct{
func(metric pdata.Metric) {
metric.SetName("postgresql.rows")
metric.SetDescription("The number of rows in the database.")
- metric.SetUnit("")
+ metric.SetUnit("1")
metric.SetDataType(pdata.MetricDataTypeSum)
metric.Sum().SetIsMonotonic(false)
metric.Sum().SetAggregationTemporality(pdata.MetricAggregationTemporalityCumulative)
diff --git a/receiver/postgresqlreceiver/metadata.yaml b/receiver/postgresqlreceiver/metadata.yaml
index 35a9af4e1d88..61f64fa4b383 100644
--- a/receiver/postgresqlreceiver/metadata.yaml
+++ b/receiver/postgresqlreceiver/metadata.yaml
@@ -19,49 +19,49 @@ attributes:
metrics:
postgresql.blocks_read:
description: The number of blocks read.
- units: 1
+ unit: 1
sum:
monotonic: true
aggregation: cumulative
attributes: [ database, table, source ]
postgresql.commits:
description: The number of commits.
- units: 1
+ unit: 1
sum:
monotonic: true
aggregation: cumulative
attributes: [ database ]
postgresql.db_size:
description: The database disk usage.
- units: By
+ unit: By
sum:
monotonic: false
aggregation: cumulative
attributes: [ database ]
postgresql.backends:
description: The number of backends.
- units: 1
+ unit: 1
sum:
monotonic: false
aggregation: cumulative
attributes: [ database ]
postgresql.rows:
description: The number of rows in the database.
- units: 1
+ unit: 1
sum:
monotonic: false
aggregation: cumulative
attributes: [ database, table, state ]
postgresql.operations:
description: The number of db row operations.
- units: 1
+ unit: 1
sum:
monotonic: true
aggregation: cumulative
attributes: [ database, table, operation ]
postgresql.rollbacks:
description: The number of rollbacks.
- units: 1
+ unit: 1
sum:
monotonic: true
aggregation: cumulative
diff --git a/receiver/postgresqlreceiver/testdata/scraper/multiple/expected.json b/receiver/postgresqlreceiver/testdata/scraper/multiple/expected.json
index 77df6897bd3a..46f264ed112d 100644
--- a/receiver/postgresqlreceiver/testdata/scraper/multiple/expected.json
+++ b/receiver/postgresqlreceiver/testdata/scraper/multiple/expected.json
@@ -10,6 +10,7 @@
{
"description": "The number of blocks read.",
"name": "postgresql.blocks_read",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -1172,6 +1173,7 @@
{
"description": "The number of commits.",
"name": "postgresql.commits",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -1218,6 +1220,7 @@
{
"description": "The database disk usage.",
"name": "postgresql.db_size",
+ "unit": "By",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -1263,6 +1266,7 @@
{
"description": "The number of backends.",
"name": "postgresql.backends",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -1308,6 +1312,7 @@
{
"description": "The number of rows in the database.",
"name": "postgresql.rows",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -1605,6 +1610,7 @@
{
"description": "The number of db row operations.",
"name": "postgresql.operations",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -2191,6 +2197,7 @@
{
"description": "The number of rollbacks.",
"name": "postgresql.rollbacks",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
diff --git a/receiver/postgresqlreceiver/testdata/scraper/otel/expected.json b/receiver/postgresqlreceiver/testdata/scraper/otel/expected.json
index 4d2100fd6b8c..5b3f9d2c286a 100644
--- a/receiver/postgresqlreceiver/testdata/scraper/otel/expected.json
+++ b/receiver/postgresqlreceiver/testdata/scraper/otel/expected.json
@@ -10,6 +10,7 @@
{
"description": "The number of blocks read.",
"name": "postgresql.blocks_read",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -404,6 +405,7 @@
{
"description": "The number of commits.",
"name": "postgresql.commits",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -426,6 +428,7 @@
{
"description": "The database disk usage.",
"name": "postgresql.db_size",
+ "unit": "By",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -447,6 +450,7 @@
{
"description": "The number of backends.",
"name": "postgresql.backends",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -468,6 +472,7 @@
{
"description": "The number of rows in the database.",
"name": "postgresql.rows",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -573,6 +578,7 @@
{
"description": "The number of db row operations.",
"name": "postgresql.operations",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [
@@ -775,6 +781,7 @@
{
"description": "The number of rollbacks.",
"name": "postgresql.rollbacks",
+ "unit": "1",
"sum": {
"aggregationTemporality": "AGGREGATION_TEMPORALITY_CUMULATIVE",
"dataPoints": [