Prometheus connection with the backend
pedro-gattai
HOBBYOP

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.

Solved

16 Replies

pedro-gattai
HOBBYOP

a year ago

5075a609-a7b3-4ef7-abed-b5520d932087


a year ago

hello, you would want to use the prom client in your codebase


pedro-gattai
HOBBYOP

a year ago

My problem is i cant conect with backend. i have to use prom client?

1356355785021722898


a year ago

are those the correct ports that your application is listening on?


pedro-gattai
HOBBYOP

a year ago

yes, i just need to connect to backend service the first link


pedro-gattai
HOBBYOP

a year ago

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?


pedro-gattai
HOBBYOP

a year ago

Yes ipv6, the error are in the port

1356358812084474190


pedro-gattai
HOBBYOP

a year ago

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?


pedro-gattai
HOBBYOP

a year ago

have worked


pedro-gattai
HOBBYOP

a year ago

with the port 8080


pedro-gattai
HOBBYOP

a year ago

nice, tnks


a year ago

awesome!


a year ago

!s


Status changed to Solved brody about 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...