Moleculer metrics module for Jaeger.
- 5 types sampler
- UDP sender
$ npm install moleculer-jaeger
// moleculer.config.js
module.exports = {
// ...
metrics: true,
// ...
}
// services/metrics.jaeger.service.js
const JaegerService = require("moleculer-jaeger");
module.exports = {
mixins: [JaegerService],
settings: {
host: "jaeger-server",
port: 6832
}
};
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: {
//...
}
}
}
});
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 |
$ npm test
In development with watching
$ npm run ci
The project is available under the MIT license.
Copyright (c) 2016-2018 MoleculerJS