Skip to content

metrics: Descriptions on multi-line comments are not parsed correctly #1999

Closed

Description

@hvanz

Bug Report

In metric definitions with long comments, the script metricsgen could take the metric description from a one-line comment starting with //metrics:. Some of these comments are wrongly prefixed with // metrics:, with an extra space, thus they are ignored by the script. For example, in internal/consensus/metrics.go and internal/state/metrics.go.

Moreover, the go formatter will automatically insert a space after //, breaking the metric descriptions.

Proposed solutions

Either:

  • fix the formatter to not insert spaces in //metrics:, or
  • add the affected lines lint commands to ignore the formatter, or
  • change metricsgen to accept lines with // metrics:.

Activity

  1. added
    bug
    on Jan 9, 2024
  2. cason commented on Jan 22, 2024

    @cason

    Moreover, the go formatter will automatically insert a space after //, breaking the metric descriptions.

    The problem is with gofumpt actually, introduced by #604.

  3. moved this from Todo to In Progress in CometBFTon Jan 22, 2024
  4. self-assigned this
    on Jan 22, 2024
  5. moved this from In Progress to Done in CometBFTon Jan 22, 2024
  6. added this to the 2024-Q1 milestone on Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugmetrics

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions