Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/bright-tigers-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@naverpay/prometheus-koa": minor
---

feat(koa): Koa 3.x 지원 추가

PR: [feat(koa): Koa 3.x 지원 추가](https://github.com/NaverPayDev/prometheus/pull/19)
5 changes: 3 additions & 2 deletions packages/koa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,10 @@ app.use(metricsRouter.routes()) // 마지막에 추가

## 요구 사항

- Node.js 16.0.0 이상
- Node.js 16.0.0 이상 (Koa 3.x 사용 시 18.0.0 이상)
- TypeScript 4.5 이상
- Koa 2.0.0 이상
- Koa 2.x 또는 3.x
- @koa/router 14.0.0 이상

## 라이센스

Expand Down
5 changes: 3 additions & 2 deletions packages/koa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@
"devDependencies": {
"@naverpay/pite": "catalog:",
"@naverpay/tsconfig": "workspace:*",
"@types/koa": "^2.13.5",
"@types/koa": "^3.0.0",
"@types/koa__router": "^12.0.4",
"@types/node": "catalog:",
"@types/on-finished": "catalog:",
"vite": "catalog:"
},
"peerDependencies": {
"@koa/router": ">=14.0.0"
"@koa/router": ">=14.0.0",
"koa": ">=2.0.0"
},
"packageManager": "pnpm@10.6.5"
}
2 changes: 1 addition & 1 deletion packages/koa/src/router/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {KoaPrometheusExporterOptions} from '../types'
*/
export function getKoaMetricsRouter({
metricsPath = DEFAULT_METRICS_PATH,
}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>) {
}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>): Router {
const router = new Router()
router.get(metricsPath, async (context) => {
const {metrics, metricsRegistry} = await pm2Connector.getMetrics()
Expand Down
4 changes: 3 additions & 1 deletion packages/koa/src/router/noop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import type {KoaPrometheusExporterOptions} from '../types'
* @param options - Configuration options including metrics path
* @returns Configured Koa router
*/
export function getNoopRouter({metricsPath = DEFAULT_METRICS_PATH}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>) {
export function getNoopRouter({
metricsPath = DEFAULT_METRICS_PATH,
}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>): Router {
const router = new Router()
router.get(metricsPath, async (context) => {
context.status = HttpStatusCodes.OK
Expand Down
2 changes: 1 addition & 1 deletion packages/koa/src/router/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {KoaPrometheusExporterOptions} from '../types'
*/
export function getKoaStandaloneMetricsRouter({
metricsPath = DEFAULT_METRICS_PATH,
}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>) {
}: Pick<KoaPrometheusExporterOptions, 'metricsPath'>): Router {
const router = new Router()
router.get(metricsPath, async (context) => {
const {metrics, contentType} = await getStandaloneMetrics()
Expand Down
Loading
Loading