Skip to content

Commit

Permalink
Add metrics and resource attribute config options from vcentereceiver…
Browse files Browse the repository at this point in the history
… in docs and tests (#5813)



Co-authored-by: Paulin Todev <[email protected]>
  • Loading branch information
marctc and ptodev authored Nov 21, 2023
1 parent 7d775c1 commit 6c028c0
Show file tree
Hide file tree
Showing 2 changed files with 265 additions and 3 deletions.
190 changes: 187 additions & 3 deletions component/otelcol/receiver/vcenter/vcenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,144 @@ func TestArguments_UnmarshalRiver(t *testing.T) {
password = "pass"
collection_interval = "2m"
resource_attributes {
vcenter.cluster.name {
enabled = true
}
vcenter.datastore.name {
enabled = true
}
vcenter.host.name {
enabled = true
}
vcenter.resource_pool.inventory_path {
enabled = false
}
vcenter.resource_pool.name {
enabled = true
}
vcenter.vm.name {
enabled = true
}
}
metrics {
vcenter.cluster.cpu.effective {
enabled = false
}
vcenter.cluster.cpu.limit {
enabled = true
}
vcenter.cluster.host.count {
enabled = true
}
vcenter.cluster.memory.effective {
enabled = true
}
vcenter.cluster.memory.limit {
enabled = true
}
vcenter.cluster.memory.used {
enabled = true
}
vcenter.cluster.vm.count {
enabled = true
}
vcenter.datastore.disk.usage {
enabled = true
}
vcenter.datastore.disk.utilization {
enabled = true
}
vcenter.host.cpu.usage {
enabled = true
}
vcenter.host.cpu.utilization {
enabled = true
}
vcenter.host.disk.latency.avg {
enabled = true
}
vcenter.host.disk.latency.max {
enabled = true
}
vcenter.host.disk.throughput {
enabled = true
}
vcenter.host.memory.usage {
enabled = true
}
vcenter.host.memory.utilization {
enabled = true
}
vcenter.host.network.packet.count {
enabled = true
}
vcenter.host.network.packet.errors {
enabled = true
}
vcenter.host.network.throughput {
enabled = true
}
vcenter.host.network.usage {
enabled = true
}
vcenter.resource_pool.cpu.shares {
enabled = true
}
vcenter.resource_pool.cpu.usage {
enabled = true
}
vcenter.resource_pool.memory.shares {
enabled = true
}
vcenter.resource_pool.memory.usage {
enabled = true
}
vcenter.vm.cpu.usage {
enabled = true
}
vcenter.vm.cpu.utilization {
enabled = true
}
vcenter.vm.disk.latency.avg {
enabled = true
}
vcenter.vm.disk.latency.max {
enabled = true
}
vcenter.vm.disk.throughput {
enabled = true
}
vcenter.vm.disk.usage {
enabled = true
}
vcenter.vm.disk.utilization {
enabled = true
}
vcenter.vm.memory.ballooned {
enabled = true
}
vcenter.vm.memory.swapped {
enabled = true
}
vcenter.vm.memory.swapped_ssd {
enabled = true
}
vcenter.vm.memory.usage {
enabled = true
}
vcenter.vm.network.packet.count {
enabled = true
}
vcenter.vm.network.throughput {
enabled = true
}
vcenter.vm.network.usage {
enabled = true
}
}
output { /* no-op */ }
`

Expand All @@ -36,7 +174,53 @@ func TestArguments_UnmarshalRiver(t *testing.T) {
require.Equal(t, time.Second, otelArgs.ScraperControllerSettings.InitialDelay)
require.Equal(t, 0*time.Second, otelArgs.ScraperControllerSettings.Timeout)

require.Equal(t, true, otelArgs.Metrics.VcenterClusterCPUEffective.Enabled)
require.Equal(t, false, otelArgs.Metrics.VcenterVMMemoryUtilization.Enabled)
require.Equal(t, true, otelArgs.ResourceAttributes.VcenterClusterName.Enabled)
// Verify ResourceAttributesConfig fields
require.True(t, otelArgs.ResourceAttributes.VcenterClusterName.Enabled)
require.True(t, otelArgs.ResourceAttributes.VcenterDatastoreName.Enabled)
require.True(t, otelArgs.ResourceAttributes.VcenterHostName.Enabled)
require.False(t, otelArgs.ResourceAttributes.VcenterResourcePoolInventoryPath.Enabled)
require.True(t, otelArgs.ResourceAttributes.VcenterResourcePoolName.Enabled)
require.True(t, otelArgs.ResourceAttributes.VcenterVMName.Enabled)
require.True(t, otelArgs.ResourceAttributes.VcenterVMID.Enabled)

// Verify MetricsConfig fields
require.False(t, otelArgs.Metrics.VcenterClusterCPUEffective.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterCPULimit.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterHostCount.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterMemoryEffective.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterMemoryLimit.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterMemoryUsed.Enabled)
require.True(t, otelArgs.Metrics.VcenterClusterVMCount.Enabled)
require.True(t, otelArgs.Metrics.VcenterDatastoreDiskUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterDatastoreDiskUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostCPUUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostCPUUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostDiskLatencyAvg.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostDiskLatencyMax.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostDiskThroughput.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostMemoryUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostMemoryUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostNetworkPacketCount.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostNetworkPacketErrors.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostNetworkThroughput.Enabled)
require.True(t, otelArgs.Metrics.VcenterHostNetworkUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterResourcePoolCPUShares.Enabled)
require.True(t, otelArgs.Metrics.VcenterResourcePoolCPUUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterResourcePoolMemoryShares.Enabled)
require.True(t, otelArgs.Metrics.VcenterResourcePoolMemoryUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMCPUUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMCPUUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMDiskLatencyAvg.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMDiskLatencyMax.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMDiskThroughput.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMDiskUsage.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMDiskUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMMemoryBallooned.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMMemorySwapped.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMMemorySwappedSsd.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMMemoryUsage.Enabled)
require.False(t, otelArgs.Metrics.VcenterVMMemoryUtilization.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMNetworkPacketCount.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMNetworkThroughput.Enabled)
require.True(t, otelArgs.Metrics.VcenterVMNetworkUsage.Enabled)
}
78 changes: 78 additions & 0 deletions docs/sources/flow/reference/components/otelcol.receiver.vcenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ The following blocks are supported inside the definition of
Hierarchy | Block | Description | Required
--------- | ----- | ----------- | --------
tls | [tls][] | Configures TLS for the HTTP client. | no
metrics | [metrics][] | Configures which metrics will be sent to downstream components. | no
resource_attributes | [resource_attributes][] | Configures resource attributes for metrics sent to downstream components. | no
debug_metrics | [debug_metrics][] | Configures the metrics that this component generates to monitor its state. | no
output | [output][] | Configures where to send received telemetry data. | yes

[tls]: #tls-block
[debug_metrics]: #debug_metrics-block
[metrics]: #metrics-block
[resource_attributes]: #resource_attributes-block
[output]: #output-block

### tls block
Expand All @@ -92,6 +96,80 @@ isn't provided, TLS won't be used for connections to the server.

{{< docs/shared lookup="flow/reference/components/otelcol-tls-config-block.md" source="agent" version="<AGENT VERSION>" >}}

### metrics block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`vcenter.cluster.cpu.effective` | [metric][] | Enables the `vcenter.cluster.cpu.effective` metric. | `true` | no
`vcenter.cluster.cpu.usage` | [metric][] | Enables the `vcenter.cluster.cpu.usage` metric. | `true` | no
`vcenter.cluster.host.count` | [metric][] | Enables the `vcenter.cluster.host.count` metric. | `true` | no
`vcenter.cluster.memory.effective` | [metric][] | Enables the `vcenter.cluster.memory.effective` metric. | `true` | no
`vcenter.cluster.memory.limit` | [metric][] | Enables the `vcenter.cluster.memory.limit` metric. | `true` | no
`vcenter.cluster.memory.used` | [metric][] | Enables the `vcenter.cluster.memory.used` metric. | `true` | no
`vcenter.cluster.vm.count` | [metric][] | Enables the `vcenter.cluster.vm.count` metric. | `true` | no
`vcenter.datastore.disk.usage` | [metric][] | Enables the `vcenter.datastore.disk.usage` metric. | `true` | no
`vcenter.datastore.disk.utilization` | [metric][] | Enables the `vcenter.datastore.disk.utilization` metric. | `true` | no
`vcenter.host.cpu.usage` | [metric][] | Enables the `vcenter.host.cpu.usage` metric. | `true` | no
`vcenter.host.cpu.utilization` | [metric][] | Enables the `vcenter.host.cpu.utilization` metric. | `true` | no
`vcenter.host.disk.latency.avg` | [metric][] | Enables the `vcenter.host.disk.latency.avg` metric. | `true` | no
`vcenter.host.disk.latency.max` | [metric][] | Enables the `vcenter.host.disk.latency.max` metric. | `true` | no
`vcenter.host.disk.throughput` | [metric][] | Enables the `vcenter.host.disk.throughput` metric. | `true` | no
`vcenter.host.memory.usage` | [metric][] | Enables the `vcenter.host.memory.usage` metric. | `true` | no
`vcenter.host.memory.utilization` | [metric][] | Enables the `vcenter.host.memory.utilization` metric. | `true` | no
`vcenter.host.network.packet.count` | [metric][] | Enables the `vcenter.host.network.packet.count` metric. | `true` | no
`vcenter.host.network.packet.errors` | [metric][] | Enables the `vcenter.host.network.packet.errors` metric. | `true` | no
`vcenter.host.network.throughput` | [metric][] | Enables the `vcenter.host.network.throughput` metric. | `true` | no
`vcenter.host.network.usage` | [metric][] | Enables the `vcenter.host.network.usage` metric. | `true` | no
`vcenter.resource_pool.cpu.shares` | [metric][] | Enables the `vcenter.resource_pool.cpu.shares` metric. | `true` | no
`vcenter.resource_pool.cpu.usage` | [metric][] | Enables the `vcenter.resource_pool.cpu.usage` metric. | `true` | no
`vcenter.resource_pool.memory.shares` | [metric][] | Enables the `vcenter.resource_pool.memory.shares` metric. | `true` | no
`vcenter.resource_pool.memory.usage` | [metric][] | Enables the `vcenter.resource_pool.memory.usage` metric. | `true` | no
`vcenter.vm.cpu.usage` | [metric][] | Enables the `vcenter.vm.cpu.usage` metric. | `true` | no
`vcenter.vm.cpu.utilization` | [metric][] | Enables the `vcenter.vm.cpu.utilization` metric. | `true` | no
`vcenter.vm.disk.latency.avg` | [metric][] | Enables the `vcenter.vm.disk.latency.avg` metric. | `true` | no
`vcenter.vm.disk.latency.max` | [metric][] | Enables the `vcenter.vm.disk.latency.max` metric. | `true` | no
`vcenter.vm.disk.throughput` | [metric][] | Enables the `vcenter.vm.disk.throughput` metric. | `true` | no
`vcenter.vm.disk.usage` | [metric][] | Enables the `vcenter.vm.disk.usage` metric. | `true` | no
`vcenter.vm.disk.utilization` | [metric][] | Enables the `vcenter.vm.disk.utilization` metric. | `true` | no
`vcenter.vm.memory.ballooned` | [metric][] | Enables the `vcenter.vm.memory.ballooned` metric. | `true` | no
`vcenter.vm.memory.swapped` | [metric][] | Enables the `vcenter.vm.memory.swapped` metric. | `true` | no
`vcenter.vm.memory.swapped_ssd` | [metric][] | Enables the `vcenter.vm.memory.swapped_ssd` metric. | `true` | no
`vcenter.vm.memory.usage` | [metric][] | Enables the `vcenter.vm.memory.usage` metric. | `true` | no
`vcenter.vm.memory.utilization` | [metric][] | Enables the `vcenter.vm.memory.utilization` metric. | `false` | no
`vcenter.vm.network.packet.count` | [metric][] | Enables the `vcenter.vm.network.packet.count` metric. | `true` | no
`vcenter.vm.network.throughput` | [metric][] | Enables the `vcenter.vm.network.throughput` metric. | `true` | no
`vcenter.vm.network.usage` | [metric][] | Enables the `vcenter.vm.network.usage` metric. | `true` | no

[metric]: #metric-block

#### metric block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`enabled` | `boolean` | Whether to enable the metric. | `true` | no


### resource_attributes block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`vcenter.cluster.name` | [resource_attribute][] | Enables the `vcenter.cluster.name` resource attribute. | `true` | no
`vcenter.datastore.name` | [resource_attribute][] | Enables the `vcenter.cluster.resource_pool` resource attribute. | `true` | no
`vcenter.host.name` | [resource_attribute][] | Enables the `vcenter.host.name` resource attribute. | `true` | no
`vcenter.resource_pool.inventory_path` | [resource_attribute][] | Enables the `vcenter.resource_pool.inventory_path` resource attribute. | `true` | no
`vcenter.resource_pool.name` | [resource_attribute][] | Enables the `vcenter.resource_pool.name` resource attribute. | `true` | no
`vcenter.vm.id` | [resource_attribute][] | Enables the `vcenter.vm.id` resource attribute. | `true` | no
`vcenter.vm.name` | [resource_attribute][] | Enables the `vcenter.vm.name` resource attribute. | `true` | no

[resource_attribute]: #resource_attribute-block

#### resource_attribute block

Name | Type | Description | Default | Required
---- | ---- | ----------- | ------- | --------
`enabled` | `boolean` | Whether to enable the resource attribute. | `true` | no


### debug_metrics block

{{< docs/shared lookup="flow/reference/components/otelcol-debug-metrics-block.md" source="agent" version="<AGENT VERSION>" >}}
Expand Down

0 comments on commit 6c028c0

Please sign in to comment.