Please answer the following questions for yourself before submitting an issue.
Service.currentContext is undefined, no documentation update for this breaking change, no information in Changelog or migration guide
in moleculer sources it seems commented
https://github.com/moleculerjs/moleculer/blob/master/src/service.js#L421
https://github.com/moleculerjs/moleculer/blob/master/src/service-broker.js#L1549
https://github.com/moleculerjs/moleculer/blob/master/src/service-broker.js#L190
Please provide detailed steps for reproducing the issue.
const broker = new ServiceBroker({
logger: console,
transporter: "NATS"
});
broker.createService({
name: "test",
actions: {
empty(ctx) {
this.logger.info(this.currentContext)
return "Hello"
}
}
});
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Hi @kesslerdev thanks for reporting. Unfortunately we had to remove the currentContext due to huge performance impact caused by async_hooks. I've removed the reference about currentContext from the docs to avoid confusing the users and will do the same in the changelog.
This also breaks the EventLegacyTraceExporter because getCurrentContext() has been removed.
const ctx = this.broker.getCurrentContext();
if (ctx)
this.processExtraMetrics(ctx, payload);
Ohh, nice catch!
Fixed in 09cf905bd75eaa67995026ad886002b4e5863197