fluent-plugin-kubernetes-metrics 1.1.9 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63a468c7d27e43160d49e2313a68a04d407ad7c73c52ecbb8b9e2c0f82d53da1
4
- data.tar.gz: 684f325072be6527f3e81173e99958f6a5dcb8ce977836da8ab2199f3b89c91d
3
+ metadata.gz: 7cba1f817de8b2ebcb68a6f96dcb0776105c9330ed7b7e6d46888bd1fe2a8290
4
+ data.tar.gz: 79b5be5e27f54edad68981e9f48f8827fe698c93584115287ea41b594591e928
5
5
  SHA512:
6
- metadata.gz: 5f0b516d906d32c4e00920c536ea1fd5e94ef54b630b2c3287868073b0fb9c553ac5e3f3d04ab78cb3af54c763a66927b369dd3b71c67777c81146ab566fafba
7
- data.tar.gz: 232a8c3fbd93881bd68e4b6a4fae34fa396050d9dbc9d8ae627afad12e3df55149f679720f7082ea042a847c543cab881ad197a301e466427bd8ee3c270ce091
6
+ metadata.gz: 4d4fd43d51357507698126408a618d38e81d7a5a9a956a3aafe4c46521b9d95bf22d680c52fca119d9c3f236b60dcdf028368948cc258981a64e34cd0f1e4ce8
7
+ data.tar.gz: 03ff9d6abf9511af983f52c1083062bc389fd976e0baf3045609df3a81e833e8ae2c787c5078870921a76246c37f3f2e01c3e20270ba0e0ca502aaa7105d8011
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-kubernetes-metrics (1.1.9)
4
+ fluent-plugin-kubernetes-metrics (1.1.10)
5
5
  fluentd (>= 1.9.1)
6
6
  kubeclient (~> 4.6.0)
7
7
  multi_json (~> 1.14.1)
@@ -19,7 +19,7 @@ GEM
19
19
  docile (1.4.0)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
- ffi (1.15.4)
22
+ ffi (1.15.5)
23
23
  ffi-compiler (1.0.1)
24
24
  ffi (>= 1.0.0)
25
25
  rake
@@ -56,7 +56,7 @@ GEM
56
56
  mime-types (3.4.1)
57
57
  mime-types-data (~> 3.2015)
58
58
  mime-types-data (3.2022.0105)
59
- msgpack (1.4.2)
59
+ msgpack (1.4.4)
60
60
  multi_json (1.14.1)
61
61
  netrc (0.11.0)
62
62
  oj (3.10.18)
@@ -70,7 +70,7 @@ GEM
70
70
  mime-types (>= 1.16, < 4.0)
71
71
  netrc (~> 0.8)
72
72
  rexml (3.2.5)
73
- serverengine (2.2.4)
73
+ serverengine (2.2.5)
74
74
  sigdump (~> 0.2.2)
75
75
  sigdump (0.2.4)
76
76
  simplecov (0.16.1)
@@ -107,4 +107,4 @@ DEPENDENCIES
107
107
  webmock (~> 3.5.1)
108
108
 
109
109
  BUNDLED WITH
110
- 2.3.5
110
+ 2.3.9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.9
1
+ 1.1.10
@@ -576,8 +576,42 @@ module Fluent
576
576
 
577
577
  unless pod['startTime'].nil?
578
578
  emit_uptime tag: tag, start_time: pod['startTime'], labels: labels
579
- emit_cpu_metrics tag: tag, metrics: pod['cpu'], labels: labels if pod['cpu'] unless pod['cpu'].nil?
580
- emit_memory_metrics tag: tag, metrics: pod['memory'], labels: labels if pod['memory'] unless pod['memory'].nil?
579
+ if pod['cpu'].nil?
580
+ if pod['containers'].nil? or Array(pod['containers']).empty?
581
+ log.warn "Summary API response has no pod cpu metrics information"
582
+ else
583
+ usageNanoCores = 0
584
+ usageCoreNanoSeconds = 0
585
+ time = nil
586
+ Array(pod['containers']).each do |container|
587
+ time = container['time'] unless container['time'].nil?
588
+ usageNanoCores += container['usageNanoCores']
589
+ usageCoreNanoSeconds += container['usageCoreNanoSeconds']
590
+ end
591
+ pod['cpu'] = { 'time' => time, 'usageNanoCores' => usageNanoCores, 'usageCoreNanoSeconds' => usageCoreNanoSeconds }
592
+ end
593
+ end
594
+ emit_cpu_metrics tag: tag, metrics: pod['cpu'], labels: labels unless pod['cpu'].nil?
595
+ if pod['memory'].nil?
596
+ if pod['containers'].nil? or Array(pod['containers']).empty?
597
+ log.warn "Summary API response has no pod memory metrics information"
598
+ else
599
+ Array(pod['containers']).each do |container|
600
+ time = nil
601
+ memory_metrics = {}
602
+ %w[availableBytes usageBytes workingSetBytes rssBytes pageFaults majorPageFaults].each do |name|
603
+ time = container['time'] unless container['time'].nil?
604
+ if value = metrics[name]
605
+ memory_metrics[name] = 0 if memory_metrics[name].nil?
606
+ memory_metrics[name] += value
607
+ end
608
+ end
609
+ end
610
+ memory_metrics['time'] = time
611
+ pod['memory'] = memory_metrics
612
+ end
613
+ end
614
+ emit_memory_metrics tag: tag, metrics: pod['memory'], labels: labels unless pod['memory'].nil?
581
615
  emit_network_metrics tag: tag, metrics: pod['network'], labels: labels unless pod['network'].nil?
582
616
  emit_fs_metrics tag: "#{tag}.ephemeral-storage", metrics: pod['ephemeral-storage'], labels: labels unless pod['ephemeral-storage'].nil?
583
617
  unless pod['volume'].nil?
@@ -595,6 +629,7 @@ module Fluent
595
629
 
596
630
  def emit_metrics(metrics)
597
631
  emit_node_metrics(metrics['node']) unless metrics['node'].nil?
632
+ log.warn "Summary API received empty pods info" if (metrics['pods'].nil? or metrics['pods'].empty?)
598
633
  Array(metrics['pods']).each &method(:emit_pod_metrics).curry.call(metrics['node']['nodeName']) unless metrics['pods'].nil?
599
634
  end
600
635
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-kubernetes-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Splunk Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-25 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -181,5 +181,5 @@ specification_version: 4
181
181
  summary: A fluentd input plugin that collects kubernetes cluster metrics.
182
182
  test_files:
183
183
  - test/helper.rb
184
- - test/plugin/test_missing_timestamps.rb
185
184
  - test/plugin/test_in_kubernetes_metrics.rb
185
+ - test/plugin/test_missing_timestamps.rb