grafana

应用程序

grafana/grafana

开源可观测性与数据可视化平台,支持指标、日志和链路追踪。

项目简介

Grafana 支持查询、可视化和告警来自多种数据源的指标、日志和链路追踪。提供动态仪表盘、交互式探索功能和强大的告警引擎。平台支持插件扩展。

README 预览

\n\n\nThe open-source platform for monitoring and observability\n\n[](LICENSE)\n[](https://goreportcard.com/report/github.com/grafana/grafana)\n\nGrafana 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:\n\n- **Visualizations:** Fast and flexible client side graphs with a multitude of options. Panel plugins offer many different ways to visualize metrics and logs.\n- **Dynamic Dashboards:** Create dynamic & reusable dashboards with template variables that appear as dropdowns at the top of the dashboard.\n- **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.\n- **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.\n- **Alerting:** Visually define alert rules for your most important metrics. Grafana will continuously evaluate and send notifications to systems like Slack, PagerDuty, VictorOps, OpsGenie.\n- **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.\n\n## Get started\n\n- [Get Grafana](https://grafana.com/get)\n- [Installation guides](https://grafana.com/docs/grafana/latest/setup-grafana/installation/)\n\nUnsure if Grafana is for you? Watch Grafana in action on [play.grafana.org](https://play.grafana.org/)!\n\n## Documentation\n\nThe Grafana documentation is available at [grafana.com/docs](https://grafana.com/docs/).\n\n## Contributing\n\nIf you're interested in contributing to the Grafana project:\n\n- Start by reading the [Contributing guide](https://github.com/grafana/grafana/blob/HEAD/CONTRIBUTING.md).\n- Learn how to set up your local environment, in our [Developer guide](https://github.co

常见问题 (4)

故障排除
当元数据缺失时,如何修复 Signal Explorer 对 `*_total` 等指标显示 "Unknown type" 的问题?

升级到包含 PR "Explore: Infer metric type from its name in the Signal Explorer when metadata is missing" 的 Grafana/Cloud 版本。该修复在回退到 Unknown type 之前会应用指标名称启发式规则;例如,grafanacloud_instance_discarded_attributed_samples_total 因其 _total 后缀而被识别为计数器(counter)。在进行回移植时,请复用 grafana/metrics-drilldown 中的逻辑:src/shared/GmdVizPanel/matchers/getMetricType.ts 和 src/shared/GmdVizPanel/matchers/isCounterMetric.ts(请在 main 分支上确认当前路径;该 issue 引用了提交 97ec532)。

来源 Issue #132821
故障排除
当标签值被截断时,如何在 Signal Explorer 中查看完整的标签值?

此问题已通过以下方式修复:在 Signal Explorer 侧边栏中,为被截断的标签键和值添加了悬停提示。请升级到包含 PR "Signal Explorer: Reveal full label keys and values on hover" 的版本,然后将鼠标悬停在被截断的标签上即可查看其完整文本。在旧版本中,除了获取包含此修复的构建版本外,没有其他产品内的变通方法。

来源 Issue #132822
故障排除
为什么启用了 gauge 的 Grafana singlestat 面板在升级后会迁移为 stat 而不是 gauge?

自动迁移将每个 singlestat 和 grafana-singlestat-panel 都映射为 stat,而忽略了旧的 gauge.show 设置。请修复 public/app/features/dashboard/state/PanelModel.ts 中 restoreModel() 内的面板类型选择逻辑,在赋予迁移后的类型之前:

let newType = getPanelPluginToMigrateTo(this);

if (this.type === 'singlestat' || this.type === 'grafana-singlestat-panel') {
  if ((this as any).gauge?.show) {
    newType = 'gauge';
  } else {
    newType = 'stat';
  }
}

if (newType) {
  this.autoMigrateFrom = this.type;
  this.type = newType;
}

这样可以保持之前 v24 的行为:gauge.show === true 的面板迁移为 gauge;其他所有 singlestat 面板迁移为 stat。请添加一个回归测试,针对带有 gauge.show: true 的旧版 singlestat 仪表板运行迁移,并验证最终的面板类型为 gauge。

来源 Issue #112236
how_to
如何使用 Sort by 转换按多个列对 Grafana 表格进行排序?

使用单个 **Sort by** 转换,并向其中添加多个字段。在面板中,前往 **Transformations → Add transformation → Sort by**,先添加第一个字段,然后再添加其他字段。将字段拖动为所需的优先级顺序:第一个字段为主排序字段,之后的每个字段用于打破前一字段排序中的并列情况。为每个字段分别设置升序/降序。不要堆叠多个独立的 Sort by 转换,因为每个转换都会对整个数据集重新排序,并不会保留之前的排序结果。如果你的 Grafana UI 只允许使用一个排序字段,请升级到包含多字段 Sort by 转换 PR 的版本。

来源 Issue #77141