new Relic -如何传递自定义字符串

问题描述 投票:0回答:1

我想在 new Relic 中设置一个标签,并将其显示在新的遗物仪表板上。例如。我想在伪代码中做这样的事情:

newRelic.setString("状态","已禁用");

我能做到吗?

newrelic newrelic-platform
1个回答
0
投票

是的,您可以收集所谓的自定义参数、指标或使用自定义事件。

这是 ruby 代码的示例,但以下内容也适用于 Java 库。

class Cart

  def checkout()
    amount = compute_cart_total    # computes the amount to charge the customer

    ::NewRelic::Agent.record_metric('Custom/Cart/charge_amount', amount)

    charge_customer(amount)
    ...
  end
end

https://docs.newrelic.com/docs/apm/other-features/metrics/custom-metrics

https://docs.newrelic.com/docs/apm/other-features/attributes/collecting-custom-attributes

© www.soinside.com 2019 - 2024. All rights reserved.