promts is a native TypeScript based implementation of promclient. Create Prometheus compatible metrics for your TypeScript/Deno Service.
Pronounced: Prom-tsss
Since no current TypeScript Native implementation for Node.JS or Deno seemed to exist, promts fills the gap. This allows for your TypeScript code to have type checking on the promclient types.
import { MetricsManager } from 'https://deno.land/x/promts@v0.1.4
Counters are monotonically increasing–counters never go down. Think http request.
import { MetricsManager } from 'https://deno.land/x/promts@v0.1.4
const httpTotalRequests = MetricsManager.getCounter("http_requests_total")
.with({ service: "web" });
httpTotalRequests.inc();
Gauges can go up and down… Think water levels, temperature, thread counts.
import { MetricsManager } from 'https://deno.land/x/promts@v0.1.4
const processCount = MetricsManager.getGauge("process_count").with({app:"server"});
processCount.inc(); // 1
processCount.inc(3);
processCount.dec();
processCount.getTotal(); // 3
Histograms can be though of as a list of counters. These counters each represent a bucket. Buckets have a label le
which denotes the upper bound. Histograms also contain their sum and count.
import { Histogram } from 'https://deno.land/x/promts@v0.1.4
const histogram = new Histogram("http_request_duration");
histogram.observe(0.01);
histogram.observe(0.1);
histogram.observe(5);
histogram.observe(5);
histogram.getCount(); // 4
histogram.getSum(); // 10.11
histogram.toString(); // dump to string
const pushgateway = new PushGateway("test_job");
pushgateway.sendOnInterval(MetricsManager);
import { MetricsManager } from 'https://deno.land/x/promts@v0.1.4
const metricsData = MetricsManager.toString();
Please refer to CONTRIBUTIONS.md for information about how to get involved. We welcome issues, questions, and pull requests.
Author: base698
Source Code: https://github.com/base698/promts
#deno #nodejs #node #javascript