0.0.17 • Published 9 months ago

@imqa/instrumentation-node v0.0.17

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
9 months ago

@imqa/instrumentation-node

NPM Published Version NPM Last Update NPM Unpacked Size NPM Downloads NPM Type Definitions License

개요

@imqa/instrumentation-node는 Node.js 환경에서 OpenTelemetry 기반의 자동 계측을 제공합니다.
이 모듈은 @sentry/node와 연동하여, Node.js 애플리케이션의 트레이싱 및 성능 모니터링을 손쉽게 구현할 수 있도록 지원합니다.

OpenTelemetry JS API 및 SDK 1.0+ 버전과 호환됩니다.

설치

npm install --save @imqa/instrumentation-node

사용법

const {
  SentryNodeInstrumentation,
} = require('@imqa/instrumentation-node');
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');

const provider = new NodeTracerProvider();
provider.register();

registerInstrumentations({
  instrumentations: [new SentryNodeInstrumentation()],
});

스키마 구조

이 모듈은 OpenTelemetry 스팬(Span) 기반으로 Node.js 애플리케이션의 주요 동작을 추적합니다.

주요 스팬

  • SentryNodeInstrumentation 스팬
    Node.js 애플리케이션의 주요 트랜잭션 및 이벤트를 추적하는 스팬입니다.
    • traceId: 트레이스의 고유 식별자
    • spanId: 스팬의 고유 식별자
    • name: 스팬 이름 (예: "http.request", "db.query" 등)
    • kind: 스팬의 타입 (SERVER, CLIENT, INTERNAL 등)
    • startTimeUnixNano: 스팬 시작 시간 (나노초)
    • endTimeUnixNano: 스팬 종료 시간 (나노초)
    • status: 결과 상태 (0 = OK, 1 = ERROR, 2 = UNSET)

스팬 속성

각 스팬은 다음과 같은 공통 속성을 포함할 수 있습니다:

속성타입설명
service.namestring서비스 이름
environmentstring환경 이름 (예: "production", "development")
deployment.environmentstring배포 환경
http.methodstringHTTP 요청 메서드
http.urlstring요청 URL
http.status_codeintegerHTTP 응답 코드
db.systemstring데이터베이스 종류 (예: "mysql", "postgresql")
db.statementstring실행된 쿼리문
componentstring계측 컴포넌트 (예: "sentry-node")

이벤트

스팬에는 다양한 이벤트가 기록될 수 있습니다. 예를 들어:

이벤트설명
exception예외 발생 시 기록
log로그 이벤트 기록
requestHTTP 요청 시작
responseHTTP 응답 완료

계측 설정

(boolean 또는 SentryNodeInstrumentationConfig, 선택)

계측 활성화 여부 및 세부 설정을 지정할 수 있습니다.

interface SentryNodeInstrumentationConfig
  extends InstrumentationConfig {
  ignoreUrls?: (string | RegExp)[];
  captureHttpHeaders?: boolean;
}
  • ignoreUrls: 계측하지 않을 URL 패턴 지정 (정규식 또는 문자열 배열)
  • captureHttpHeaders: HTTP 헤더 캡처 여부

유용한 링크

라이센스

Copyright (c) 2024-2025 ONYCOM CO., LTD. All rights reserved.

0.0.17

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

11 months ago

0.0.11

12 months ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago