fluent-plugin-k8s-metrics-agg 1.1.0 → 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 +4 -4
- data/.circleci/config.yml +19 -36
- data/.circleci/trigger_func_test.sh +42 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- data/.github/ISSUE_TEMPLATE/enhancement_request.md +14 -0
- data/.github/ISSUE_TEMPLATE/failing_test.md +18 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +23 -0
- data/.gitignore +4 -0
- data/CLA.md +18 -0
- data/Gemfile.lock +55 -48
- data/Makefile +35 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/docker/Dockerfile +30 -45
- data/docker/Gemfile +18 -0
- data/docker/Gemfile.lock +170 -0
- data/docker/build.sh +20 -0
- data/fluent-plugin-k8s-metrics-agg.gemspec +7 -7
- data/lib/fluent/plugin/in_kubernetes_metrics_aggregator.rb +35 -24
- data/test/helper.rb +55 -71
- data/test/plugin/test_in_kubernetes_metrics_aggregator.rb +137 -104
- metadata +30 -24
- data/.circleci/build_and_push.sh +0 -10
- data/.circleci/build_and_push_to_dockerhub.sh +0 -11
- data/.circleci/build_and_push_to_github_release.sh +0 -11
- data/.circleci/push_gem.sh +0 -7
data/test/helper.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'simplecov'
|
2
|
-
require 'fluent/plugin/in_kubernetes_metrics_aggregator.rb'
|
3
2
|
SimpleCov.start
|
4
3
|
|
5
4
|
$LOAD_PATH.unshift(File.expand_path('..', __dir__))
|
@@ -37,33 +36,16 @@ module PluginTestHelper
|
|
37
36
|
k8s_url + '/v1/nodes/generics-aws-node-three:10255/proxy/stats/summary'
|
38
37
|
end
|
39
38
|
|
40
|
-
def stub_api_port_10250
|
41
|
-
WebMock.stub_request(:get, 'https://node.fakedestination.com:10250/api')
|
42
|
-
.with(
|
43
|
-
headers: {
|
44
|
-
'Accept' => '*/*',
|
45
|
-
'Accept-Encoding' => 'gzip, deflate',
|
46
|
-
'Host' => 'node.fakedestination.com:10250'
|
47
|
-
}
|
48
|
-
)
|
49
|
-
.to_return(status: 200,
|
50
|
-
body: File.open(File.expand_path('../v1.json', __FILE__)),
|
51
|
-
headers: {})
|
52
|
-
end
|
53
|
-
|
54
39
|
def stub_api_port_10255
|
55
40
|
WebMock.stub_request(:get,
|
56
41
|
'https://node.fakedestination.com:10255/api')
|
57
42
|
.with(
|
58
43
|
headers: {
|
59
|
-
'Accept' => '*/*',
|
60
|
-
'Accept-Encoding' => 'gzip, deflate',
|
61
44
|
'Host' => 'node.fakedestination.com:10255'
|
62
45
|
}
|
63
46
|
)
|
64
47
|
.to_return(status: 200,
|
65
|
-
body: File.open(File.expand_path('../v1.json', __FILE__))
|
66
|
-
headers: {})
|
48
|
+
body: File.open(File.expand_path('../v1.json', __FILE__)))
|
67
49
|
end
|
68
50
|
|
69
51
|
def stub_api_v1
|
@@ -71,29 +53,27 @@ module PluginTestHelper
|
|
71
53
|
'https://node.fakedestination.com:10255/api/v1')
|
72
54
|
.with(
|
73
55
|
headers: {
|
74
|
-
'Accept' => '*/*',
|
75
|
-
'Accept-Encoding' => 'gzip, deflate',
|
76
56
|
'Host' => 'node.fakedestination.com:10255'
|
77
57
|
}
|
78
58
|
)
|
79
59
|
.to_return(status: 200,
|
80
|
-
body: File.open(File.expand_path('../v1.json', __FILE__))
|
81
|
-
|
82
|
-
|
60
|
+
body: File.open(File.expand_path('../v1.json', __FILE__)))
|
61
|
+
end
|
62
|
+
|
63
|
+
def stub_api_pods(timeout=false)
|
64
|
+
get_pods = WebMock.stub_request(:get,
|
65
|
+
'https://node.fakedestination.com:10255/api/v1/pods')
|
66
|
+
.with(
|
67
|
+
headers: {
|
68
|
+
'Host' => 'node.fakedestination.com:10255'
|
69
|
+
}
|
70
|
+
)
|
71
|
+
if timeout
|
72
|
+
get_pods = get_pods.to_timeout.then
|
73
|
+
end
|
83
74
|
|
84
|
-
|
85
|
-
|
86
|
-
'https://node.fakedestination.com:10255/api/v1/pods')
|
87
|
-
.with(
|
88
|
-
headers: {
|
89
|
-
'Accept' => '*/*',
|
90
|
-
'Accept-Encoding' => 'gzip, deflate',
|
91
|
-
'Host' => 'node.fakedestination.com:10255'
|
92
|
-
}
|
93
|
-
)
|
94
|
-
.to_return(status: 200,
|
95
|
-
body: File.open(File.expand_path('../pods.json', __FILE__)),
|
96
|
-
headers: {})
|
75
|
+
get_pods.to_return(status: 200,
|
76
|
+
body: File.open(File.expand_path('../pods.json', __FILE__)))
|
97
77
|
end
|
98
78
|
|
99
79
|
def stub_api_node_1
|
@@ -101,29 +81,28 @@ module PluginTestHelper
|
|
101
81
|
'https://node.fakedestination.com:10255/api/v1/nodes/generics-aws-node-one:10255/proxy/stats/summary')
|
102
82
|
.with(
|
103
83
|
headers: {
|
104
|
-
'Accept' => '*/*',
|
105
|
-
'Accept-Encoding' => 'gzip, deflate',
|
106
84
|
'Host' => 'node.fakedestination.com:10255'
|
107
85
|
}
|
108
86
|
)
|
109
87
|
.to_return(status: 200,
|
110
|
-
body: File.open(File.expand_path('../node1.json', __FILE__))
|
111
|
-
headers: {})
|
88
|
+
body: File.open(File.expand_path('../node1.json', __FILE__)))
|
112
89
|
end
|
113
90
|
|
114
|
-
def stub_api_node_2
|
115
|
-
WebMock.stub_request(:get,
|
116
|
-
|
91
|
+
def stub_api_node_2(timeout=false)
|
92
|
+
get_node_summary = WebMock.stub_request(:get,
|
93
|
+
'https://node.fakedestination.com:10255/api/v1/nodes/generics-aws-node-two:10255/proxy/stats/summary')
|
117
94
|
.with(
|
118
95
|
headers: {
|
119
|
-
'Accept' => '*/*',
|
120
|
-
'Accept-Encoding' => 'gzip, deflate',
|
121
96
|
'Host' => 'node.fakedestination.com:10255'
|
122
97
|
}
|
123
98
|
)
|
124
|
-
|
125
|
-
|
126
|
-
|
99
|
+
|
100
|
+
if timeout
|
101
|
+
get_node_summary = get_node_summary.to_timeout
|
102
|
+
end
|
103
|
+
|
104
|
+
get_node_summary.to_return(status: 200,
|
105
|
+
body: File.open(File.expand_path('../node2.json', __FILE__)))
|
127
106
|
end
|
128
107
|
|
129
108
|
def stub_api_node_3
|
@@ -131,40 +110,45 @@ module PluginTestHelper
|
|
131
110
|
'https://node.fakedestination.com:10255/api/v1/nodes/generics-aws-node-three:10255/proxy/stats/summary')
|
132
111
|
.with(
|
133
112
|
headers: {
|
134
|
-
'Accept' => '*/*',
|
135
|
-
'Accept-Encoding' => 'gzip, deflate',
|
136
113
|
'Host' => 'node.fakedestination.com:10255'
|
137
114
|
}
|
138
115
|
)
|
139
116
|
.to_return(status: 200,
|
140
|
-
body: File.open(File.expand_path('../node3.json', __FILE__))
|
141
|
-
headers: {})
|
117
|
+
body: File.open(File.expand_path('../node3.json', __FILE__)))
|
142
118
|
end
|
143
119
|
|
144
|
-
def stub_api_nodes
|
145
|
-
WebMock.stub_request(:get,
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
120
|
+
def stub_api_nodes(timeout=false)
|
121
|
+
get_nodes = WebMock.stub_request(:get, 'https://node.fakedestination.com:10255/api/v1/nodes')
|
122
|
+
.with(
|
123
|
+
headers: {
|
124
|
+
'Host' => 'node.fakedestination.com:10255'
|
125
|
+
}
|
126
|
+
)
|
127
|
+
|
128
|
+
if timeout
|
129
|
+
get_nodes = get_nodes.to_timeout.times(2) # Nodes endpoint is called from two timers so must fail in both cases
|
130
|
+
end
|
131
|
+
|
132
|
+
get_nodes.to_return(status: 200,
|
133
|
+
body: File.open(File.expand_path('../nodes.json', __FILE__)))
|
157
134
|
end
|
158
135
|
|
159
|
-
def
|
160
|
-
|
136
|
+
def stub_k8s_init_requests
|
137
|
+
WebMock.reset!
|
138
|
+
|
139
|
+
stub_api_port_10255
|
140
|
+
end
|
141
|
+
|
142
|
+
def stub_k8s_requests(nodes_timeout: false, node_summary_timeout: false, pods_timeout: false)
|
143
|
+
WebMock.reset!
|
144
|
+
|
161
145
|
stub_api_port_10255
|
162
146
|
stub_api_v1
|
163
|
-
stub_api_pods
|
164
|
-
stub_api_nodes
|
147
|
+
stub_api_pods(pods_timeout)
|
148
|
+
stub_api_nodes(nodes_timeout)
|
165
149
|
stub_api_node_1
|
150
|
+
stub_api_node_2(node_summary_timeout)
|
166
151
|
stub_api_node_3
|
167
|
-
stub_api_node_2
|
168
152
|
end
|
169
153
|
|
170
154
|
def get_parsed_file(file_name)
|
@@ -5,10 +5,6 @@ class KubernetesMetricsAggInputTest < Test::Unit::TestCase
|
|
5
5
|
include Fluent::Test::Helpers
|
6
6
|
include PluginTestHelper
|
7
7
|
|
8
|
-
@driver = nil
|
9
|
-
@driver_test = nil
|
10
|
-
@@hash_map_test = {}
|
11
|
-
|
12
8
|
ZERO_CONFIG = %([
|
13
9
|
]).freeze
|
14
10
|
|
@@ -34,20 +30,22 @@ class KubernetesMetricsAggInputTest < Test::Unit::TestCase
|
|
34
30
|
METRIC_TEST_CONFIG = %([
|
35
31
|
kubernetes_url https://node.fakedestination.com
|
36
32
|
kubelet_port 10255
|
33
|
+
interval 5s
|
34
|
+
tag kube.*
|
35
|
+
]).freeze
|
36
|
+
|
37
|
+
TIMEOUT_TEST_CONFIG = %([
|
38
|
+
kubernetes_url https://node.fakedestination.com
|
39
|
+
kubelet_port 10255
|
40
|
+
interval 5s
|
37
41
|
tag kube.*
|
38
42
|
]).freeze
|
39
43
|
|
40
44
|
setup do
|
41
45
|
Fluent::Test.setup
|
46
|
+
|
42
47
|
ENV['KUBERNETES_SERVICE_HOST'] = "node.fakedestination.com"
|
43
48
|
ENV['KUBERNETES_SERVICE_PORT'] = "10255"
|
44
|
-
stub_k8s_requests
|
45
|
-
@driver = create_driver(METRIC_TEST_CONFIG)
|
46
|
-
@driver.run timeout: 20, expect_emits: 200, shutdown: false
|
47
|
-
|
48
|
-
@driver.events.each do |tag, time, record|
|
49
|
-
@@hash_map_test[tag] = tag, time, record
|
50
|
-
end
|
51
49
|
end
|
52
50
|
|
53
51
|
def create_driver(conf = BASIC_CONFIG)
|
@@ -60,6 +58,8 @@ class KubernetesMetricsAggInputTest < Test::Unit::TestCase
|
|
60
58
|
|
61
59
|
sub_test_case 'default parameter configuration' do
|
62
60
|
test 'test default params' do
|
61
|
+
stub_k8s_init_requests
|
62
|
+
|
63
63
|
d = create_driver(ZERO_CONFIG)
|
64
64
|
assert_equal 10_250, d.instance.kubelet_port
|
65
65
|
assert_equal 'kubernetes.metrics.*', d.instance.tag
|
@@ -78,141 +78,174 @@ class KubernetesMetricsAggInputTest < Test::Unit::TestCase
|
|
78
78
|
|
79
79
|
sub_test_case 'modify parameter changes' do
|
80
80
|
test 'test kubelet_port and supplied kubernetes URL parameters' do
|
81
|
+
stub_k8s_init_requests
|
82
|
+
|
81
83
|
d = create_driver(ADVANCED_CONFIG_NO_CERTS)
|
82
84
|
assert_equal 'https://node.fakedestination.com', d.instance.kubernetes_url
|
83
85
|
assert_equal 10_255, d.instance.kubelet_port
|
84
86
|
end
|
85
87
|
|
86
88
|
test 'test tag and interval parameters' do
|
89
|
+
stub_k8s_init_requests
|
90
|
+
|
87
91
|
d = create_driver(ADVANCED_CONFIG_NO_CERTS)
|
88
92
|
assert_equal 'test.tag.check', d.instance.tag
|
89
93
|
assert_equal 120, d.instance.interval
|
90
94
|
end
|
91
95
|
|
92
96
|
test 'test insecure_ssl and cluster_name parameters ' do
|
97
|
+
stub_k8s_init_requests
|
98
|
+
|
93
99
|
d = create_driver(ADVANCED_CONFIG_NO_CERTS)
|
94
100
|
assert_true d.instance.insecure_ssl
|
95
101
|
assert_equal 'awesome_cluster', d.instance.cluster_name
|
96
102
|
end
|
97
103
|
end
|
98
104
|
|
99
|
-
sub_test_case 'Test metrics exist
|
100
|
-
test 'Testing
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
assert_true
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
assert_true
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
assert_true
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
assert_true
|
105
|
+
sub_test_case 'Test metrics exist' do
|
106
|
+
test 'Testing all expected metrics are emitted' do
|
107
|
+
stub_k8s_requests
|
108
|
+
|
109
|
+
hash_map_test = {}
|
110
|
+
|
111
|
+
d = create_driver(METRIC_TEST_CONFIG)
|
112
|
+
d.run timeout: 12, expect_emits: 200, shutdown: false
|
113
|
+
|
114
|
+
d.events.each do |tag, time, record|
|
115
|
+
hash_map_test[tag] = tag, time, record
|
116
|
+
end
|
117
|
+
|
118
|
+
# Test metrics exist, limits_request_scraper - limits
|
119
|
+
assert_true hash_map_test.key?('kube.namespace.cpu.limit')
|
120
|
+
assert_true hash_map_test.key?('kube.namespace.memory.limit')
|
121
|
+
assert_true hash_map_test.key?('kube.container.cpu.limit')
|
122
|
+
assert_true hash_map_test.key?('kube.pod.cpu.limit')
|
123
|
+
assert_true hash_map_test.key?('kube.cluster.memory.limit')
|
124
|
+
assert_true hash_map_test.key?('kube.pod.memory.limit')
|
125
|
+
assert_true hash_map_test.key?('kube.cluster.cpu.limit')
|
126
|
+
|
127
|
+
# Test metrics exist, limits_request_scraper - request
|
128
|
+
assert_true hash_map_test.key?('kube.cluster.memory.request')
|
129
|
+
assert_true hash_map_test.key?('kube.container.memory.request')
|
130
|
+
assert_true hash_map_test.key?('kube.pod.memory.request')
|
131
|
+
assert_true hash_map_test.key?('kube.namespace.memory.request')
|
132
|
+
assert_true hash_map_test.key?('kube.container.cpu.request')
|
133
|
+
assert_true hash_map_test.key?('kube.namespace.cpu.request')
|
134
|
+
assert_true hash_map_test.key?('kube.pod.cpu.request')
|
135
|
+
assert_true hash_map_test.key?('kube.cluster.cpu.request')
|
136
|
+
|
137
|
+
# Test metrics exist, node_scraper/resource_usage_scraper 1
|
138
|
+
assert_true hash_map_test.key?('kube.node.cpu.capacity')
|
139
|
+
assert_true hash_map_test.key?('kube.node.memory.capacity')
|
140
|
+
assert_true hash_map_test.key?('kube.node.memory.allocatable')
|
141
|
+
assert_true hash_map_test.key?('kube.node.cpu.utilization')
|
142
|
+
assert_true hash_map_test.key?('kube.node.memory.reservation')
|
143
|
+
assert_true hash_map_test.key?('kube.node.memory.utilization')
|
144
|
+
|
145
|
+
# Test metrics exist, node_scraper/resource_usage_scraper 2
|
146
|
+
assert_true hash_map_test.key?('kube.namespace.memory.usage')
|
147
|
+
assert_true hash_map_test.key?('kube.cluster.memory.usage')
|
148
|
+
assert_true hash_map_test.key?('kube.namespace.cpu.usage')
|
149
|
+
assert_true hash_map_test.key?('kube.node.cpu.allocatable')
|
150
|
+
assert_true hash_map_test.key?('kube.node.cpu.reservation')
|
151
|
+
assert_true hash_map_test.key?('kube.cluster.cpu.usage')
|
152
|
+
|
153
|
+
d.instance_shutdown
|
130
154
|
end
|
131
155
|
end
|
132
156
|
|
133
|
-
sub_test_case 'Test
|
134
|
-
test 'Testing kube.cluster.memory.request ' do
|
135
|
-
assert_true @@hash_map_test.key?('kube.cluster.memory.request')
|
136
|
-
end
|
157
|
+
sub_test_case 'Test handles request timeouts' do
|
137
158
|
|
138
|
-
test 'Testing
|
139
|
-
|
140
|
-
end
|
159
|
+
test 'Testing event count with nodes call timeout' do
|
160
|
+
stub_k8s_requests(nodes_timeout: true)
|
141
161
|
|
142
|
-
|
143
|
-
|
144
|
-
|
162
|
+
namespace_event_count = 0
|
163
|
+
pod_event_count = 0
|
164
|
+
node_event_count = 0
|
145
165
|
|
146
|
-
|
147
|
-
|
148
|
-
|
166
|
+
d = create_driver(TIMEOUT_TEST_CONFIG)
|
167
|
+
# Should run for two intervals, the first call to node 1 which has the only 'default' namespace pod should timeout the first time
|
168
|
+
d.run timeout: 12, expect_emits: 500, shutdown: false
|
149
169
|
|
150
|
-
|
151
|
-
|
152
|
-
|
170
|
+
d.events.each do |tag, _time, record|
|
171
|
+
# Limit to one events that should be emitted once per interval
|
172
|
+
if tag == 'kube.pod.cpu.limit' && record['name'] == 'new-metrics-test-final-splunk-kubernetes-metrics-fgszl'
|
173
|
+
pod_event_count += 1
|
174
|
+
end
|
175
|
+
if tag == 'kube.namespace.cpu.usage' && record['name'] == 'kube-system'
|
176
|
+
namespace_event_count += 1
|
177
|
+
end
|
178
|
+
if tag == 'kube.node.cpu.capacity' && record['node'] == 'generics-aws-node-one'
|
179
|
+
node_event_count += 1
|
180
|
+
end
|
181
|
+
end
|
153
182
|
|
154
|
-
|
155
|
-
|
156
|
-
|
183
|
+
# 2 intervals - first call times out but timer continues emitting successfully next interval
|
184
|
+
assert_equal 1, node_event_count, 'Number of node events emitted was wrong'
|
185
|
+
# 2 intervals - first call times out but timer continues emitting successfully next interval
|
186
|
+
assert_equal 1, namespace_event_count, 'Number of namespace events emitted was wrong'
|
187
|
+
# 2 intervals - not timeouts
|
188
|
+
assert_equal 2, pod_event_count, 'Number of pod events emitted was wrong'
|
157
189
|
|
158
|
-
|
159
|
-
assert_true @@hash_map_test.key?('kube.pod.cpu.request')
|
190
|
+
d.instance_shutdown
|
160
191
|
end
|
161
192
|
|
162
|
-
test 'Testing
|
163
|
-
|
164
|
-
end
|
165
|
-
end
|
193
|
+
test 'Testing event count with pods call timeout' do
|
194
|
+
stub_k8s_requests(pods_timeout: true)
|
166
195
|
|
167
|
-
|
168
|
-
|
169
|
-
assert_true @@hash_map_test.key?('kube.node.cpu.capacity')
|
170
|
-
end
|
196
|
+
pod_event_count = 0
|
197
|
+
node_event_count = 0
|
171
198
|
|
172
|
-
|
173
|
-
|
174
|
-
|
199
|
+
d = create_driver(TIMEOUT_TEST_CONFIG)
|
200
|
+
# Should run for two intervals, the first call to node 1 which has the only 'default' namespace pod should timeout the first time
|
201
|
+
d.run timeout: 12, expect_emits: 500, shutdown: false
|
175
202
|
|
176
|
-
|
177
|
-
|
178
|
-
|
203
|
+
d.events.each do |tag, _time, record|
|
204
|
+
# Limit to one events that should be emitted once per interval
|
205
|
+
if tag == 'kube.pod.cpu.limit' && record['name'] == 'new-metrics-test-final-splunk-kubernetes-metrics-fgszl'
|
206
|
+
pod_event_count += 1
|
207
|
+
end
|
179
208
|
|
180
|
-
|
181
|
-
|
182
|
-
|
209
|
+
if tag == 'kube.node.cpu.utilization' && record['node'] == 'generics-aws-node-one'
|
210
|
+
node_event_count += 1
|
211
|
+
end
|
212
|
+
end
|
183
213
|
|
184
|
-
|
185
|
-
|
186
|
-
|
214
|
+
# 2 intervals - first call times out but timer continues emitting successfully next interval
|
215
|
+
assert_equal 1, pod_event_count, 'Number of pod events emitted was wrong'
|
216
|
+
# 2 intervals - not timeouts
|
217
|
+
assert_equal 2, node_event_count, 'Number of namespace events emitted was wrong'
|
187
218
|
|
188
|
-
|
189
|
-
assert_true @@hash_map_test.key?('kube.node.memory.utilization')
|
219
|
+
d.instance_shutdown
|
190
220
|
end
|
191
|
-
end
|
192
221
|
|
193
|
-
|
194
|
-
|
195
|
-
assert_true @@hash_map_test.key?('kube.namespace.memory.usage')
|
196
|
-
end
|
222
|
+
test 'Testing event count with node summary call timeout' do
|
223
|
+
stub_k8s_requests(node_summary_timeout: true)
|
197
224
|
|
198
|
-
|
199
|
-
|
200
|
-
end
|
225
|
+
namespace_event_count = 0
|
226
|
+
pod_event_count = 0
|
201
227
|
|
202
|
-
|
203
|
-
|
204
|
-
|
228
|
+
d = create_driver(TIMEOUT_TEST_CONFIG)
|
229
|
+
# Should run for two intervals, the first call to node 1 which has the only 'default' namespace pod should timeout the first time
|
230
|
+
d.run timeout: 12, expect_emits: 500, shutdown: false
|
205
231
|
|
206
|
-
|
207
|
-
|
208
|
-
|
232
|
+
d.events.each do |tag, _time, record|
|
233
|
+
# Limit to one events that should be emitted once per interval
|
234
|
+
if tag == 'kube.namespace.cpu.usage' && record['name'] == 'kube-system'
|
235
|
+
namespace_event_count += 1
|
236
|
+
end
|
237
|
+
if tag == 'kube.pod.cpu.limit' && record['name'] == 'new-metrics-test-final-splunk-kubernetes-metrics-fgszl'
|
238
|
+
pod_event_count += 1
|
239
|
+
end
|
240
|
+
end
|
209
241
|
|
210
|
-
|
211
|
-
|
212
|
-
|
242
|
+
# 2 intervals - first call times out but timer continues emitting successfully next interval
|
243
|
+
assert_equal 1, namespace_event_count, 'Number of namespace events emitted was wrong'
|
244
|
+
# 2 intervals - not timeouts
|
245
|
+
assert_equal 2, pod_event_count, 'Number of pod events emitted was wrong'
|
213
246
|
|
214
|
-
|
215
|
-
assert_true @@hash_map_test.key?('kube.cluster.cpu.usage')
|
247
|
+
d.instance_shutdown
|
216
248
|
end
|
249
|
+
|
217
250
|
end
|
218
251
|
end
|