How to use artedi - 3 common examples

To help you get started, we’ve selected a few artedi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joyent / moray / lib / server.js View on Github external
var log = options.log;

    // Configure the metric collector.
    var labels = {
        datacenter: options.datacenter,
        server: options.server_uuid,
        zonename: mod_os.hostname(),
        pid: process.pid
    };

    /* service_name includes the shard name in Manta deployments. */
    if (options.service_name) {
        labels.service = options.service_name;
    }

    var collector = mod_artedi.createCollector({
        labels: labels
    });

    var dbopts, dbresolver, dbdomain;
    if (options.standalone) {
        /*
         * Standalone mode takes a Postgres URL to determine what to connect
         * to, which we pass directly to the client. Since this may not be a
         * hostname (i.e., it could a path for using a Unix domain socket),
         * we just provide dummy values here for cueball, and ignore them
         * later on.
         */
        dbopts = options.standalone;
        dbdomain = 'standalone';
        dbresolver = new mod_cueball.StaticIpResolver({
            backends: [
github joyent / moray / pg-setup.js View on Github external
dbresolver.once('added', function (_, primary) {
        var collector = mod_artedi.createCollector({ labels: {} });
        var db = mod_pg.createPool(mod_jsprim.mergeObjects(dbopts.pg, {
            log: LOG,
            domain: 'manatee',
            user: 'postgres',
            collector: collector,
            resolver: dbresolver
        }));

        setupPostgres({
            resolver: dbresolver,
            primary: primary,
            config: config,
            db: db
        }, function (err) {
            db.close();
github joyent / moray / lib / server.js View on Github external
req.on('end', function () {
                collector.collect(mod_artedi.FMT_PROM, function (err, metrics) {
                    if (err) {
                        next(new VError(err));
                        return;
                    }
                    res.setHeader('Content-Type', 'text/plain; version=0.0.4');
                    res.send(metrics);
                });
                next();
            });
            req.resume();

artedi

a metric client library

MPL-2.0
Latest version published 4 years ago

Package Health Score

46 / 100
Full package analysis

Popular artedi functions