Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions entity-types/infra-container/golden_metrics.stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
cpuUsage:
title: CPU usage (cores)
queries:
newRelic:
select: max(docker.container.cpuUsedCores) or max(k8s.container.cpuUsedCores) as 'CPU used cores'
opentelemetry:
# Emulate a rate calculation using timestamps to get CPU cores used
# container.cpu.usage.total is in nanoseconds, divide by 1E9 to get seconds, then by time delta for cores
# See: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/dockerstatsreceiver/metadata.yaml
select: (sum(container.cpu.usage.total) / 1E9) / sum((endTimestamp - timestamp) / 1000) AS 'CPU usage (cores)'
cpuUtilization:
title: CPU utilization (%)
unit: PERCENTAGE
queries:
newRelic:
select: max(docker.container.cpuPercent) or max(k8s.container.cpuCoresUtilization) AS 'CPU Utilization (%)'
opentelemetry:
# via dockerstatsreceiver & kubeletstatsreceiver – which send equivalent value named container.cpu.usage, container.cpu.utilization (deprecated)
select: max(container.cpu.usage or container.cpu.utilization) AS 'CPU Utilization (%)'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is max this way correct, in some places you use the or inside and in others outside?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two fields that a customer can set up in their OTel configuration, enabling the ingestion of either or both simultaneously, specifically for the dockerstats receiver. The other queries listed here pertain to metrics from the Kubernetes receiver, which are separate and not currently within scope. Just as a note, this change has already been merged into the main branch.

memoryUsage:
title: Memory usage (bytes)
unit: BYTES
queries:
newRelic:
select: max(docker.container.memoryUsageBytes) or max(docker.container.memoryPrivateWorkingSet) or max(k8s.container.memoryWorkingSetBytes) AS 'Memory used (bytes)'
opentelemetry:
# via dockerstatsreceiver OR kubeletstatsreceiver respectively
select: max(container.memory.usage.total) or max(container.memory.usage) AS 'Memory used (bytes)'
storageUsage:
title: Storage usage (bytes)
unit: BYTES
queries:
newRelic:
select: max(docker.container.ioTotalBytes) or max(k8s.container.fsUsedPercent) AS 'Storage used (bytes)'
opentelemetry:
# via dockerstatsreceiver OR kubeletstatsreceiver respectively
select: max(container.blockio.io_service_bytes_recursive) or max(container.filesystem.usage) AS 'Storage used (bytes)'
networkTrafficTotal:
title: Network traffic (bytes per second)
unit: BYTES_PER_SECOND
queries:
newRelic:
select: max(docker.container.networkRxBytesPerSecond) + max(docker.container.networkTxBytesPerSecond) AS 'Network traffic (bytes per second)'
opentelemetry:
# Emulate a rate calculation using timestamps to get bytes per second
select: (sum(container.network.io.usage.rx_bytes) / sum((endTimestamp - timestamp) / 1000)) + (sum(container.network.io.usage.tx_bytes) / sum((endTimestamp - timestamp) / 1000)) AS 'Network traffic (bytes per second)'
25 changes: 25 additions & 0 deletions entity-types/infra-container/summary_metrics.stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
containerState:
title: Container state
unit: STRING
tag:
key: container.state
cpuUsage:
goldenMetric: cpuUsage
title: CPU usage (cores)
unit: COUNT
cpuUtilization:
goldenMetric: cpuUtilization
unit: PERCENTAGE
title: CPU utilization (%)
storageUsage:
goldenMetric: storageUsage
title: Storage usage (bytes)
unit: BYTES
memoryUsage:
goldenMetric: memoryUsage
title: Memory usage (bytes)
unit: BYTES
networkTrafficTotal:
goldenMetric: networkTrafficTotal
title: Network traffic (bytes per second)
unit: BYTES_PER_SECOND