Skip to content

Commit

Permalink
[receiver/vcenter] Add vcenter.cluster.name resource attribute to d…
Browse files Browse the repository at this point in the history
…atastore metrics (open-telemetry#12360)

* add vcenter.cluster.name resource attribute to datastore metrics

* add changelog entry
  • Loading branch information
schmikei committed Jul 13, 2022
1 parent 2f47f46 commit 780d852
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion receiver/vcenterreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ func (v *vcenterMetricScraper) collectDatastores(
}

for _, ds := range datastores {
v.collectDatastore(ctx, colTime, ds, errs)
v.collectDatastore(ctx, colTime, ds, cluster, errs)
}
}

func (v *vcenterMetricScraper) collectDatastore(
ctx context.Context,
now pcommon.Timestamp,
ds *object.Datastore,
cluster *object.ClusterComputeResource,
errs *scrapererror.ScrapeErrors,
) {
var moDS mo.Datastore
Expand All @@ -206,6 +207,7 @@ func (v *vcenterMetricScraper) collectDatastore(

v.recordDatastoreProperties(now, moDS)
v.mb.EmitForResource(
metadata.WithVcenterClusterName(cluster.Name()),
metadata.WithVcenterDatastoreName(moDS.Name),
)
}
Expand Down
6 changes: 6 additions & 0 deletions receiver/vcenterreceiver/testdata/metrics/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3107,6 +3107,12 @@
"value": {
"stringValue": "vsanDatastore"
}
},
{
"key": "vcenter.cluster.name",
"value": {
"stringValue": "Cluster"
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,12 @@
"value": {
"stringValue": "vsanDatastore"
}
},
{
"key": "vcenter.cluster.name",
"value": {
"stringValue": "Cluster"
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
"value": {
"stringValue": "LocalDS_0"
}
},
{
"key": "vcenter.cluster.name",
"value": {
"stringValue": "DC0_C0"
}
}
]
},
Expand Down
16 changes: 16 additions & 0 deletions unreleased/vcenter-datastore-metrics-with-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'breaking'

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Adds the `vcenter.cluster.name` resource attribute to `vcenter.datastore` metrics

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

# (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:

0 comments on commit 780d852

Please sign in to comment.