Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PanelEdit: Add Decimal value formatter to disable and decimal rounding #53577

Closed
wants to merge 1 commit into from

Conversation

joshhunt
Copy link
Contributor

What this PR does / why we need it:

Adds a new unit value formatter "Decimal" (that is just the the String value formatter) to create a (hopefully) more obvious way to disable decimal values from being rounded.

We don't want to change the default behaviour of the number formatter because we optimise for most queries people make - Prometheus producing values with many decimal points.

Which issue(s) this PR fixes:

Fixes #49388

Special notes for your reviewer:

I'm not sure if just aliasing the string formatter is the best approach, but it's essentially what @kaydelaney did in her earlier PR. thoughts @torkelo @kaydelaney ?

@@ -39,6 +39,7 @@ export const getCategories = (): ValueFormatCategory[] => [
name: 'Misc',
formats: [
{ name: 'Number', id: 'none', fn: toFixedUnit('') },
{ name: 'Decimal', id: 'decimal', fn: stringFormater },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ name: 'Decimal', id: 'decimal', fn: stringFormater },
{ name: 'Number (Full precision)', id: 'decimal', fn: stringFormater },

The name Decimals seems to not really capture it I feel.

Alt names

  • Number (Raw)
  • Number (Full precision)
  • Raw (no formatting)

@scottlepp scottlepp removed their request for review August 22, 2022 12:36
@joshhunt joshhunt closed this Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Default number formatter rounds numbers down to 3 significant digits
3 participants