Skip to content

Commit

Permalink
[BEAM-12277] Update expected metric name formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ibzib authored and iemejia committed May 28, 2021
1 parent 8ad8965 commit 8be1cb1
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions sdks/python/apache_beam/runners/portability/flink_runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,46 +337,47 @@ def process(self, kv, state=beam.DoFn.StateParam(state_spec)):
if options.view_as(StandardOptions).streaming:
lines_expected.update([
# Gauges for the last finished bundle
'stateful.beam.metric:statecache:capacity: 123',
'stateful.beam.metric:statecache:size: 10',
'stateful.beam.metric:statecache:get: 20',
'stateful.beam.metric:statecache:miss: 0',
'stateful.beam.metric:statecache:hit: 20',
'stateful.beam.metric:statecache:put: 0',
'stateful.beam.metric:statecache:evict: 0',
'stateful.beam_metric:statecache:capacity: 123',
'stateful.beam_metric:statecache:size: 10',
'stateful.beam_metric:statecache:get: 20',
'stateful.beam_metric:statecache:miss: 0',
'stateful.beam_metric:statecache:hit: 20',
'stateful.beam_metric:statecache:put: 0',
'stateful.beam_metric:statecache:evict: 0',
# Counters
'stateful.beam.metric:statecache:get_total: 220',
'stateful.beam.metric:statecache:miss_total: 10',
'stateful.beam.metric:statecache:hit_total: 210',
'stateful.beam.metric:statecache:put_total: 10',
'stateful.beam.metric:statecache:evict_total: 0',
'stateful.beam_metric:statecache:get_total: 220',
'stateful.beam_metric:statecache:miss_total: 10',
'stateful.beam_metric:statecache:hit_total: 210',
'stateful.beam_metric:statecache:put_total: 10',
'stateful.beam_metric:statecache:evict_total: 0',
])
else:
# Batch has a different processing model. All values for
# a key are processed at once.
lines_expected.update([
# Gauges
'stateful).beam.metric:statecache:capacity: 123',
'stateful).beam_metric:statecache:capacity: 123',
# For the first key, the cache token will not be set yet.
# It's lazily initialized after first access in StateRequestHandlers
'stateful).beam.metric:statecache:size: 10',
'stateful).beam_metric:statecache:size: 10',
# We have 11 here because there are 110 / 10 elements per key
'stateful).beam.metric:statecache:get: 12',
'stateful).beam.metric:statecache:miss: 1',
'stateful).beam.metric:statecache:hit: 11',
'stateful).beam_metric:statecache:get: 12',
'stateful).beam_metric:statecache:miss: 1',
'stateful).beam_metric:statecache:hit: 11',
# State is flushed back once per key
'stateful).beam.metric:statecache:put: 1',
'stateful).beam.metric:statecache:evict: 0',
'stateful).beam_metric:statecache:put: 1',
'stateful).beam_metric:statecache:evict: 0',
# Counters
'stateful).beam.metric:statecache:get_total: 120',
'stateful).beam.metric:statecache:miss_total: 10',
'stateful).beam.metric:statecache:hit_total: 110',
'stateful).beam.metric:statecache:put_total: 10',
'stateful).beam.metric:statecache:evict_total: 0',
'stateful).beam_metric:statecache:get_total: 120',
'stateful).beam_metric:statecache:miss_total: 10',
'stateful).beam_metric:statecache:hit_total: 110',
'stateful).beam_metric:statecache:put_total: 10',
'stateful).beam_metric:statecache:evict_total: 0',
])
lines_actual = set()
with open(self.test_metrics_path, 'r') as f:
for line in f:
print(line, end='')
for metric_str in lines_expected:
metric_name = metric_str.split()[0]
if metric_str in line:
Expand Down

0 comments on commit 8be1cb1

Please sign in to comment.