-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add integration tests #19
Comments
Hey, I created PrometheusModule for metrics based on the package and I'm trying to test it but get the error: this is my module: @module({ and my testing module:
}); but I fail to provide OpenTelemetryMeterProvider whatever I do, I'm not sure how to provide injected stuff. |
MetricService is injected globally when you use that lib. What you are trying to do is to inject the service directly into another module without any other dependency is available. In your main app you need Is there a reason you would be creating a prometheus service? MetricService should cover most of the cases, all you need is a prometheus exporter |
basically you are right but I used interceptor to meter all requests and I noticed that the counters are reset each time if not injected one by one, so I wrapped it with a module that is MetricService alike. Regarding the error, I added OpenTelemetryModule.forRoot() to my PrometheusModule and now I get another error: |
Hey @issackr could you share more on that issue? when you mean reset each time if not injected, what you mean by that? It should reuse the existing one. |
@pragmaticivan Sure, it means the counters value aggregators remain on 1 after each call, no matter how many calls you make. Regarding the injection I meant like in other libraries which you need to inject each counter your'e using (not generic enough for me), anyway I solved it by wrapping my metric in another map of my own like in MetricService. Tnx |
@pragmaticivan I also migrated my project to nest 8, maybe this is whats making problems |
Ohh I haven't tested with nest 8, there might be a problem there indeed. |
I think I found the bug you mentioned while adding more tests today. |
|
@pragmaticivan Looks awesome, thanks for the great work! still having the testing ModuleRef issue though |
@issackr I just fixed the reuse of metrics. I haven't tested on NestJS 8.x yet. They have changed a lot of things. Might need to test a new example this week. |
@pragmaticivan Tnx for the update, I'm definitely gonna use it |
No description provided.
The text was updated successfully, but these errors were encountered: