Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Mikaelian committed Feb 3, 2017
1 parent f0d82ad commit 0a76784
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/librato.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ url_parse = require('url').parse,
var tunnelAgent = null;

var debug, logAll;
var api, email, token, period, hostName, sourceRegex, includeMetrics, excludeMetrics;
var api, email, token, period, sourceName, hostName, sourceRegex, includeMetrics, excludeMetrics;

// How long to wait before retrying a failed post, in seconds
var retryDelaySecs = 5;
Expand Down Expand Up @@ -304,6 +304,11 @@ var flush_stats = function librato_flush(ts, metrics)
measure.tags.source = measure.source;
} else {
measure.name = sanitize_name(measureName);

// Use the global config sourceName as a source tag, if it exists.
if (sourceName !== null) {
measure.tags.source = sourceName;
}
}

if (brokenMetrics[measure.name]) {
Expand Down Expand Up @@ -540,7 +545,8 @@ exports.init = function librato_init(startup_time, config, events, logger)
api = config.librato.api;
email = config.librato.email;
token = config.librato.token;
hostName = config.librato.source;
sourceName = config.librato.source;
hostName = config.librato.host;
sourceRegex = config.librato.sourceRegex;
snapTime = config.librato.snapTime;
includeMetrics = config.librato.includeMetrics;
Expand Down Expand Up @@ -629,8 +635,8 @@ exports.init = function librato_init(startup_time, config, events, logger)
writeToLegacy = config.librato.writeToLegacy;
}

// Set host as a global tag
tags['host'] = hostName;
// Set host as a global tag. Defaults to os.hostname()
tags.host = hostName;
}

if (!email || !token) {
Expand Down

0 comments on commit 0a76784

Please sign in to comment.