0.1.1 • Published 1 year ago

@orderlycode/grafana-otlp-client v0.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

@orderlycode/grafana-otlp-client

환경변수

전체 SDK env

  • OTEL_SERVICE_NAME: 서비스명
  • OTEL_EXPORTER_OTLP_ENDPOINT: grpc otlp endpoint
  • OTEL_NO_DELAY: 환경변수가 존재하면, Export를 최대한 빨리 한다.
  • OTEL_SDK_DISABLED: disable

사용법

CLI

우선순위 때문에 CLI로 하는 것을 추천한다.

node -r @orderlycode/grafana-otlp-client app.js

Code

// 무조건 코드 실행 처음에 존재해야 함
import '@orderlycode/grafana-otlp-client'

로거는 winston를 쓰면 알아서 로그가 보고된다.

import winston from "winston";

export const logger = winston.createLogger({
  transports: [
    new winston.transports.Console(),
  ],
  format: winston.format.combine(
    winston.format.timestamp(),
    winston.format.errors({stack: true}),
    winston.format.splat(),
    winston.format.json()
  ),
});