-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
I can't push with pushgateway #1780
Comments
Is |
Yes is defined. I'm assuming that when I add Pushgateway to exports and providers, the url is stepped on again and is undefined, because I've been debugging and that happens, but if I don't put that in there, I get another error. |
What do you mean by "stepped on?" Do you mean the debugger hits it? |
I mean that the url gets to gatewayurl in the library to be able to build the whole PushGateway, but when the debugger gets to the point of checking the providers and exports that url becomes undefined. Do you happen to have a more complete example of pushgateway with the library ? |
There isn't much to it. The example in the docs is comprehensive. This is all that happens when you provide those options: nestjs-prometheus/src/module.ts Lines 31 to 41 in 8e3802a
nestjs-prometheus/src/module.ts Lines 137 to 143 in 8e3802a
Given the error, it seems like I have some tests but if you think there is a bug here please open a PR with the failing test case. |
This is my module @Module({
imports: [
PrometheusModule.register({
pushgateway: {
url: 'http://prometheus-pushgateway',
},
defaultLabels: {
app: 'Mobile BFF',
},
}),
],
providers: [
PromService,
{
provide: TRACING_PLUGIN_KEY,
useValue: apolloTracingPlugin(),
},
{
provide: METRICS_PLUGIN_KEY,
useValue: createMetricsPlugin(register),
},
Pushgateway,
],
exports: [PromService, TRACING_PLUGIN_KEY, METRICS_PLUGIN_KEY],
})
export class PromModule {} This is my PromService import { Injectable } from '@nestjs/common';
import { Pushgateway } from 'prom-client';
@Injectable()
export class PromService {
constructor(private pushgateway: Pushgateway) {
this.pushgateway.push({
jobName: 'mobile-bff',
});
}
} When add Pushgateway in providers i have this error: TypeError: The "url" argument must be of type string. Received undefined but when not add Pushgateway in providers i have this error: Potential solutions:
- Is PromModule a valid NestJS module?
- If Pushgateway is a provider, is it part of the current PromModule?
- If Pushgateway is exported from a separate @Module, is that module imported within PromModule?
@Module({
imports: [ /* the Module containing Pushgateway */ ]
})
|
Can you provide a complete stack trace? |
When I start the application, I get those errors I told you about. |
Neither of these things are a complete stack trace. I need to see where in the stack this library's code is being called. |
I can't understand what you need to help me, when you see my code you don't see anything strange by chance? Is that pushgateway import okay? I feel like by doing that I'm creating a new instance and stomping on the previously set values. |
That is the only possibility I see. I will try and reproduce tonight. Otherwise, I see nothing wrong since you are just telling NestJS what type to inject, not the exact instance. But in terms of what I need from you, a complete stack trace would be the best.
This is just the top line of the trace and it tells me nothing about the call stack so I can't see where the library code is being hit. |
I've been unable to reproduce this locally. Without a proper stack trace I can't do much more. Please provide a proper stack or open a PR with a failing test case |
Hi, I maybe find the reason, could I try to send a pr to this repository? @willsoto |
🎉 This issue has been resolved in version 5.2.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
With the documentation that is in the repository it is not possible for me to understand how pushgateway works, I have the following and I have gatewayurl undefined errors.
Prom.module.ts
PromService.ts
Error in console:
The text was updated successfully, but these errors were encountered: