Skip to content
Snippets Groups Projects
Unverified Commit 349e6463 authored by Ricardo Garim's avatar Ricardo Garim Committed by GitHub
Browse files

regression: add tracing instrumentation on LocalBroker (#33750)

parent ccaa3151
No related branches found
No related tags found
No related merge requests found
import { EventEmitter } from 'events';
import { InstanceStatus } from '@rocket.chat/models';
import { injectCurrentContext, tracerActiveSpan } from '@rocket.chat/tracing';
import { asyncLocalStorage } from '.';
import type { EventSignatures } from './events/Events';
......@@ -17,17 +18,22 @@ export class LocalBroker implements IBroker {
private services = new Set<IServiceClass>();
async call(method: string, data: any): Promise<any> {
const result = await asyncLocalStorage.run(
{
id: 'ctx.id',
nodeID: 'ctx.nodeID',
requestID: 'ctx.requestID',
broker: this,
return tracerActiveSpan(
`action ${method}`,
{},
() => {
return asyncLocalStorage.run(
{
id: 'ctx.id',
nodeID: 'ctx.nodeID',
requestID: 'ctx.requestID',
broker: this,
},
(): any => this.methods.get(method)?.(...data),
);
},
(): any => this.methods.get(method)?.(...data),
injectCurrentContext(),
);
return result;
}
async waitAndCall(method: string, data: any): Promise<any> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment