Skip to content

Commit

Permalink
fix: stats and typo, use --stats instead of --disable-stats (#10)
Browse files Browse the repository at this point in the history
* fix: stats and typo

* add back config example

* fix: use stats instead of disable-stats
  • Loading branch information
robertsLando authored Jun 19, 2020
1 parent e98f3ca commit 47938bd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ Options:
--ws-port mqtt-over-websocket server port[number] [default: 3000]
--wss-port mqtt-over-secure-websocket server port
[number] [default: 4000]
--disable-stats disable the publishing of stats under $SYS
[boolean] [default: true]
--stats enable publish of stats under $SYS
[boolean] [default: false]
--stats-interval interval between aedes stats pubs
[number] [default: 5000]
--broker-id the id of the broker in the $SYS/<id> namespace
[string] [default: "aedes-cli"]
--config, -c <file> the config file to use (overrides every other
Expand All @@ -94,10 +96,12 @@ Options:
-h, --help Show help [boolean]
Examples:
aedes --proto tcp ws Starts Aedes broker with TCP and WS
aedes --protos tcp ws Starts Aedes broker with TCP and WS
servers
aedes --config myConfig.js Starts Aedes broker with custom
config file
aedes --stats -v --statsInterval 2000 Starts Aedes broker with stats
enabled
aedes --credentials ./credentials.json Add/Modify user1 with password1 to
adduser user1 password1 credentials
aedes --credentials ./credentials.json Removes user1 from credentials
Expand Down
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
maxClientsIdLength: 23,
heartbeatInterval: 60000,
connectTimeout: 30000,
disableStats: true,
stats: true,
statsInterval: 5000,
// PERSISTENCES
persistence: null,
mq: null,
Expand Down
5 changes: 3 additions & 2 deletions docker/dockerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ module.exports = {
cert: null,
rejectUnauthorized: true,
// AUTHORIZER
credentials: './credentials.json',
credentials: null,
// AEDES
brokerId: 'aedes-cli',
concurrency: 100,
queueLimit: 42,
maxClientsIdLength: 23,
heartbeatInterval: 60000,
connectTimeout: 30000,
disableStats: true,
stats: false,
statsInterval: 5000,
// PERSISTENCES
persistence: {
name: 'mongodb',
Expand Down
18 changes: 12 additions & 6 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ yargs
default: 4000,
type: 'number'
})
.option('disable-stats', {
description: 'disable the publishing of stats under $SYS',
.option('stats', {
description: 'enable publish of stats under $SYS',
type: 'boolean',
default: true
default: false
})
.option('stats-interval', {
description: 'interval between aedes stats pubs',
default: 5000,
type: 'number'
})
.option('broker-id', {
description: 'the id of the broker in the $SYS/<id> namespace',
Expand Down Expand Up @@ -148,8 +153,9 @@ yargs
command: ['start', '$0'],
describe: 'Starts Aedes broker with given options'
})
.example('aedes --proto tcp ws', 'Starts Aedes broker with TCP and WS servers')
.example('aedes --protos tcp ws', 'Starts Aedes broker with TCP and WS servers')
.example('aedes --config myConfig.js', 'Starts Aedes broker with custom config file')
.example('aedes --stats -v --statsInterval 2000', 'Starts Aedes broker with stats enabled')
.example('aedes --credentials ./credentials.json adduser user1 password1', 'Add/Modify user1 with password1 to credentials')
.example('aedes --credentials ./credentials.json rmuser user1', 'Removes user1 from credentials')
.help()
Expand Down Expand Up @@ -399,8 +405,8 @@ async function start (program) {

// STATS ------------

if (!config.disableStats) {
stats(aedes)
if (config.stats) {
stats(broker, { interval: program.statsInterval })
}

// SERVERS ------------
Expand Down
3 changes: 2 additions & 1 deletion test/config/mongodbConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
maxClientsIdLength: 23,
heartbeatInterval: 60000,
connectTimeout: 30000,
disableStats: true,
stats: false,
statsInterval: 5000,
// PERSISTENCES
persistence: {
name: 'mongodb',
Expand Down
3 changes: 2 additions & 1 deletion test/config/redisConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
maxClientsIdLength: 23,
heartbeatInterval: 60000,
connectTimeout: 30000,
disableStats: true,
stats: false,
statsInterval: 5000,
// PERSISTENCES
persistence: {
name: 'redis',
Expand Down

0 comments on commit 47938bd

Please sign in to comment.