fluent-plugin-k8s-metrics-agg 1.1.4 → 1.1.5

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: c9e5776b755e33b3424b6f69fdb6780e258399a14ea14f0240a4c8d9e228950e
4
- data.tar.gz: 8c65a1ee8e6638b1df574dd5e93c567692cf449a084a097bd1c9afb70f2b71c2
3
+ metadata.gz: 1ed001cdfb56d96374f5fc2d09ee318827286b4fadefd0295d93b682cbe6921c
4
+ data.tar.gz: 2d863a2438ac373c19252f551c83c9e4d2b18e8042b656747597c093497e8a69
5
5
  SHA512:
6
- metadata.gz: 5fd7390614b3e3d817d7a6886983b26fc9da16f29d5e890a6d1e99be2c7614cd7ef5ca0779cde3f8f4d54201a0ea752621d95166a90358be97800d13b79c76cc
7
- data.tar.gz: 51b3b36d36951a0e82240dba44c5667d1670f6ac1e71bff460d16bef954f3a1e7341a372ab614b13c7f95ee63945e8b3316dd9639f2d12e9abf74fe88d21fcda
6
+ metadata.gz: 6230fa97e57503d1e120cb84e116be613429a441a4c0c7bd156001a6283a467ee5f430ff7baa269fc8df099564b8595222f62515d71f07fb57c3a58b8919ad13
7
+ data.tar.gz: 6b3acd0eff4fdb3155eb1cbc5629ec2a254965504ba647200067101d1bbe10a8ae33fddff6929f4264826bca343281a8c1082b30653fe8c8d5fbce0ac5f38f6a
data/.circleci/config.yml CHANGED
@@ -41,7 +41,7 @@ jobs:
41
41
  command: |
42
42
  bundle exec rake test -t -v
43
43
 
44
- func_test_master:
44
+ func_test_main:
45
45
  docker:
46
46
  - image: circleci/ruby:2.6.1-node-browsers
47
47
  working_directory: ~/repo
@@ -52,7 +52,7 @@ jobs:
52
52
  - run:
53
53
  name: trigger
54
54
  command: |
55
- .circleci/trigger_func_test.sh master
55
+ .circleci/trigger_func_test.sh main
56
56
 
57
57
  func_test_develop:
58
58
  docker:
@@ -76,11 +76,11 @@ workflows:
76
76
  branches:
77
77
  ignore:
78
78
  - /^release\/.*/
79
- - master
79
+ - main
80
80
  - unit_test:
81
81
  requires:
82
82
  - build
83
- - func_test_master:
83
+ - func_test_main:
84
84
  requires:
85
85
  - unit_test
86
86
  - func_test_develop:
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- # trigger SCK 'master' branch to introduce this new image from this commit
3
+ # trigger SCK 'main' branch to introduce this new image from this commit
4
4
  # to working version of every other component.
5
5
  ORGANIZATION=splunk
6
6
  PROJECT=splunk-connect-for-kubernetes
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-k8s-metrics-agg (1.1.4)
5
- fluentd (~> 1.9.1)
4
+ fluent-plugin-k8s-metrics-agg (1.1.5)
5
+ fluentd (>= 1.9.1)
6
6
  kubeclient (~> 4.6.0)
7
7
  multi_json (~> 1.14.1)
8
8
  oj (~> 3.10.2)
@@ -10,31 +10,32 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.6.0)
14
- public_suffix (>= 2.0.2, < 4.0)
15
- concurrent-ruby (1.1.6)
16
- cool.io (1.6.0)
17
- crack (0.4.3)
18
- safe_yaml (~> 1.0.0)
19
- docile (1.3.1)
13
+ addressable (2.7.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ concurrent-ruby (1.1.8)
16
+ cool.io (1.7.1)
17
+ crack (0.4.5)
18
+ rexml
19
+ docile (1.3.5)
20
20
  domain_name (0.5.20190701)
21
21
  unf (>= 0.0.5, < 1.0.0)
22
- ffi (1.12.2)
22
+ ffi (1.14.2)
23
23
  ffi-compiler (1.0.1)
24
24
  ffi (>= 1.0.0)
25
25
  rake
26
- fluentd (1.9.2)
26
+ fluentd (1.12.1)
27
+ bundler
27
28
  cool.io (>= 1.4.5, < 2.0.0)
28
29
  http_parser.rb (>= 0.5.1, < 0.7.0)
29
30
  msgpack (>= 1.3.1, < 2.0.0)
30
- serverengine (>= 2.0.4, < 3.0.0)
31
+ serverengine (>= 2.2.2, < 3.0.0)
31
32
  sigdump (~> 0.2.2)
32
33
  strptime (>= 0.2.2, < 1.0.0)
33
34
  tzinfo (>= 1.0, < 3.0)
34
35
  tzinfo-data (~> 1.0)
35
36
  yajl-ruby (~> 1.0)
36
- hashdiff (0.3.8)
37
- http (4.3.0)
37
+ hashdiff (1.0.1)
38
+ http (4.4.1)
38
39
  addressable (~> 2.3)
39
40
  http-cookie (~> 1.0)
40
41
  http-form_data (~> 2.2)
@@ -42,33 +43,33 @@ GEM
42
43
  http-accept (1.7.0)
43
44
  http-cookie (1.0.3)
44
45
  domain_name (~> 0.5)
45
- http-form_data (2.2.0)
46
- http-parser (1.2.1)
46
+ http-form_data (2.3.0)
47
+ http-parser (1.2.3)
47
48
  ffi-compiler (>= 1.0, < 2.0)
48
49
  http_parser.rb (0.6.0)
49
- json (2.3.1)
50
+ json (2.5.1)
50
51
  kubeclient (4.6.0)
51
52
  http (>= 3.0, < 5.0)
52
53
  recursive-open-struct (~> 1.0, >= 1.0.4)
53
54
  rest-client (~> 2.0)
54
55
  mime-types (3.3.1)
55
56
  mime-types-data (~> 3.2015)
56
- mime-types-data (3.2019.1009)
57
- msgpack (1.3.3)
57
+ mime-types-data (3.2021.0225)
58
+ msgpack (1.4.2)
58
59
  multi_json (1.14.1)
59
60
  netrc (0.11.0)
60
- oj (3.10.2)
61
- power_assert (1.1.3)
62
- public_suffix (3.0.3)
63
- rake (13.0.1)
64
- recursive-open-struct (1.1.0)
61
+ oj (3.10.18)
62
+ power_assert (2.0.0)
63
+ public_suffix (4.0.6)
64
+ rake (13.0.3)
65
+ recursive-open-struct (1.1.3)
65
66
  rest-client (2.1.0)
66
67
  http-accept (>= 1.7.0, < 2.0)
67
68
  http-cookie (>= 1.0.2, < 2.0)
68
69
  mime-types (>= 1.16, < 4.0)
69
70
  netrc (~> 0.8)
70
- safe_yaml (1.0.4)
71
- serverengine (2.2.1)
71
+ rexml (3.2.4)
72
+ serverengine (2.2.3)
72
73
  sigdump (~> 0.2.2)
73
74
  sigdump (0.2.4)
74
75
  simplecov (0.16.1)
@@ -76,16 +77,16 @@ GEM
76
77
  json (>= 1.8, < 3)
77
78
  simplecov-html (~> 0.10.0)
78
79
  simplecov-html (0.10.2)
79
- strptime (0.2.3)
80
- test-unit (3.3.0)
80
+ strptime (0.2.5)
81
+ test-unit (3.3.9)
81
82
  power_assert
82
- tzinfo (2.0.1)
83
+ tzinfo (2.0.4)
83
84
  concurrent-ruby (~> 1.0)
84
- tzinfo-data (1.2019.3)
85
+ tzinfo-data (1.2021.1)
85
86
  tzinfo (>= 1.0.0)
86
87
  unf (0.1.4)
87
88
  unf_ext
88
- unf_ext (0.0.7.6)
89
+ unf_ext (0.0.7.7)
89
90
  webmock (3.5.1)
90
91
  addressable (>= 2.3.6)
91
92
  crack (>= 0.3.2)
@@ -104,4 +105,4 @@ DEPENDENCIES
104
105
  webmock (~> 3.5.1)
105
106
 
106
107
  BUNDLED WITH
107
- 2.1.4
108
+ 2.2.7
data/Makefile CHANGED
@@ -1,10 +1,11 @@
1
1
  VERSION := $(shell sh -c 'cat VERSION')
2
+ NODEJS_VERSION := 14.15.1
2
3
 
3
4
  clean_pkg:
4
5
  @rm -rf pkg/* docker/*.gem
5
6
 
6
7
  clean_gems:
7
- @rm -rf docker/gem/ docker/gems/
8
+ @rm -rf docker/gem/* docker/gems/*
8
9
 
9
10
  clean: clean_pkg clean_gems
10
11
  @rm -rf docker/licenses
@@ -16,7 +17,7 @@ docker: build install-deps
16
17
  @cp pkg/fluent-plugin-*.gem docker
17
18
  @mkdir -p docker/licenses
18
19
  @cp -rp LICENSE docker/licenses/
19
- @docker build --no-cache --pull --build-arg VERSION=$(VERSION) -t splunk/k8s-metrics-aggr:$(VERSION) ./docker
20
+ @docker build --no-cache --pull --build-arg VERSION=$(VERSION) --build-arg NODEJS_VERSION=$(NODEJS_VERSION) -t splunk/k8s-metrics-aggr:$(VERSION) ./docker
20
21
 
21
22
  unit-test:
22
23
  @bundle exec rake test
@@ -28,6 +29,7 @@ install-deps:
28
29
 
29
30
  unpack: build
30
31
  @cp pkg/fluent-plugin-*.gem docker
31
- @rm docker/gem/*
32
+ @mkdir -p docker/gem
33
+ @rm -rf docker/gem
32
34
  @gem unpack docker/fluent-plugin-*.gem --target docker/gem
33
35
  @cd docker && bundle install
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.4
1
+ 1.1.5
data/docker/Dockerfile CHANGED
@@ -1,6 +1,7 @@
1
- FROM registry.access.redhat.com/ubi8/ruby-25
1
+ FROM registry.access.redhat.com/ubi8/ruby-27
2
2
 
3
3
  ARG VERSION
4
+ ARG NODEJS_VERSION
4
5
 
5
6
  LABEL name="Splunk Connect for Kubernetes Metrics Aggregator container" \
6
7
  maintainer="DataEdge@splunk.com" \
@@ -19,9 +20,13 @@ COPY licenses /licenses
19
20
  COPY *.gem /tmp/
20
21
 
21
22
  COPY Gemfile* ./
22
- RUN gem install bundler \
23
+ RUN yum update -y \
24
+ && npm install -g n \
25
+ && yum remove -y nodejs \
26
+ && n ${NODEJS_VERSION} \
27
+ && gem install bundler \
23
28
  && gem unpack /tmp/*.gem --target gem \
24
- && bundle install
29
+ && bundle install
25
30
 
26
31
  RUN groupadd -r $FLUENT_USER && \
27
32
  useradd -r -g $FLUENT_USER $FLUENT_USER && \
data/docker/Gemfile CHANGED
@@ -3,15 +3,16 @@ source 'https://rubygems.org'
3
3
  # This is separate gemfile for building docker image that has all plugins
4
4
  # for kubernetes log collection agent
5
5
  # List all required gems here and install via bundler to resolve dependencies
6
- gem "fluentd", "=1.9.1"
7
- gem "fluent-plugin-prometheus", "=1.7.0"
6
+ gem "fluentd", "=1.11.5"
7
+ gem "fluent-plugin-prometheus", "=1.8.5"
8
8
  gem "fluent-plugin-record-modifier", "=2.1.0"
9
+ gem "fluent-plugin-kubernetes_metadata_filter", "=2.5.3"
9
10
  gem "kubeclient", "=4.6.0"
10
11
  gem "oj", "=3.10.2"
11
12
  gem 'multi_json', '=1.14.1'
12
13
  gem 'http_parser.rb', '=0.5.3'
13
- gem 'bigdecimal', '=1.4.3'
14
+ gem 'bigdecimal', '=3.0.0'
14
15
 
15
- gem "fluent-plugin-splunk-hec", ">= 1.2.3"
16
+ gem "fluent-plugin-splunk-hec", ">= 1.2.5"
16
17
 
17
18
  gem 'fluent-plugin-k8s-metrics-agg', path: 'gem/'
data/docker/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: gem
3
3
  specs:
4
- fluent-plugin-k8s-metrics-agg (1.1.4)
5
- fluentd (~> 1.9.1)
4
+ fluent-plugin-k8s-metrics-agg (1.1.5)
5
+ fluentd (>= 1.9.1)
6
6
  kubeclient (~> 4.6.0)
7
7
  multi_json (~> 1.14.1)
8
8
  oj (~> 3.10.2)
@@ -10,50 +10,55 @@ PATH
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activemodel (5.2.4.3)
14
- activesupport (= 5.2.4.3)
15
- activesupport (5.2.4.3)
13
+ activemodel (6.1.3.1)
14
+ activesupport (= 6.1.3.1)
15
+ activesupport (6.1.3.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 0.7, < 2)
18
- minitest (~> 5.1)
19
- tzinfo (~> 1.1)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
20
21
  addressable (2.7.0)
21
22
  public_suffix (>= 2.0.2, < 5.0)
22
- aes_key_wrap (1.0.1)
23
+ aes_key_wrap (1.1.0)
23
24
  attr_required (1.0.1)
24
- bigdecimal (1.4.3)
25
- bindata (2.4.4)
26
- concurrent-ruby (1.1.6)
27
- connection_pool (2.2.2)
28
- cool.io (1.6.0)
25
+ bigdecimal (3.0.0)
26
+ bindata (2.4.8)
27
+ concurrent-ruby (1.1.8)
28
+ connection_pool (2.2.3)
29
+ cool.io (1.7.1)
29
30
  domain_name (0.5.20190701)
30
31
  unf (>= 0.0.5, < 1.0.0)
31
- ffi (1.12.2)
32
+ ffi (1.15.0)
32
33
  ffi-compiler (1.0.1)
33
34
  ffi (>= 1.0.0)
34
35
  rake
35
- fluent-plugin-prometheus (1.7.0)
36
- fluentd (>= 0.14.20, < 2)
36
+ fluent-plugin-kubernetes_metadata_filter (2.5.3)
37
+ fluentd (>= 0.14.0, < 1.12)
38
+ kubeclient (< 5)
39
+ lru_redux
40
+ fluent-plugin-prometheus (1.8.5)
41
+ fluentd (>= 1.9.1, < 2)
37
42
  prometheus-client (< 0.10)
38
43
  fluent-plugin-record-modifier (2.1.0)
39
44
  fluentd (>= 1.0, < 2)
40
- fluent-plugin-splunk-hec (1.2.3)
45
+ fluent-plugin-splunk-hec (1.2.5)
41
46
  fluentd (>= 1.4)
42
47
  multi_json (~> 1.13)
43
48
  net-http-persistent (~> 3.1)
44
49
  openid_connect (~> 1.1.8)
45
50
  prometheus-client (< 0.10.0)
46
- fluentd (1.9.1)
51
+ fluentd (1.11.5)
47
52
  cool.io (>= 1.4.5, < 2.0.0)
48
53
  http_parser.rb (>= 0.5.1, < 0.7.0)
49
54
  msgpack (>= 1.3.1, < 2.0.0)
50
- serverengine (>= 2.0.4, < 3.0.0)
55
+ serverengine (>= 2.2.2, < 3.0.0)
51
56
  sigdump (~> 0.2.2)
52
57
  strptime (>= 0.2.2, < 1.0.0)
53
58
  tzinfo (>= 1.0, < 3.0)
54
59
  tzinfo-data (~> 1.0)
55
60
  yajl-ruby (~> 1.0)
56
- http (4.3.0)
61
+ http (4.4.1)
57
62
  addressable (~> 2.3)
58
63
  http-cookie (~> 1.0)
59
64
  http-form_data (~> 2.2)
@@ -61,14 +66,14 @@ GEM
61
66
  http-accept (1.7.0)
62
67
  http-cookie (1.0.3)
63
68
  domain_name (~> 0.5)
64
- http-form_data (2.2.0)
65
- http-parser (1.2.1)
69
+ http-form_data (2.3.0)
70
+ http-parser (1.2.3)
66
71
  ffi-compiler (>= 1.0, < 2.0)
67
72
  http_parser.rb (0.5.3)
68
73
  httpclient (2.8.3)
69
- i18n (1.8.2)
74
+ i18n (1.8.9)
70
75
  concurrent-ruby (~> 1.0)
71
- json-jwt (1.11.0)
76
+ json-jwt (1.13.0)
72
77
  activesupport (>= 4.2)
73
78
  aes_key_wrap
74
79
  bindata
@@ -76,14 +81,15 @@ GEM
76
81
  http (>= 3.0, < 5.0)
77
82
  recursive-open-struct (~> 1.0, >= 1.0.4)
78
83
  rest-client (~> 2.0)
84
+ lru_redux (1.1.0)
79
85
  mail (2.7.1)
80
86
  mini_mime (>= 0.1.1)
81
87
  mime-types (3.3.1)
82
88
  mime-types-data (~> 3.2015)
83
- mime-types-data (3.2019.1009)
84
- mini_mime (1.0.2)
85
- minitest (5.14.0)
86
- msgpack (1.3.3)
89
+ mime-types-data (3.2021.0225)
90
+ mini_mime (1.0.3)
91
+ minitest (5.14.4)
92
+ msgpack (1.4.2)
87
93
  multi_json (1.14.1)
88
94
  net-http-persistent (3.1.0)
89
95
  connection_pool (~> 2.2)
@@ -101,7 +107,7 @@ GEM
101
107
  webfinger (>= 1.0.1)
102
108
  prometheus-client (0.9.0)
103
109
  quantile (~> 0.2.1)
104
- public_suffix (4.0.3)
110
+ public_suffix (4.0.6)
105
111
  quantile (0.2.1)
106
112
  rack (2.2.3)
107
113
  rack-oauth2 (1.16.0)
@@ -110,50 +116,51 @@ GEM
110
116
  httpclient
111
117
  json-jwt (>= 1.11.0)
112
118
  rack (>= 2.1.0)
113
- rake (13.0.1)
114
- recursive-open-struct (1.1.0)
119
+ rake (13.0.3)
120
+ recursive-open-struct (1.1.3)
115
121
  rest-client (2.1.0)
116
122
  http-accept (>= 1.7.0, < 2.0)
117
123
  http-cookie (>= 1.0.2, < 2.0)
118
124
  mime-types (>= 1.16, < 4.0)
119
125
  netrc (~> 0.8)
120
- serverengine (2.2.1)
126
+ serverengine (2.2.3)
121
127
  sigdump (~> 0.2.2)
122
128
  sigdump (0.2.4)
123
- strptime (0.2.3)
124
- swd (1.1.2)
129
+ strptime (0.2.5)
130
+ swd (1.2.0)
125
131
  activesupport (>= 3)
126
132
  attr_required (>= 0.0.5)
127
133
  httpclient (>= 2.4)
128
- thread_safe (0.3.6)
129
- tzinfo (1.2.6)
130
- thread_safe (~> 0.1)
131
- tzinfo-data (1.2019.3)
134
+ tzinfo (2.0.4)
135
+ concurrent-ruby (~> 1.0)
136
+ tzinfo-data (1.2021.1)
132
137
  tzinfo (>= 1.0.0)
133
138
  unf (0.1.4)
134
139
  unf_ext
135
- unf_ext (0.0.7.6)
140
+ unf_ext (0.0.7.7)
136
141
  validate_email (0.1.6)
137
142
  activemodel (>= 3.0)
138
143
  mail (>= 2.2.5)
139
- validate_url (1.0.8)
144
+ validate_url (1.0.13)
140
145
  activemodel (>= 3.0.0)
141
146
  public_suffix
142
147
  webfinger (1.1.0)
143
148
  activesupport
144
149
  httpclient (>= 2.4)
145
150
  yajl-ruby (1.4.1)
151
+ zeitwerk (2.4.2)
146
152
 
147
153
  PLATFORMS
148
154
  ruby
149
155
 
150
156
  DEPENDENCIES
151
- bigdecimal (= 1.4.3)
157
+ bigdecimal (= 3.0.0)
152
158
  fluent-plugin-k8s-metrics-agg!
153
- fluent-plugin-prometheus (= 1.7.0)
159
+ fluent-plugin-kubernetes_metadata_filter (= 2.5.3)
160
+ fluent-plugin-prometheus (= 1.8.5)
154
161
  fluent-plugin-record-modifier (= 2.1.0)
155
- fluent-plugin-splunk-hec (>= 1.2.3)
156
- fluentd (= 1.9.1)
162
+ fluent-plugin-splunk-hec (>= 1.2.5)
163
+ fluentd (= 1.11.5)
157
164
  http_parser.rb (= 0.5.3)
158
165
  kubeclient (= 4.6.0)
159
166
  multi_json (= 1.14.1)
data/docker/build.sh CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -e
3
3
  TAG=$1
4
+ NODEJS_VERSION=14.15.1
4
5
 
5
6
  # Install dependecies
6
7
  gem install bundler
@@ -16,4 +17,4 @@ VERSION=`cat VERSION`
16
17
  echo "Copying licenses to be included in the docker image..."
17
18
  mkdir -p docker/licenses
18
19
  cp -rp LICENSE docker/licenses/
19
- docker build --no-cache --pull --build-arg VERSION=$VERSION --no-cache -t splunk/k8s-metrics-aggr:$TAG ./docker
20
+ docker build --no-cache --pull --build-arg VERSION=$VERSION --build-arg NODEJS_VERSION=$NODEJS_VERSION --no-cache -t splunk/k8s-metrics-aggr:$TAG ./docker
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'test-unit', "~> 3.3.0"
26
26
  spec.add_development_dependency "simplecov", '~> 0.16.1'
27
27
  spec.add_development_dependency 'webmock', '~> 3.5.1'
28
- spec.add_runtime_dependency 'fluentd', '~> 1.9.1'
28
+ spec.add_runtime_dependency 'fluentd', '>= 1.9.1'
29
29
  spec.add_runtime_dependency 'kubeclient', '~> 4.6.0'
30
30
  spec.add_runtime_dependency 'multi_json', '~> 1.14.1'
31
31
  spec.add_runtime_dependency 'oj', '~> 3.10.2'
@@ -575,23 +575,25 @@ module Fluent
575
575
 
576
576
  node_response = JSON.parse(node_rest_client.get(@client.headers))
577
577
  Array(node_response['pods']).each do |pod_json|
578
- pod_cpu_usage = pod_json['cpu'].fetch('usageNanoCores', 0)/ 1_000_000
579
- pod_memory_usage = pod_json['memory'].fetch('usageBytes', 0)
580
- pod_namespace = pod_json['podRef']['namespace']
581
- pod_usage = ResourceUsageMetricsUnit.new
582
- pod_usage.add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
583
- if @@namespace_resource_usage_metrics_map[pod_namespace].nil?
584
- namespace_usage_metrics = ResourceUsageMetricsUnit.new
585
- @@namespace_resource_usage_metrics_map[pod_namespace] = pod_usage
586
- else
587
- @@namespace_resource_usage_metrics_map[pod_namespace].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
588
- end
589
- if @@node_resource_usage_metrics_map[node_name].nil?
590
- node_name_usage_metrics = ResourceUsageMetricsUnit.new
591
- @@node_resource_usage_metrics_map[node_name] = node_name_usage_metrics
578
+ unless pod_json['cpu'].nil? || pod_json['memory'].nil?
579
+ pod_cpu_usage = pod_json['cpu'].fetch('usageNanoCores', 0)/ 1_000_000
580
+ pod_memory_usage = pod_json['memory'].fetch('usageBytes', 0)
581
+ pod_namespace = pod_json['podRef']['namespace']
582
+ pod_usage = ResourceUsageMetricsUnit.new
583
+ pod_usage.add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
584
+ if @@namespace_resource_usage_metrics_map[pod_namespace].nil?
585
+ namespace_usage_metrics = ResourceUsageMetricsUnit.new
586
+ @@namespace_resource_usage_metrics_map[pod_namespace] = pod_usage
587
+ else
588
+ @@namespace_resource_usage_metrics_map[pod_namespace].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
589
+ end
590
+ if @@node_resource_usage_metrics_map[node_name].nil?
591
+ node_name_usage_metrics = ResourceUsageMetricsUnit.new
592
+ @@node_resource_usage_metrics_map[node_name] = node_name_usage_metrics
593
+ end
594
+ @@node_resource_usage_metrics_map[node_name].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
595
+ pod_usage = nil
592
596
  end
593
- @@node_resource_usage_metrics_map[node_name].add_resource_usage_metrics(pod_cpu_usage, pod_memory_usage)
594
- pod_usage = nil
595
597
  end
596
598
  end
597
599
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-k8s-metrics-agg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Splunk Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2021-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: fluentd
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.9.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.9.1
97
97
  - !ruby/object:Gem::Dependency
@@ -185,7 +185,7 @@ homepage: https://github.com/splunk/fluent-plugin-k8s-metrics-agg
185
185
  licenses:
186
186
  - Apache-2.0
187
187
  metadata: {}
188
- post_install_message:
188
+ post_install_message:
189
189
  rdoc_options: []
190
190
  require_paths:
191
191
  - lib
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubygems_version: 3.1.1
204
- signing_key:
204
+ signing_key:
205
205
  specification_version: 4
206
206
  summary: A fluentd input plugin that collects kubernetes cluster metrics.
207
207
  test_files: