728x90
@artmizu/nuxt-prometheus 설치
pnpm add @artmizu/nuxt-prometheus
nuxt.config.ts
export default defineNuxtConfig({
modules: ["@artmizu/nuxt-prometheus"],
prometheus: {
verbose: true, // ✅ 외부 요청 및 페이지 렌더링 시간 로깅
healthCheck: true, // ✅ 헬스 체크 활성화
healthCheckPath: "/health", // ✅ 헬스 체크 경로 설정
prometheusPath: "/metrics", // ✅ Prometheus 메트릭 경로 설정
prefix: "nuxt_app_", // ✅ Prometheus 메트릭에 접두사 추가 (선택)
},
});
prometheuse 인터페이스
export interface AnalyticsModuleParams {
/**
* stdout logs about external requests and render time of the page
* @default true
*/
verbose: boolean;
/**
* To turn on and off the healthcheck route
* @default true
*/
healthCheck: boolean;
/**
* Healthcheck url path
* @default '/health'
*/
healthCheckPath: string;
/**
* Prometheus exporter url path
* @default '/metrics'
*/
prometheusPath: string;
/**
* An optional prefix for metric names.
*
* @default no prefix
*/
prefix?: string;
}
deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nuxt-app
spec:
replicas: 2
selector:
matchLabels:
app: nuxt-app
template:
metadata:
labels:
app: nuxt-app
spec:
containers:
- name: nuxt-app
image: your-registry/nuxt-app:latest
ports:
- containerPort: 3000
livenessProbe: # ✅ Nuxt 서버가 살아 있는지 확인
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
readinessProbe: # ✅ Nuxt 서버가 트래픽을 받을 준비가 되었는지 확인
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
728x90
'Javascript > NuxtJS' 카테고리의 다른 글
[Nuxt3] 환경 변수 관리 (0) | 2025.03.15 |
---|---|
[Nuxt3] 스토리지: vueuse (0) | 2025.03.15 |
[Nuxt3] 데이터 요청 (0) | 2025.03.15 |
[Nuxt3] Nitro (0) | 2025.03.15 |
[Nuxt3] Server (0) | 2025.03.15 |