this.broker.metrics.register({
type: 'histogram',
name: 'api.response',
description: 'Response time taken by an API call',
unit: 'millisecond',
})
this.broker.metrics.register({
type: 'counter',
name: 'posts.get.total',
description: 'Number of requests of posts',
unit: 'request',
})
and using them like:
@Service()
export class LogResponseTimeMetric implements MiddlewareInterface<BaseContext> {
async use({ info }: ResolverData<BaseContext>, next: NextFn): Promise<any> {
const broker = Container.get<ServiceBroker>('moleculerBroker')
const timeEnd = broker.metrics.timer('api.response')
await next()
const time_end = timeEnd()
console.log('time end is: ', time_end)
broker.metrics.increment('posts.get.total')
}
}
Able to get the posts.get.total metric on datadog but seems like api.response metric is always missing? Anything incorrect or is this a bug?
Registering metric like:
and using them like:
Able to get the
posts.get.total
metric on datadog but seems likeapi.response
metric is always missing? Anything incorrect or is this a bug?