➡ Submitting Metrics
Metrics API is the same among all different chains.
Metrics have 2 types: Counter and Gauge.
const totalSupply = (await ctx.contract.totalSupply()).scaleDown(tokenInfo.decimal)
ctx.meter.Gauge("total_supply").record(totalSupply, {token: tokenInfo.symbol})
const amount = event.args.amount.scaleDown(tokenInfo.decimal)
ctx.meter.Counter("mint_acc").add(amount, {token: tokenInfo.symbol})
Note, token
is the #labels you can attach when you submit the metric.
Please refer to metrics-in-processorsfor more definitions.
Please refer to metricsfor the definitions.
Updated 7 months ago