Skip to content

getMetricsAsJSON() omits labels on a label-less summary's sum and count #838

Description

@milcho0604

A summary declared with no labelNames leaves the labels property off its _sum and _count entries. A counter declared the same way gives you labels: {}. Both come from getMetricsAsJSON() on main today.

{"metricName":"s_none_sum","value":0}
{"value":0,"labels":{}}

The Summary constructor stores that entry with store.set({}, { td, count, sum }), and no labels key ever lands on it afterwards. So summaries are the odd one out if you read values[].labels.

#798 lines them up as a byproduct, since the entry now takes its labels from the store. Filing it for posterity.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions