@aurox/telemetry
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -0,3 +1,4 @@ | ||
export * from './service'; | ||
export * from './beacon'; | ||
export * from './metrics'; | ||
export * from './logger'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
(0, tslib_1.__exportStar)(require("./service"), exports); | ||
(0, tslib_1.__exportStar)(require("./beacon"), exports); | ||
@@ -5,0 +6,0 @@ (0, tslib_1.__exportStar)(require("./metrics"), exports); |
@@ -14,3 +14,3 @@ "use strict"; | ||
const disableDefaultMetrics = options?.disableDefaultMetrics ?? false; | ||
prom_client_1.default.register.setDefaultLabels({ service_name: service.name }); | ||
prom_client_1.default.register.setDefaultLabels({ service_name: service.serviceName, instance_name: service.instanceName }); | ||
if (!disableDefaultMetrics) { | ||
@@ -17,0 +17,0 @@ (0, prom_client_1.collectDefaultMetrics)(); |
import Koa, { DefaultState, DefaultContext } from 'koa'; | ||
export interface TelemetryService { | ||
name: string; | ||
serviceName: string; | ||
instanceName: string; | ||
server: Koa<DefaultState, DefaultContext>; | ||
@@ -8,4 +9,5 @@ listen: (port?: number) => void; | ||
export interface SetupServiceOptions { | ||
name: string; | ||
serviceName: string; | ||
instanceName: string; | ||
} | ||
export declare function setupService({ name }: SetupServiceOptions): TelemetryService; | ||
export declare function setupService(options: SetupServiceOptions): TelemetryService; |
@@ -7,3 +7,4 @@ "use strict"; | ||
const config_1 = require("./config"); | ||
function setupService({ name }) { | ||
function setupService(options) { | ||
const { serviceName, instanceName } = options; | ||
const server = new koa_1.default(); | ||
@@ -15,5 +16,5 @@ function listen(port) { | ||
} | ||
return { name, server, listen }; | ||
return { serviceName, instanceName, server, listen }; | ||
} | ||
exports.setupService = setupService; | ||
//# sourceMappingURL=service.js.map |
{ | ||
"name": "@aurox/telemetry", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A universal solution for logging, tracing, metrics, health-checks and more", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,3 +1,4 @@ | ||
export * from './service'; | ||
export * from './beacon'; | ||
export * from './metrics'; | ||
export * from './logger'; |
@@ -21,3 +21,3 @@ import client, { collectDefaultMetrics } from 'prom-client'; | ||
client.register.setDefaultLabels({ service_name: service.name }); | ||
client.register.setDefaultLabels({ service_name: service.serviceName, instance_name: service.instanceName }); | ||
@@ -24,0 +24,0 @@ if (!disableDefaultMetrics) { |
@@ -6,3 +6,4 @@ import Koa, { DefaultState, DefaultContext } from 'koa'; | ||
export interface TelemetryService { | ||
name: string; | ||
serviceName: string; | ||
instanceName: string; | ||
server: Koa<DefaultState, DefaultContext>; | ||
@@ -13,6 +14,9 @@ listen: (port?: number) => void; | ||
export interface SetupServiceOptions { | ||
name: string; | ||
serviceName: string; | ||
instanceName: string; | ||
} | ||
export function setupService({ name }: SetupServiceOptions): TelemetryService { | ||
export function setupService(options: SetupServiceOptions): TelemetryService { | ||
const { serviceName, instanceName } = options; | ||
const server = new Koa(); | ||
@@ -26,3 +30,3 @@ | ||
return { name, server, listen }; | ||
return { serviceName, instanceName, server, listen }; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82766
1473