From 393eb8f8cd753e139c038072260cc1e36c63c98c Mon Sep 17 00:00:00 2001 From: Aaron Suggs Date: Thu, 23 Aug 2012 10:59:01 -0400 Subject: [PATCH 01/17] Optionally omit stats_counts metrics Adds the 'flush_counts' config. Defaults to true, so existing configs aren't affected. --- backends/graphite.js | 8 +++++++- exampleConfig.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/backends/graphite.js b/backends/graphite.js index d5b8e2a7..c57dac31 100644 --- a/backends/graphite.js +++ b/backends/graphite.js @@ -19,6 +19,7 @@ var debug; var flushInterval; var graphiteHost; var graphitePort; +var flush_counts; var graphiteStats = {}; @@ -66,7 +67,10 @@ var flush_stats = function graphite_flush(ts, metrics) { var valuePerSecond = value / (flushInterval / 1000); // calculate "per second" rate statString += 'stats.' + key + ' ' + valuePerSecond + ' ' + ts + "\n"; - statString += 'stats_counts.' + key + ' ' + value + ' ' + ts + "\n"; + if (flush_counts) { + statString += 'stats_counts.' + key + ' ' + value + ' ' + ts + "\n"; + } + numStats += 1; } @@ -156,6 +160,8 @@ exports.init = function graphite_init(startup_time, config, events) { flushInterval = config.flushInterval; + flush_counts = typeof(config.flush_counts) === "undefined" ? true : config.flush_counts; + events.on('flush', flush_stats); events.on('status', backend_status); diff --git a/exampleConfig.js b/exampleConfig.js index b29443c2..fae02ddc 100644 --- a/exampleConfig.js +++ b/exampleConfig.js @@ -30,6 +30,8 @@ Optional Variables: percentThreshold: for time information, calculate the Nth percentile(s) (can be a single value or list of floating-point values) [%, default: 90] + flush_counts: send stats_counts metrics [default: true] + keyFlush: log the most frequently sent keys [object, default: undefined] interval: how often to log frequent keys [ms, default: 0] percent: percentage of frequent keys to log [%, default: 100] From 4541e117022bdb546e98071b844bdcab3e8e9c23 Mon Sep 17 00:00:00 2001 From: Dan Rowe Date: Tue, 2 Jul 2013 14:33:26 -0400 Subject: [PATCH 02/17] Allow for setting the process wtitle, or opting to let the os do it like previous versions --- exampleConfig.js | 3 +++ lib/process_mgmt.js | 34 +++++++++++++++++++++++++++++ stats.js | 14 ++++-------- test/process_mgmt_tests.js | 44 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 10 deletions(-) create mode 100644 lib/process_mgmt.js create mode 100644 test/process_mgmt_tests.js diff --git a/exampleConfig.js b/exampleConfig.js index 1070aec1..affe8509 100644 --- a/exampleConfig.js +++ b/exampleConfig.js @@ -25,6 +25,9 @@ Optional Variables: mgmt_address: address to run the management TCP interface on [default: 0.0.0.0] mgmt_port: port to run the management TCP interface on [default: 8126] + title : Allows for overriding the process title. [default: statsd] + if set to false, will not override the process title and let the OS set it. + The length of the title has to be less than or equal to the binary name + cli arguments healthStatus: default health status to be returned and statsd process starts ['up' or 'down', default: 'up'] dumpMessages: log all incoming messages flushInterval: interval (in ms) to flush to Graphite diff --git a/lib/process_mgmt.js b/lib/process_mgmt.js new file mode 100644 index 00000000..ca6f7983 --- /dev/null +++ b/lib/process_mgmt.js @@ -0,0 +1,34 @@ +var util = require('util'); + +var conf; + +exports.init = function(config) { + conf = config; + exports.set_title(config); + + process.on('SIGTERM', function() { + if (conf.debug) { + util.log('Starting Final Flush'); + } + healthStatus = 'down'; + process.exit(); + }); + +} + +exports.set_title = function(config) { + if (config.title !== undefined) { + if (config.title) { + if (process.title.length >= config.title.length) { + process.title = config.title; + } else { + // check that conf is defined so we don't error in tests + if (conf !== undefined && conf.debug) { + util.log("config.title is to long, needs to be less than or equal to" + process.title.length); + } + } + } + } else { + process.title = 'statsd'; + } +} diff --git a/stats.js b/stats.js index b2e2cca0..17c8c8b5 100644 --- a/stats.js +++ b/stats.js @@ -9,6 +9,7 @@ var dgram = require('dgram') , logger = require('./lib/logger') , set = require('./lib/set') , pm = require('./lib/process_metrics') + , process_mgmt = require('./lib/process_mgmt') , mgmt = require('./lib/mgmt_console'); @@ -137,6 +138,9 @@ var l; config.configFile(process.argv[2], function (config, oldConfig) { conf = config; + + process_mgmt.init(config); + l = new logger.Logger(config.log || {}); // setup config for stats prefix @@ -410,16 +414,6 @@ config.configFile(process.argv[2], function (config, oldConfig) { } }); -process.title = 'statsd'; - -process.on('SIGTERM', function() { - if (conf.debug) { - util.log('Starting Final Flush'); - } - healthStatus = 'down'; - process.exit(); -}); - process.on('exit', function () { flushMetrics(); }); diff --git a/test/process_mgmt_tests.js b/test/process_mgmt_tests.js new file mode 100644 index 00000000..23781108 --- /dev/null +++ b/test/process_mgmt_tests.js @@ -0,0 +1,44 @@ +var process_mgmt = require('../lib/process_mgmt'); + +var config = {} +module.exports = { + + setUp: function(callback) { + config = {}; + callback(); + }, + + test_valid_title: function(test){ + test.expect(1); + process_title = process.title; + config.title = process_title.substring(1); + process_mgmt.set_title(config); + test.ok(process.title == config.title, "Can set a title that is less than or equal to the process title length"); + test.done(); + }, + + test_invalid_title: function(test){ + process_title = process.title; + test_title = process.title + "1"; + config.title = test_title; + process_mgmt.set_title(config); + test.ok(process.title == process_title, "Can't set a title that is longer than the process.title length"); + test.done(); + }, + + test_no_title: function(test){ + process_title = process.title; + config.title = false; + process_mgmt.set_title(config); + test.ok(process_title == process.title, "A config.title of false should not override the default node process.title"); + test.done(); + }, + + test_default_title: function(test){ + default_title = 'statsd'; + process_mgmt.set_title(config); + test.ok(process.title == default_title, "If no config.title option set, set the process.title to statsd"); + test.done(); + } + +}; From 23aab12cd20a28d7bd819f2279a9fbfe4c0aad0e Mon Sep 17 00:00:00 2001 From: Dan Rowe Date: Wed, 3 Jul 2013 17:25:53 -0400 Subject: [PATCH 03/17] exclude the title test from running on Macs running node less than 10 --- lib/process_mgmt.js | 7 ------ test/process_mgmt_tests.js | 45 ++++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/process_mgmt.js b/lib/process_mgmt.js index ca6f7983..26b634e0 100644 --- a/lib/process_mgmt.js +++ b/lib/process_mgmt.js @@ -19,14 +19,7 @@ exports.init = function(config) { exports.set_title = function(config) { if (config.title !== undefined) { if (config.title) { - if (process.title.length >= config.title.length) { process.title = config.title; - } else { - // check that conf is defined so we don't error in tests - if (conf !== undefined && conf.debug) { - util.log("config.title is to long, needs to be less than or equal to" + process.title.length); - } - } } } else { process.title = 'statsd'; diff --git a/test/process_mgmt_tests.js b/test/process_mgmt_tests.js index 23781108..6e7ab391 100644 --- a/test/process_mgmt_tests.js +++ b/test/process_mgmt_tests.js @@ -1,32 +1,34 @@ -var process_mgmt = require('../lib/process_mgmt'); +var process_mgmt = require('../lib/process_mgmt') + , os = require('os'); var config = {} + , can_set_title = true; + module.exports = { setUp: function(callback) { config = {}; + version_number = process.version.split(".")[1]; + platform = os.platform(); + can_set_title = (version_number >= 10 || platform != 'darwin'); callback(); }, - test_valid_title: function(test){ - test.expect(1); - process_title = process.title; - config.title = process_title.substring(1); - process_mgmt.set_title(config); - test.ok(process.title == config.title, "Can set a title that is less than or equal to the process title length"); - test.done(); - }, - - test_invalid_title: function(test){ - process_title = process.title; - test_title = process.title + "1"; - config.title = test_title; - process_mgmt.set_title(config); - test.ok(process.title == process_title, "Can't set a title that is longer than the process.title length"); + test_setting_title: function(test){ + if (can_set_title) { + test.expect(1); + process_title = process.title; + config.title = "test-statsd"; + process_mgmt.set_title(config); + test.ok(process.title == config.title, "Can set a title that is less than or equal to the process title length"); + } else { + console.log("Not running this test, due to this being a node version before v0.10 and a Darwin os"); + } test.done(); }, test_no_title: function(test){ + test.expect(1); process_title = process.title; config.title = false; process_mgmt.set_title(config); @@ -35,9 +37,14 @@ module.exports = { }, test_default_title: function(test){ - default_title = 'statsd'; - process_mgmt.set_title(config); - test.ok(process.title == default_title, "If no config.title option set, set the process.title to statsd"); + if (can_set_title) { + test.expect(1); + default_title = 'statsd'; + process_mgmt.set_title(config); + test.ok(process.title == default_title, "If no config.title option set, set the process.title to statsd"); + } else { + console.log("Not running this test, due to this being a node version before v0.10 and a Darwin os"); + } test.done(); } From dd1ad7b2383c2434e20715ee3e9703f2080994f5 Mon Sep 17 00:00:00 2001 From: Dan Rowe Date: Wed, 3 Jul 2013 17:28:06 -0400 Subject: [PATCH 04/17] note the fact that it won't work on node v0.8 on macs in the example config --- exampleConfig.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exampleConfig.js b/exampleConfig.js index affe8509..fb0d9b59 100644 --- a/exampleConfig.js +++ b/exampleConfig.js @@ -28,6 +28,8 @@ Optional Variables: title : Allows for overriding the process title. [default: statsd] if set to false, will not override the process title and let the OS set it. The length of the title has to be less than or equal to the binary name + cli arguments + NOTE: This does not work on Mac's with node versions prior to v0.10 + healthStatus: default health status to be returned and statsd process starts ['up' or 'down', default: 'up'] dumpMessages: log all incoming messages flushInterval: interval (in ms) to flush to Graphite From bc9527a9ee5c099214adf4d51a69860e78c0743e Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 7 Aug 2013 14:54:15 -0400 Subject: [PATCH 05/17] Add link to the Stackdriver backend --- docs/backend.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/backend.md b/docs/backend.md index 32839726..8a9a5ed4 100644 --- a/docs/backend.md +++ b/docs/backend.md @@ -42,6 +42,7 @@ queues and third-party services. - [monitis backend](https://github.com/jeremiahshirk/statsd-monitis-backend) - [opentsdb backend](https://github.com/emurphy/statsd-opentsdb-backend) - [socket.io-backend](https://github.com/Chatham/statsd-socket.io) +- [stackdriver backend](https://github.com/Stackdriver/stackdriver-statsd-backend) - [statsd-backend](https://github.com/dynmeth/statsd-backend) - [statsd http backend](https://github.com/bmhatfield/statsd-http-backend) - [statsd aggregation backend](https://github.com/wanelo/gossip_girl) From 3a5213d176218d7832c491dfdd89af80be2918c0 Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Thu, 8 Aug 2013 17:36:12 +0100 Subject: [PATCH 06/17] Correct obvious mistakes causing build to fail. --- examples/statsd.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/statsd.go b/examples/statsd.go index 243e8074..f419e0d2 100644 --- a/examples/statsd.go +++ b/examples/statsd.go @@ -154,10 +154,11 @@ func (client *StatsdClient) UpdateStats(stats []string, delta int, sampleRate fl func (client *StatsdClient) Send(data map[string]string, sampleRate float32) { sampledData := make(map[string]string) if sampleRate < 1 { - r := rand.New(rand.sampleRateNewSource(time.Now().Unix())) - if rNum := r.Float32(); rNum <= sampleRateate { + r := rand.New(rand.NewSource(time.Now().Unix())) + rNum := r.Float32(); + if rNum <= sampleRate { for stat,value := range data { - sampledUpdateString := fmt.forSprintf("%s|@%f", value, sampleRate) + sampledUpdateString := fmt.Sprintf("%s|@%f", value, sampleRate) sampledData[stat] = sampledUpdateString } } From fc63eec299807d871c29991c95e22a19884b32d8 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 9 Aug 2013 20:40:57 +0200 Subject: [PATCH 07/17] extract packet parsing into helper module --- lib/helpers.js | 31 +++++++++++++++++++++++++++++++ stats.js | 20 ++++++++------------ test/helpers_tests.js | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 lib/helpers.js create mode 100644 test/helpers_tests.js diff --git a/lib/helpers.js b/lib/helpers.js new file mode 100644 index 00000000..a27d0c6e --- /dev/null +++ b/lib/helpers.js @@ -0,0 +1,31 @@ +/** + * Public: test function to filter out malformed packets + * + * Parameters: + * + * fields - Array of packet data (e.g. [ '100', 'ms', '@0.1' ]) + * + * Returns true for a valid packet and false otherwise + */ +function is_valid_packet(fields) { + + // test for existing metrics type + if (fields[1] === undefined) { + return false; + } + // filter out invalid metrics values + else if (!fields[0].match(/^([\-\+\d\.]+$)/)) { + return false; + } + // filter out malformed sample rates + else if (fields[2] && !fields[2].match(/^@([\d\.]+$)/)) { + return false; + } + // looks like we're good + else { + return true; + } + +}; + +exports.is_valid_packet = is_valid_packet; diff --git a/stats.js b/stats.js index 17c8c8b5..628a3ce7 100644 --- a/stats.js +++ b/stats.js @@ -4,6 +4,7 @@ var dgram = require('dgram') , util = require('util') , net = require('net') , config = require('./lib/config') + , helpers = require('./lib/helpers') , fs = require('fs') , events = require('events') , logger = require('./lib/logger') @@ -43,6 +44,7 @@ function loadBackend(config, name) { } } + // global for conf var conf; @@ -197,22 +199,16 @@ config.configFile(process.argv[2], function (config, oldConfig) { for (var i = 0; i < bits.length; i++) { var sampleRate = 1; var fields = bits[i].split("|"); - if (fields[2]) { - if (fields[2].match(/^@([\d\.]+)/)) { - sampleRate = Number(fields[2].match(/^@([\d\.]+)/)[1]); - } else { - l.log('Bad line: ' + fields + ' in msg "' + metrics[midx] +'"; has invalid sample rate'); - counters[bad_lines_seen]++; - stats.messages.bad_lines_seen++; - continue; - } - } - if (fields[1] === undefined) { + if (!helpers.is_valid_packet(fields)) { l.log('Bad line: ' + fields + ' in msg "' + metrics[midx] +'"'); counters[bad_lines_seen]++; stats.messages.bad_lines_seen++; continue; } + if (fields[2]) { + sampleRate = Number(fields[2].match(/^@([\d\.]+)/)[1]); + } + var metric_type = fields[1].trim(); if (metric_type === "ms") { if (! timers[key]) { @@ -306,7 +302,7 @@ config.configFile(process.argv[2], function (config, oldConfig) { backendEvents.emit('status', function(err, name, stat, val) { if (err) { l.log("Failed to read stats for backend " + - name + ": " + err); + name + ": " + err); } else { stat_writer(name, stat, val); } diff --git a/test/helpers_tests.js b/test/helpers_tests.js new file mode 100644 index 00000000..4df74959 --- /dev/null +++ b/test/helpers_tests.js @@ -0,0 +1,35 @@ +var helpers = require('../lib/helpers'); + +module.exports = { + + no_metrics_field: function (test) { + var res = helpers.is_valid_packet(['foo', undefined]); + test.equals(res, false); + test.done(); + }, + + wrong_formated_metric_value: function (test) { + var res = helpers.is_valid_packet(['0,345345', 'ms']); + test.equals(res, false); + test.done(); + }, + + wrong_formated_sampling_value: function (test) { + var res = helpers.is_valid_packet(['345345', 'ms', '0,456456']); + test.equals(res, false); + test.done(); + }, + + correct_packet: function (test) { + var res = helpers.is_valid_packet(['345345', 'ms', '@1.0']); + test.equals(res, true); + test.done(); + }, + + correct_packet_with_small_sampling: function (test) { + var res = helpers.is_valid_packet(['100', 'ms', '@0.1']); + test.equals(res, true); + test.done(); + } + +}; From 53fd384d087a910cd47bc773df759421b13682e4 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 9 Aug 2013 22:08:28 +0200 Subject: [PATCH 08/17] add more tests for metric types --- lib/helpers.js | 9 ++++++++- test/helpers_tests.js | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/helpers.js b/lib/helpers.js index a27d0c6e..9e7ab956 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -14,7 +14,14 @@ function is_valid_packet(fields) { return false; } // filter out invalid metrics values - else if (!fields[0].match(/^([\-\+\d\.]+$)/)) { + else if (fields[1] == 'g') { + if (!fields[0].match(/^([\-\+\d\.]+$)/)) { + return false; + } else { + return true; + } + } + else if (!fields[0].match(/^([\d\.]+$)/)) { return false; } // filter out malformed sample rates diff --git a/test/helpers_tests.js b/test/helpers_tests.js index 4df74959..b2f2c524 100644 --- a/test/helpers_tests.js +++ b/test/helpers_tests.js @@ -20,6 +20,30 @@ module.exports = { test.done(); }, + counter_deltas_positive_are_not_valid: function (test) { + var res = helpers.is_valid_packet(['+10', 'c']); + test.equals(res, false); + test.done(); + }, + + counter_deltas_negative_are_not_valid: function (test) { + var res = helpers.is_valid_packet(['-10', 'c']); + test.equals(res, false); + test.done(); + }, + + gauges_delta_positive_are_valid: function (test) { + var res = helpers.is_valid_packet(['+10', 'g']); + test.equals(res, true); + test.done(); + }, + + gauges_delta_negative_are_valid: function (test) { + var res = helpers.is_valid_packet(['-10', 'g']); + test.equals(res, true); + test.done(); + }, + correct_packet: function (test) { var res = helpers.is_valid_packet(['345345', 'ms', '@1.0']); test.equals(res, true); From 272049a467d68ad5cad1d3f26d6aa17e6d704a80 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 14 Aug 2013 13:39:15 +0200 Subject: [PATCH 09/17] Update graphite.md Logical fix The sentence doesn't have a right meaning. --- docs/graphite.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/graphite.md b/docs/graphite.md index 568438f6..fa6aeb4b 100644 --- a/docs/graphite.md +++ b/docs/graphite.md @@ -89,7 +89,7 @@ This means: * For all other databases, average the values (mean) when rolling up data, and store a None if less than 30% of the datapoints were received -Pay close attention to xFilesFactor: if your flush interval is long enough so there are not enough samples to satisfy this minimum factor, your data would simply be lost in the first downsampling cycle. However, setting a very low factor would also produce a misleading result, since you would probably agree that if you only have a single 10-second mean value sample reported in a 10-minute timeframe, this single sample alone should not normally be downsampled into a 10-minute mean value. For counts, however, every count should count ;-), hence the zero factor. +Pay close attention to xFilesFactor: if your flush interval is not long enough so there are not enough samples to satisfy this minimum factor, your data would simply be lost in the first downsampling cycle. However, setting a very low factor would also produce a misleading result, since you would probably agree that if you only have a single 10-second mean value sample reported in a 10-minute timeframe, this single sample alone should not normally be downsampled into a 10-minute mean value. For counts, however, every count should count ;-), hence the zero factor. **Notes:** From 3ab47cf37543bc4cb5641eb4347a1e2ef977b544 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 13:53:50 +0200 Subject: [PATCH 10/17] lintian complained about spelling --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 1c49d2ae..08038fa9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ statsd (0.0.6-1) unstable; urgency=low * Update packaging for 0.0.6 - * Bump nodejs dependancy to 0.6 per pcakage.json + * Bump nodejs dependency to 0.6 per package.json -- Kiall Mac Innes Thu, 27 Jun 2013 19:17:00 +0100 From de5b5e8f0e834d77f9b791fda787714b02d65864 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 13:59:42 +0200 Subject: [PATCH 11/17] lintian: fix init.d-script-missing-dependency-on-remote_fs --- debian/statsd.init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/statsd.init b/debian/statsd.init index d9348541..9f9c9a1d 100644 --- a/debian/statsd.init +++ b/debian/statsd.init @@ -1,8 +1,8 @@ #! /bin/sh ### BEGIN INIT INFO # Provides: statsd -# Required-Start: $network $local_fs -# Required-Stop: +# Required-Start: $remote_fs $network $local_fs +# Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO From c0c7be895189c5d79745048e2d1614ae170dc12f Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:07:41 +0200 Subject: [PATCH 12/17] depending on adduser when using it in postinst --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index a1731e39..0fed5e25 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 8.0.0) Package: statsd Architecture: all -Depends: ${misc:Depends}, nodejs (>= 0.6) +Depends: ${misc:Depends}, nodejs (>= 0.6), adduser Description: Stats aggregation daemon A network daemon for aggregating statistics (counters and timers), rolling them up, then sending them to graphite. From e5a32593b79293a224adfbb438497134c98e947f Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:33:45 +0200 Subject: [PATCH 13/17] create /var/run/statsd on initscript runtime creating the /var/run/statsd directory during the debian package installation violates the lintian rule 'dir-or-file-in-var-run'. /var/run might be a tmpfs and thus volatile. --- debian/dirs | 1 - debian/statsd.init | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/dirs b/debian/dirs index dc8b5569..4d2c5fca 100644 --- a/debian/dirs +++ b/debian/dirs @@ -1,2 +1 @@ var/log/statsd -var/run/statsd diff --git a/debian/statsd.init b/debian/statsd.init index 9f9c9a1d..5c7205fb 100644 --- a/debian/statsd.init +++ b/debian/statsd.init @@ -41,6 +41,12 @@ CHDIR="/usr/share/statsd" # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +# Create PIDDIR on runtime +if [ ! -d /var/run/$NAME ] then + mkdir /var/run/$NAME + chown $USER /var/run/$NAME +fi + # # Function that starts the daemon/service # From 6b319dfa79124908cd101606ebebafc60c7e8549 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:35:31 +0200 Subject: [PATCH 14/17] install the initscript via update-rc.d debian/postinst tries to remove it, so we need to install it first fixing lintian rule 'script-in-etc-init.d-not-registered-via-update-rc.d' --- debian/postinst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debian/postinst b/debian/postinst index 797e7755..6016c745 100755 --- a/debian/postinst +++ b/debian/postinst @@ -3,6 +3,11 @@ set -e if [ "$1" = configure ]; then + # Automatically added by dh_installinit + if [ -x "/etc/init.d/statsd" ]; then + update-rc.d statsd defaults >/dev/null + invoke-rc.d statsd start || exit $? + fi if ! getent passwd _statsd > /dev/null; then adduser --system --quiet --home /nonexistent --no-create-home \ From 64388f4c8d9a48fc032bfb7bd74427bbfb9403b3 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:44:19 +0200 Subject: [PATCH 15/17] bash syntax fix in init script --- debian/statsd.init | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/statsd.init b/debian/statsd.init index 5c7205fb..09007f58 100644 --- a/debian/statsd.init +++ b/debian/statsd.init @@ -42,7 +42,8 @@ CHDIR="/usr/share/statsd" . /lib/lsb/init-functions # Create PIDDIR on runtime -if [ ! -d /var/run/$NAME ] then +if [ ! -d /var/run/$NAME ]; +then mkdir /var/run/$NAME chown $USER /var/run/$NAME fi From a7e955bf1bbfbe6b762bc7caacfe4c267277a020 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:45:27 +0200 Subject: [PATCH 16/17] remove ${misc:Depends}, it's unnecessary - this only got added because of a lintian error/warning which isn't thrown anymore (https://github.com/etsy/statsd/commit/4584ba61d97dd1f53e075bfb583e4ec5d8574ffd) --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 0fed5e25..53dff2d2 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 8.0.0) Package: statsd Architecture: all -Depends: ${misc:Depends}, nodejs (>= 0.6), adduser +Depends: nodejs (>= 0.6), adduser Description: Stats aggregation daemon A network daemon for aggregating statistics (counters and timers), rolling them up, then sending them to graphite. From 49ac7ca59a4a965c2dc3a85a09e69c2fd510e1c0 Mon Sep 17 00:00:00 2001 From: Frederic Jaeckel Date: Tue, 20 Aug 2013 14:50:19 +0200 Subject: [PATCH 17/17] new debian version aligned with upstream 0.6.0-1 --- debian/changelog | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debian/changelog b/debian/changelog index 08038fa9..a1340bd1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +statsd (0.6.0-1) unstable; urgency=low + + * Non-maintainer upload. + * Fix lintian error messages regarding init script removal but not + installing them, using adduser but not defining the dependencies, + using /var/run/ in debian/dirs even though it can be a tmpfs, init script + not depending on $remote_fs, spelling mistakes + * removing depedency on ${misc:Depends} as this got only added as lintian + used to complain about not having it, it's not anymore + * Align version number to git tag versions + + -- Frederic Jaeckel Tue, 20 Aug 2013 14:03:10 +0200 + statsd (0.0.6-1) unstable; urgency=low * Update packaging for 0.0.6