Skip to content

Commit

Permalink
Added missing resource attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
arjun-mw committed Apr 19, 2024
1 parent d445997 commit af24f68
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 16 deletions.
16 changes: 8 additions & 8 deletions receiver/k8sclusterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,14 +519,14 @@ Current status reason of the pod (1 - Evicted, 2 - NodeAffinity, 3 - NodeLost, 4
| k8s.deployment.uid | The UID of the Deployment. | Any Str | true |
| k8s.hpa.name | The k8s hpa name. | Any Str | true |
| k8s.hpa.uid | The k8s hpa uid. | Any Str | true |
| k8s.ingress.annotations | Annotations of the Role. | Any Str | true |
| k8s.ingress.labels | Labels of the Role. | Any Str | true |
| k8s.ingress.name | The name of the Role. | Any Str | true |
| k8s.ingress.namespace | The namespace of the Role. | Any Str | true |
| k8s.ingress.rules | Rules of the Role. | Any Str | true |
| k8s.ingress.start_time | The start time of the Role. | Any Str | true |
| k8s.ingress.type | The type of the Role. | Any Str | true |
| k8s.ingress.uid | The UID of the Role. | Any Str | true |
| k8s.ingress.annotations | Annotations of the Ingress. | Any Str | true |
| k8s.ingress.labels | Labels of the Ingress. | Any Str | true |
| k8s.ingress.name | The name of the Ingress. | Any Str | true |
| k8s.ingress.namespace | The namespace of the Ingress. | Any Str | true |
| k8s.ingress.rules | Rules of the Ingress. | Any Str | true |
| k8s.ingress.start_time | The start time of the Ingress. | Any Str | true |
| k8s.ingress.type | The type of the Ingress. | Any Str | true |
| k8s.ingress.uid | The UID of the Ingress. | Any Str | true |
| k8s.job.name | The k8s pod name. | Any Str | true |
| k8s.job.start_time | The start time of the Job. | Any Str | true |
| k8s.job.uid | The k8s job uid. | Any Str | true |
Expand Down
2 changes: 1 addition & 1 deletion receiver/mongodbreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,4 @@ The amount of time that the server has been running.
| Name | Description | Values | Enabled |
| ---- | ----------- | ------ | ------- |
| database | The name of a database. | Any Str | true |
| mongodb.database.name | The name of a database (redundant). | Any Str | false |
| mongodb.database.name | The name of a database (redundant). | Any Str | true |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions receiver/mongodbreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ resource_attributes:
type: string
mongodb.database.name:
description: The name of a database (redundant).
enabled: true
type: string

attributes:
Expand Down
27 changes: 24 additions & 3 deletions receiver/mongodbreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ func (s *mongodbScraper) collectAdminDatabase(ctx context.Context, now pcommon.T
return
}
s.recordAdminStats(now, serverStatus, errs)
s.mb.EmitForResource()

rb := s.mb.NewResourceBuilder()
rb.SetDatabase("N/A")
rb.SetMongodbDatabaseName("N/A")

s.mb.EmitForResource(
metadata.WithResource(rb.Emit()),
)
}

func (s *mongodbScraper) collectTopStats(ctx context.Context, now pcommon.Timestamp, errs *scrapererror.ScrapeErrors) {
Expand All @@ -141,7 +148,14 @@ func (s *mongodbScraper) collectTopStats(ctx context.Context, now pcommon.Timest
return
}
s.recordOperationTime(now, topStats, errs)
s.mb.EmitForResource()

rb := s.mb.NewResourceBuilder()
rb.SetDatabase("N/A")
rb.SetMongodbDatabaseName("N/A")

s.mb.EmitForResource(
metadata.WithResource(rb.Emit()),
)
}

func (s *mongodbScraper) collectIndexStats(ctx context.Context, now pcommon.Timestamp, databaseName string, collectionName string, errs *scrapererror.ScrapeErrors) {
Expand All @@ -154,7 +168,14 @@ func (s *mongodbScraper) collectIndexStats(ctx context.Context, now pcommon.Time
return
}
s.recordIndexStats(now, indexStats, databaseName, collectionName, errs)
s.mb.EmitForResource()

rb := s.mb.NewResourceBuilder()
rb.SetDatabase("N/A")
rb.SetMongodbDatabaseName("N/A")

s.mb.EmitForResource(
metadata.WithResource(rb.Emit()),
)
}

func (s *mongodbScraper) recordDBStats(now pcommon.Timestamp, doc bson.M, dbName string, errs *scrapererror.ScrapeErrors) {
Expand Down
6 changes: 5 additions & 1 deletion receiver/postgresqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ func (p *postgreSQLScraper) scrape(ctx context.Context) (pmetric.Metrics, error)
p.collectWalAge(ctx, now, listClient, &errs)
p.collectReplicationStats(ctx, now, listClient, &errs)
p.collectMaxConnections(ctx, now, listClient, &errs)


rb := p.mb.NewResourceBuilder()
rb.SetPostgresqlDatabaseName("N/A")
p.mb.EmitForResource(metadata.WithResource(rb.Emit()))

return p.mb.Emit(), errs.combine()
}

Expand Down

0 comments on commit af24f68

Please sign in to comment.