moleculerjs / moleculer-metrics

:chart_with_upwards_trend: Official monitoring & metrics addons for Moleculer framework
MIT License
48 stars 23 forks source link

Return action response #16

Open alexeymarunin opened 5 years ago

alexeymarunin commented 5 years ago

Hi all)

I think it would be useful to store action response (not only error) in payload on metrics.trace.span.finish event. And because of response can huge/confident this feature will turn off by default, but it could be activated by setting response option to true/object/function like params option

// Action definition
{
    metrics: { 
        params: true,
        meta: true,
        response: true // default false
    }
}

// or

{
    metrics: { 
        params: true,
        meta: true,
        response: ['id', 'name']
    }
}
icebob commented 5 years ago

Good idea.