README
@ailo/monitoring
Utilities for setting up logging and tracing for Ailo node.js services.
Usage
yarn add @ailo/monitoring @ailo/service-utils @sentry/node @sentry/tracing
// src/common/config.ts
import { parseNumberEnv, parseBooleanEnv } from "@ailo/service-utils";
export const config = {
...,
sentry: {
enabled:
parseBooleanEnv(process.env.SENTRY_ENABLE) ??
process.env.NODE_ENV === "production",
environment: process.env.SENTRY_ENV ?? process.env.NODE_ENV ?? "local",
dsn:
process.env.SENTRY_DSN ||
"https://abcdef.ingest.sentry.io/123456",
tracesSampleRate:
parseNumberEnv(process.env.SENTRY_TRACES_SAMPLE_RATE) ??
(process.env.NODE_ENV === "production" ? 0.01 : 1)
}
};
// src/common/monitoring.ts
import { SentryMonitoring } from "@ailo/monitoring";
import { config } from "./config";
export const monitoring = new SentryMonitoring(config.sentry);
// src/app/app.ts
import "local/common/monitoring";
Development
yarn
yarn start
Testing
yarn lint # prettier and eslint
yarn test # unit tests
yarn test:watch # unit tests in watch mode
Releasing
Note: Releasing is done manually (CI isn't configured yet). Linters, tests, build and so on are run during each git push
/ yarn release
.
yarn release # will automatically ask you about version bump, run tests and build, and push new version to git & npm