@@ -294,14 +294,7 @@ def text_fd_to_metric_families(fd):
294
294
295
295
Yields core.Metric's.
296
296
"""
297
- name = ''
298
- documentation = None
299
- typ = None
300
- unit = None
301
- group = None
302
- seen_groups = set ()
303
- group_timestamp = None
304
- samples = []
297
+ name = None
305
298
allowed_names = []
306
299
eof = False
307
300
@@ -344,7 +337,7 @@ def build_metric(name, documentation, typ, unit, samples):
344
337
if parts [2 ] == name and samples :
345
338
raise ValueError ("Received metadata after samples: " + line )
346
339
if parts [2 ] != name :
347
- if name != '' :
340
+ if name is not None :
348
341
yield build_metric (name , documentation , typ , unit , samples )
349
342
# New metric
350
343
name = parts [2 ]
@@ -387,7 +380,7 @@ def build_metric(name, documentation, typ, unit, samples):
387
380
else :
388
381
sample = _parse_sample (line )
389
382
if sample .name not in allowed_names :
390
- if name != '' :
383
+ if name is not None :
391
384
yield build_metric (name , documentation , typ , unit , samples )
392
385
# Start an unknown metric.
393
386
name = sample .name
@@ -434,7 +427,7 @@ def build_metric(name, documentation, typ, unit, samples):
434
427
and sample .name .endswith ('_bucket' )):
435
428
raise ValueError ("Invalid line only histogram/gaugehistogram buckets can have exemplars: " + line )
436
429
437
- if name != '' :
430
+ if name is not None :
438
431
yield build_metric (name , documentation , typ , unit , samples )
439
432
440
433
if not eof :
0 commit comments