2 years ago
I have two services, one for my backend and another for Prometheus. How can I make Prometheus scrape my backend? I am using Nest.js for my backend. If you need additional information, I can share it.
16 Replies
2 years ago
hello, you would want to use the prom client in your codebase
My problem is i cant conect with backend. i have to use prom client?
2 years ago
are those the correct ports that your application is listening on?
2 years ago
it needs to be http, so you have that correct.
the pricate network is ipv6 only, so are you listening on ipv6?
Yes ipv6, the error are in the port
this is my main.ts:
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
import * as cookieParser from 'cookie-parser'
import * as dotenv from 'dotenv'
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
import { ValidationPipe } from '@nestjs/common'
import { AxiosInterceptor } from './axios.interceptor'
import { MetricsService } from './modules/metrics/metrics.service'
import { MetricsInterceptor } from './modules/metrics/metrics.interceptor'
dotenv.config()
async function bootstrap() {
const app = await NestFactory.create(AppModule)
const port = process.env.PORT || 3000
const isDevelopment = process.env.NODE_ENV !== 'PROD'
// Metrics setup
const metricsService = app.get(MetricsService)
app.useGlobalInterceptors(new MetricsInterceptor(metricsService))
app.useGlobalPipes(new ValidationPipe())
app.use(cookieParser())
app.useGlobalInterceptors(new AxiosInterceptor())
app.useGlobalPipes(new ValidationPipe())
app.use(cookieParser())
app.enableCors({
origin: [
links - i have the correct links here
],
credentials: true,
})
if (isDevelopment) {
const config = new DocumentBuilder()
.setTitle('VAULT | Wallet - SaaS API')
.setDescription('The documentation of all Wallet - SaaS API Project')
.setVersion('1.0')
.build()
const document = SwaggerModule.createDocument(app, config)
SwaggerModule.setup('api', app, document)
}
await app.listen(port, '::')
console.log(Server is listening on all interfaces (:::${port}))
}
bootstrap()
My question is: when I deploy, does the port my backend is listening on change every time?
2 years ago
no it doesn't
2 years ago
have you tried using the correct port?
2 years ago
awesome!
2 years ago
!s
Status changed to Solved brody • over 1 year ago