a year 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
a year ago
hello, you would want to use the prom client in your codebase
a year 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?
a year 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?
a year ago
no it doesn't
a year ago
have you tried using the correct port?
a year ago
awesome!
a year ago
!s
Status changed to Solved brody • 11 months ago

