【问题标题】:Organisaing metric storage in Graphite?在 Graphite 中组织度量存储?
【发布时间】:2023-10-07 18:22:01
【问题描述】:

如何让我的指标保存在根级别。目前已保存在统计信息层次结构下(请参阅graphite) 想保存在顶层(Graphite)下

【问题讨论】:

    标签: graphite


    【解决方案1】:

    将这些设置添加到您的 statsd 配置文件(可能类似于 /etc/statsd.js

    {
      ...(unrelated options)...
    , graphite: {
        legacyNamespace: false
      , globalPrefix:  ""
      , prefixCounter: ""
      , prefixTimer:   ""
      , prefixGauge:   ""
      , prefixSet:     ""
      }
    }
    

    【讨论】:

      【解决方案2】:

      看起来您在使用 statsd 和 graph.js 后端。

      如果在 init() 期间没有提供全局前缀,则在代码中设置为使用 stats. 为指标添加前缀

      https://github.com/etsy/statsd/blob/master/backends/graphite.js

      line 180: globalPrefix  = globalPrefix !== undefined ? globalPrefix : "stats";
      

      您将需要更改调用 init() 的方式,为其提供一个空白的 gobalPrefix。

      您需要更改后端才能停止在所有 statsd 指标前加上 stats。

      【讨论】:

      • Prathan 的答案应该被标记为正确。您只需在 'graphite' 键下包含 *prefix 选项。