10 months 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
10 months 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?

10 months ago
are those the correct ports that your application is listening on?
Maybe it's because it's an HTTP connection and not an HTTPS connection?
10 months ago
it needs to be http, so you have that correct.
the pricate network is ipv6 only, so are you listening on ipv6?
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?
10 months ago
no it doesn't
10 months ago
have you tried using the correct port?
10 months ago
awesome!
10 months ago
!s
Status changed to Solved brody • 10 months ago
