Skip to content

Commit

Permalink
[receiver/mongodb] remove duplicate database name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulali committed Nov 21, 2023
1 parent 9993dc6 commit a0fa510
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 289 deletions.
27 changes: 27 additions & 0 deletions .chloggen/mongodbreceiver-duplicate-attribute-24972.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'bug_fix'

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mongodbreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Remove duplicate database name attribute, database name reported as a datapoint attribute and as a resource attribute, one of them should be removed

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [24972]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
6 changes: 0 additions & 6 deletions receiver/mongodbreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,3 @@ The amount of time that the server has been running.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| ms | Sum | Int | Cumulative | true |
## Resource Attributes
| Name | Description | Values | Enabled |
| ---- | ----------- | ------ | ------- |
| database | The name of a database. | Any Str | true |
38 changes: 2 additions & 36 deletions receiver/mongodbreceiver/internal/metadata/generated_config.go

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.

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.

36 changes: 0 additions & 36 deletions receiver/mongodbreceiver/internal/metadata/generated_resource.go

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ all_set:
enabled: true
mongodb.uptime:
enabled: true
resource_attributes:
database:
enabled: true
none_set:
metrics:
mongodb.cache.operations:
Expand Down Expand Up @@ -126,6 +123,3 @@ none_set:
enabled: false
mongodb.uptime:
enabled: false
resource_attributes:
database:
enabled: false
6 changes: 0 additions & 6 deletions receiver/mongodbreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ status:
codeowners:
active: [djaglowski, schmikei]

resource_attributes:
database:
description: The name of a database.
enabled: true
type: string

attributes:
database:
description: The name of a database.
Expand Down
5 changes: 1 addition & 4 deletions receiver/mongodbreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ func (s *mongodbScraper) collectDatabase(ctx context.Context, now pcommon.Timest
return
}
s.recordNormalServerStats(now, serverStatus, databaseName, errs)

rb := s.mb.NewResourceBuilder()
rb.SetDatabase(databaseName)
s.mb.EmitForResource(metadata.WithResource(rb.Emit()))
s.mb.EmitForResource()
}

func (s *mongodbScraper) collectAdminDatabase(ctx context.Context, now pcommon.Timestamp, errs *scrapererror.ScrapeErrors) {
Expand Down
20 changes: 4 additions & 16 deletions receiver/mongodbreceiver/testdata/integration/expected.4_0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,7 @@ resourceMetrics:
name: otelcol/mongodbreceiver
version: latest
- resource:
attributes:
- key: database
value:
stringValue: admin
attributes: []
scopeMetrics:
- metrics:
- description: The number of collections.
Expand Down Expand Up @@ -429,10 +426,7 @@ resourceMetrics:
name: otelcol/mongodbreceiver
version: latest
- resource:
attributes:
- key: database
value:
stringValue: config
attributes: []
scopeMetrics:
- metrics:
- description: The number of collections.
Expand Down Expand Up @@ -652,10 +646,7 @@ resourceMetrics:
name: otelcol/mongodbreceiver
version: latest
- resource:
attributes:
- key: database
value:
stringValue: local
attributes: []
scopeMetrics:
- metrics:
- description: The number of collections.
Expand Down Expand Up @@ -852,10 +843,7 @@ resourceMetrics:
name: otelcol/mongodbreceiver
version: latest
- resource:
attributes:
- key: database
value:
stringValue: testdb
attributes: []
scopeMetrics:
- metrics:
- description: The number of collections.
Expand Down
Loading

0 comments on commit a0fa510

Please sign in to comment.