Skip to content

Fix string-to-float value mapping and flat-object iteration in Object…#434

Open
gharbi1936 wants to merge 1 commit into
prometheus-community:masterfrom
gharbi1936:master
Open

Fix string-to-float value mapping and flat-object iteration in Object…#434
gharbi1936 wants to merge 1 commit into
prometheus-community:masterfrom
gharbi1936:master

Conversation

@gharbi1936
Copy link
Copy Markdown

…Scrape

  • Add ValuesMap to JSONMetric so ValueScrape metrics can map string values (e.g. UP/DOWN) to float64 via the 'values:' config field
  • Add resolveValue() helper that checks ValuesMap before SanitizeValue()
  • Add interfaceToFloat64() for native Go type conversion in map iteration
  • Handle flat JSON object iteration in ObjectScrape when ValueJSONPath is '{@value}': iterates map key-value pairs and resolves '{@key}'/'{@value}' label tokens directly, fixing 'unrecognized identifier value' errors

Copyright 2025 abgharbi

…Scrape

- Add ValuesMap to JSONMetric so ValueScrape metrics can map string values
  (e.g. UP/DOWN) to float64 via the 'values:' config field
- Add resolveValue() helper that checks ValuesMap before SanitizeValue()
- Add interfaceToFloat64() for native Go type conversion in map iteration
- Handle flat JSON object iteration in ObjectScrape when ValueJSONPath is
  '{@value}': iterates map key-value pairs and resolves '{@key}'/'{@value}'
  label tokens directly, fixing 'unrecognized identifier value' errors

Copyright 2025 abgharbi
@SleepyBrett
Copy link
Copy Markdown

SleepyBrett commented May 6, 2026

This would be very useful. However it doesn't look like the maintainers really do much besides bump dependencies. But also they would likely never take this with your copyright updates.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants