Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
artedi
Advanced tools
Changelog
2.0.3
Readme
artedi
is a Node.js library for measuring applications -- specifically, the
services composing Triton and Manta.
Here is a simple example usage of counters and histograms to expose metrics in the Prometheus v0.0.4 text format.
var artedi = require('artedi');
// collectors are the 'parent' collector.
var collector = artedi.createCollector();
// counters are a 'child' collector.
// This call is idempotent.
var counter = collector.counter({
name: 'http_requests_completed',
help: 'count of muskie http requests completed',
labels: {
zone: 'e5d3'
}
});
// Add 1 to the counter with the labels 'method=getobject,code=200'.
counter.increment({
method: 'getobject',
code: '200'
});
collector.collect(artedi.FMT_PROM, function (err, metrics) {
console.log(metrics);
// Prints:
// # HELP http_requests_completed count of muskie http requests completed
// # TYPE http_requests_completed counter
// http_requests_completed{zone="e5d3",method="getobject",code="200"} 1
});
var histogram = collector.histogram({
name: 'http_request_latency_seconds',
help: 'latency of muskie http requests',
buckets: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]
});
// Observe a latency of 998ms for a 'putobjectdir' request.
histogram.observe(0.998, {
method: 'putobjectdir'
});
// For each bucket, we get a count of the number of requests that fall
// below or at the latency upper-bound of the bucket.
// This output is defined by Prometheus.
collector.collect(artedi.FMT_PROM, function (err, metrics) {
if (err) {
throw new Error('could not collect metrics');
}
console.log(metrics);
// Prints:
// # HELP http_requests_completed count of muskie http requests completed
// # TYPE http_requests_completed counter
// http_requests_completed{method="getobject",code="200",zone="e5d3"} 1
// # HELP http_request_latency_seconds latency of muskie http requests
// # TYPE http_request_latency_seconds histogram
// http_request_latency_seconds{method="putobjectdir",le="0.005"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.01"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.025"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.05"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.01"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.25"} 0
// http_request_latency_seconds{method="putobjectdir",le="0.5"} 0
// http_request_latency_seconds{method="putobjectdir",le="1"} 1
// http_request_latency_seconds{method="putobjectdir",le="2.5"} 1
// http_request_latency_seconds{method="putobjectdir",le="5"} 1
// http_request_latency_seconds{method="putobjectdir",le="10"} 1
// http_request_latency_seconds{le="+Inf",method="putobjectdir"} 1
// http_request_latency_seconds_count{method="putobjectdir"} 1
// http_request_latency_seconds_sum{method="putobjectdir"} 0.998
});
For more advanced usage and full API documentation, see docs/API.md.
npm install artedi
artedi includes some useful DTrace probes. The full listing of probes and their arguments can be found in the lib/provider.js file.
In this first example artedi is observing the latency of queries to three Postgres instances (using joyent/pgstatsmon). The latency observations include the name of the backend Postgres instance.
We can create a graph of each Postgres backend's latency using built-in DTrace aggregation:
$ dtrace -qn 'artedi*:::histogram-observe {@lat[json(copyinstr(arg2), "name")] = quantize(arg1);} tick-10s {printa(@lat);}'
3.postgres.walleye.kkantor.com-87eb177c
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@@@ 5
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15
64 |@@ 1
128 | 0
2.postgres.walleye.kkantor.com-335c1a83
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@ 4
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 16
64 |@@ 1
128 | 0
1.postgres.walleye.kkantor.com-f5c49b33
value ------------- Distribution ------------- count
8 | 0
16 |@@@@@@@@ 4
32 |@@@@@@@@@@@@@@@@@@@@@@@@@@@ 14
64 |@@@@@@ 3
128 | 0
^C
We could also retrieve the number of HTTP operations performed by HTTP handler name and return code (from manta-muskie):
$ dtrace -qn 'artedi*:::counter-add /copyinstr(arg0) == "http_requests_completed" /{ jsonstr = copyinstr(arg2); @counts[json(jsonstr, "operation"), json(jsonstr, "statusCode")] = count(); }'
^C
getstorage 200 135
putobject 204 137
These probes could conceivably be used to create more complicated reporting tools as well.
MPL-v2
FAQs
a metric client library
The npm package artedi receives a total of 29 weekly downloads. As such, artedi popularity was classified as not popular.
We found that artedi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.