我想在new Relic中设置一个标签,并让它显示在新的 Relic 仪表板上。例如。我想在伪代码中做这样的事情:
newRelic.setString("状态","禁用");
我能做到吗?
是的,您可以收集所谓的自定义参数、指标或使用自定义事件。
这是一个 ruby 代码示例,但以下内容也适用于 Java lib。
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