Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change registration of object LiquidElasticApmInterceptor inside the method AddLiquidElasticApmTelemetry #113

Open
Dervanil opened this issue Jun 8, 2022 · 3 comments
Labels
bug Something isn't working ready This issue has the solution defined and ready to be acted

Comments

@Dervanil
Copy link
Contributor

Dervanil commented Jun 8, 2022

Change the registration to use ‘AddTransient’ metohod instead of ‘AddInterceptor’, the object ‘LiquidElasticApmInterceptor’ is not called during the lifecycle of the execution which causes the log to be incomplete, changing the registration method fixes the problem.

@lucianareginalino
Copy link
Collaborator

lucianareginalino commented Jun 9, 2022

A better way to solve problem is inject interceptor using telemetry injection methods from Liquid.Core : services.AddTransientLiquidTelemetry<ILiquidProducer, ServiceBusProducer>(); because
for the perfect functioning of the interceptor you must create a proxy based on the service you want to intercept, and the mentioned method already performs this function.

@lucianareginalino lucianareginalino added bug Something isn't working ready This issue has the solution defined and ready to be acted labels Jun 9, 2022
@dervanil-junior
Copy link
Contributor

Looking inside the ‘AddTransientLiquidTelemetry’ method, it is using ‘services.AddInterceptor();’, this ‘AddInterceptor’, is adding the interceptor using ‘services.TryAddTransient(typeof(IAsyncInterceptor), typeof(TInterceptor));’ which when called won’t add the interceptor a second time, according to the documentation ‘ServiceCollectionDescriptorExtensions.TryAddTransient Method (Microsoft.Extensions.DependencyInjection.Extensions) | Microsoft Docs’
hence the need to use ‘AddTransient’, considering that the proxies are already been generated by the telemetry, I am not seeing any benefits in using this method, what is the recommendation is this case?

@lucianareginalino
Copy link
Collaborator

oh yes, i see you need to inject the "LiquidElasticApmInterceptor" and the method I mentioned, injects the "LiquidTelemetryInterceptor".
In this case it will be necessary to recreate the behavior (creation of the proxy) inside your method, because without this the interceptor will not work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready This issue has the solution defined and ready to be acted
Projects
None yet
3 participants