Skip to content

Commit

Permalink
[receiver/mongodbatlasreceiver] added mongodb_atlas.user.alias attrib…
Browse files Browse the repository at this point in the history
…ute;the user-friendly hostname of the cluster node as displayed in the Atlas portal.

Signed-off-by: Dani Louca <[email protected]>
  • Loading branch information
dloucasfx committed Apr 10, 2023
1 parent 3dc9d21 commit 3b08ada
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .chloggen/mongodbatlasreceiver-add-attribute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: emit "`mongodb_atlas.user.alias`" attribute which is the user-friendly hostname of the cluster node as displayed in the Atlas portal.
This attribute is disabled by default, if you want to emit it, you'll need to explicitly enable it.

# One or more tracking issues related to the change
issues: [18881]

# (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:
1 change: 1 addition & 0 deletions receiver/mongodbatlasreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -972,3 +972,4 @@ Aggregate of MongoDB Metrics MAX_SWAP_USAGE_FREE, MAX_SWAP_USAGE_USED
| mongodb_atlas.process.type_name | Process type | Any Str | true |
| mongodb_atlas.project.id | Project ID | Any Str | true |
| mongodb_atlas.project.name | Project Name | Any Str | true |
| mongodb_atlas.user.alias | User-friendly hostname of the cluster node | Any Str | false |

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.

Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ all_set:
enabled: true
mongodb_atlas.project.name:
enabled: true
mongodb_atlas.user.alias:
enabled: true
none_set:
metrics:
mongodbatlas.db.counts:
Expand Down Expand Up @@ -293,3 +295,5 @@ none_set:
enabled: false
mongodb_atlas.project.name:
enabled: false
mongodb_atlas.user.alias:
enabled: false
4 changes: 4 additions & 0 deletions receiver/mongodbatlasreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ resource_attributes:
description: Hostname of the process
enabled: true
type: string
mongodb_atlas.user.alias:
description: User-friendly hostname of the cluster node
enabled: false
type: string
mongodb_atlas.process.port:
description: Port process is bound to
enabled: true
Expand Down
3 changes: 3 additions & 0 deletions receiver/mongodbatlasreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (s *receiver) poll(ctx context.Context, time timeconstraints) error {
metadata.WithMongodbAtlasProjectName(project.Name),
metadata.WithMongodbAtlasProjectID(project.ID),
metadata.WithMongodbAtlasHostName(process.Hostname),
metadata.WithMongodbAtlasUserAlias(process.UserAlias),
metadata.WithMongodbAtlasProcessPort(strconv.Itoa(process.Port)),
metadata.WithMongodbAtlasProcessTypeName(process.TypeName),
metadata.WithMongodbAtlasProcessID(process.ID),
Expand Down Expand Up @@ -195,6 +196,7 @@ func (s *receiver) extractProcessDatabaseMetrics(
metadata.WithMongodbAtlasProjectName(project.Name),
metadata.WithMongodbAtlasProjectID(project.ID),
metadata.WithMongodbAtlasHostName(process.Hostname),
metadata.WithMongodbAtlasUserAlias(process.UserAlias),
metadata.WithMongodbAtlasProcessPort(strconv.Itoa(process.Port)),
metadata.WithMongodbAtlasProcessTypeName(process.TypeName),
metadata.WithMongodbAtlasProcessID(process.ID),
Expand Down Expand Up @@ -230,6 +232,7 @@ func (s *receiver) extractProcessDiskMetrics(
metadata.WithMongodbAtlasProjectName(project.Name),
metadata.WithMongodbAtlasProjectID(project.ID),
metadata.WithMongodbAtlasHostName(process.Hostname),
metadata.WithMongodbAtlasUserAlias(process.UserAlias),
metadata.WithMongodbAtlasProcessPort(strconv.Itoa(process.Port)),
metadata.WithMongodbAtlasProcessTypeName(process.TypeName),
metadata.WithMongodbAtlasProcessID(process.ID),
Expand Down

0 comments on commit 3b08ada

Please sign in to comment.