Skip to content

Commit

Permalink
[receiver/hostmetrics/memory] Add system.memory.limit
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi committed Jan 5, 2024
1 parent b275884 commit 98848fc
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ An estimate of how much memory is available for starting new applications, witho
| ---- | ----------- | ---------- | ----------------------- | --------- |
| By | Sum | Int | Cumulative | false |
### system.memory.limit
Total bytes of memory available.
| Unit | Metric Type | Value Type | Aggregation Temporality | Monotonic |
| ---- | ----------- | ---------- | ----------------------- | --------- |
| By | Sum | Int | Cumulative | false |
### system.memory.utilization
Percentage of memory bytes in use.
Expand Down

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.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ all_set:
metrics:
system.linux.memory.available:
enabled: true
system.memory.limit:
enabled: true
system.memory.usage:
enabled: true
system.memory.utilization:
Expand All @@ -11,6 +13,8 @@ none_set:
metrics:
system.linux.memory.available:
enabled: false
system.memory.limit:
enabled: false
system.memory.usage:
enabled: false
system.memory.utilization:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func (s *scraper) start(ctx context.Context, _ component.Host) error {
return nil
}

func (s *scraper) recordMemoryLimitMetric(now pcommon.Timestamp, memInfo *mem.VirtualMemoryStat) {
s.mb.RecordSystemMemoryLimitDataPoint(now, int64(memInfo.Total))
}

func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
ctx = context.WithValue(ctx, common.EnvKey, s.envMap)

Expand All @@ -69,6 +73,7 @@ func (s *scraper) scrape(ctx context.Context) (pmetric.Metrics, error) {
memInfo.Total), metricsLen)
}
s.recordMemoryUtilizationMetric(now, memInfo)
s.recordMemoryLimitMetric(now, memInfo)
s.recordSystemSpecificMetrics(now, memInfo)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ attributes:
enum: [buffered, cached, inactive, free, slab_reclaimable, slab_unreclaimable, used]

metrics:
system.memory.limit:
enabled: false
description: Total bytes of memory available.
unit: By
sum:
value_type: int
aggregation_temporality: cumulative
monotonic: false

system.memory.usage:
enabled: true
description: Bytes of memory in use.
Expand Down

0 comments on commit 98848fc

Please sign in to comment.