1.0.0 • Published 1 year ago
coda-metric v1.0.0
Coda Metrics Library in Typescript
Metric Library is a wrapper library to sends metrics using OTEL SDK to Collector Since this library use GRPC, So we could use this on server side only (node application) not client side (web browser)
Build the metric library
npm install
npm run build
Include the dependency in the project
"dependencies": { "coda-metric": "1.0.0", . . . }
Using the metric library
// import metric library import { metrics, MetricConfig} from 'coda-metric'; // call init with configuration let config = new MetricConfig(); metrics.init(config); // send metric data let map = new Map() map.set('environment', 'test') metrics.sendIntCounterMetrics('hello_world', map, 1);
Following is the list of available methods.
sendIntCounterMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
sendDoubleCounterMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
sendIntHistogramMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
sendDoubleHistogramMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
sendIntUpDownCounterMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
sendDoubleUpDownCounterMetrics(metricName: String, tags: Map<string, string>, metricsValue: number ): void;
1.0.0
1 year ago