e5259c2ad43d62049246597f77543068e63da317
* fix(dashboard): prevent memory leak in CUE validation by using fresh contexts Fixes #114344 The CUE validation was reusing a single cue.Context across all validations, which caused unbounded memory growth due to CUE's internal caching of intermediate computation results (disjunctions, unifications, etc.). Root Cause: - A single cue.Context was created and reused via getValidator() - Each validation added entries to the context's internal caches - These caches grew unboundedly over time - Memory could not be garbage collected because the context held references Solution: - Store the schema source string instead of a compiled cue.Value - Create a fresh cuecontext.New() for each validation - This allows the context and its caches to be garbage collected after each validation completes Performance Impact: - ~2x slower due to schema recompilation per validation - Acceptable trade-off to prevent memory leaks - Memory usage stays bounded instead of growing unboundedly * fix(dashboard): use periodic context recreation to prevent CUE memory leaks Replace fresh context creation with periodic context recreation approach. The context is reused for up to 100 validations, then recreated to allow garbage collection of cached values while maintaining good performance. This balances performance (only 19% slower than leaky approach) with memory safety (stable at ~5 MB vs ~2 GB leak). See https://github.com/grafana/grafana/issues/114344#issuecomment-3605562491 * refactor(cuevalidator): simplify to use mutex instead of atomic counter Since CUE is not thread-safe, we need the mutex for the entire validation operation anyway. Using a regular int counter protected by the mutex is simpler and cleaner than using atomic operations.
…
…
Dashboards: Prevent memory leak in CUE validation by reusing context only for 100 validations (#114818)
…
…
…
The open-source platform for monitoring and observability
Grafana allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data-driven culture:
- Visualizations: Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs.
- Dynamic Dashboards: Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.
- Explore Metrics: Explore your data through ad-hoc queries and dynamic drilldown. Split view and compare different time ranges, queries and data sources side by side.
- Explore Logs: Experience the magic of switching from metrics to logs with preserved label filters. Quickly search through all your logs or streaming them live.
- Alerting: Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.
- Mixed Data Sources: Mix different data sources in the same graph! You can specify a data source on a per-query basis. This works for even custom datasources.
Get started
Unsure if Grafana is for you? Watch Grafana in action on play.grafana.org!
Documentation
The Grafana documentation is available at grafana.com/docs.
Contributing
If you're interested in contributing to the Grafana project:
- Start by reading the Contributing guide.
- Learn how to set up your local environment, in our Developer guide.
- Explore our beginner-friendly issues.
- Look through our style guide and Storybook.
Share your contributor experience in our feedback survey to help us improve.
Get involved
- Follow @grafana on X (formerly Twitter).
- Read and subscribe to the Grafana blog.
- If you have a specific question, check out our discussion forums.
- For general discussions, join us on the official Slack team.
This project is tested with BrowserStack.
License
Grafana is distributed under AGPL-3.0-only. For Apache-2.0 exceptions, see LICENSING.md.
Description
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
alertinganalyticsbusiness-intelligencedashboarddata-visualizationelasticsearchgografanahacktoberfestinfluxdbmetricsmonitoringmysqlpostgresprometheus
Readme
AGPL-3.0
2.7 GiB
0 Stars
1 Watchers
0 Forks
Languages
TypeScript
52.9%
Go
44.3%
CUE
0.7%
Rich Text Format
0.5%
HTML
0.4%
Other
1%

