Skip to content

Latest commit

 

History

History
 
 

moleculer-jaeger

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Moleculer logo

moleculer-jaeger NPM version

Moleculer metrics module for Jaeger.

Jaeger screenshot

Features

  • 5 types sampler
  • UDP sender

Install

$ npm install moleculer-jaeger

Usage

// moleculer.config.js
module.exports = {
    // ...
    metrics: true,
    // ...
}

// services/metrics.jaeger.js
const JaegerService = require("moleculer-jaeger");

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832
    }
});

Sampler configurations

More info: http://jaeger.readthedocs.io/en/latest/client_libraries/#sampling

Setup ConstSampler (default):

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832,
        
        sampler: {
            type: "Const",
            options: {
                decision: 1
            }
        }
    }
});

Setup RateLimitingSampler:

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832,
        
        sampler: {
            type: "RateLimiting",
            options: {
                maxTracesPerSecond: 2,
                initBalance: 5
            }
        }
    }
});

Setup ProbabilisticSampler:

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832,
        
        sampler: {
            type: "Probabilistic",
            options: {
                samplingRate: 0.1 // 10%
            }
        }
    }
});

Setup GuaranteedThroughputSampler:

GuaranteedThroughputProbabilisticSampler is a sampler that leverages both probabilisticSampler and rateLimitingSampler. The rateLimitingSampler is used as a guaranteed lower bound sampler such that every operation is sampled at least once in a time interval defined by the lowerBound. ie a lowerBound of 1.0 / (60 * 10) will sample an operation at least once every 10 minutes.

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832,
        
        sampler: {
            type: "GuaranteedThroughput",
            options: {
                lowerBound: 0.1,
                samplingRate: 0.1
            }
        }
    }
});

Setup RemoteControlledSampler:

module.exports = {
    mixins: [JaegerService],
    settings: {
        host: "jaeger-server",
        port: 6832,
        
        sampler: {
            type: "RemoteControlled",
            options: {
                //...
            }
        }
    }
});

Settings

Property Type Default Description
host String required UDP Sender host option.
port Number null UDP Sender port option.
sampler Object null Sampler configuration.
sampler.type String null Sampler type
sampler.options any required
options Object null Additional options for Jaeger.Tracer

Actions

Methods

Test

$ npm test

In development with watching

$ npm run ci

License

The project is available under the MIT license.

Contact

Copyright (c) 2016-2018 MoleculerJS

@moleculerjs @MoleculerJS