First, we look at the system installed types.db (works on centos
package, should probably be generalized).
Later, we split up the metric name into is parts according to the
collectd data spec. The instance are split out and handled somewhat
better.
This fixes an issue where type instances will break the lookup in
the types.db file.
This also fixes an issue where metrics will be poorly named when
they appear in graphite.
CAVEAT: This makes changes that are not compatible with existing
proxy users. The graphs will be given different names.
tl:dr This breaks backwards compatability
// Pluigin names can contain an "instance" which is set apart by a dash
varplugin=name_parts[1].split("-")
rebuild=rebuild.concat(plugin[0])
if(plugin.length>1){
varplugin_instance=plugin.slice(1).join("-")
rebuild=rebuild.concat(plugin_instance)
}
plugin=plugin[0]
// Type names can also contain an "instance"
vartype=name_parts[2].split("-")
if(type[0] != plugin){
// If type and plugin are equal, delete one to clean up a bit
rebuild=rebuild.concat(type[0])
}
if(type.length>1){
vartype_instance=type.slice(1).join("-")
rebuild=rebuild.concat(type_instance)
}
type=type[0]
// Put the name back together
name=rebuild.join(".")
if(values.length>2){
varmetric=name.split(".")[3];
name=name+"_"+typesObj[metric][v-1];
varmetric=name_parts[2];
// If the metric contains a '-' (after removing the instance name)
// then we want to remove it before looking up in the types.db
index=metric.search(/-/)
if(index>-1){
metric=/^([\w]+)-(.*)$/.exec(metric);
}else{
// Kinda a hack
metric=["",metric]
}
name=name+"."+typesObj[metric[1]][v-1];
}
message=[name,values[v],time].join(" ");
graphite_connection.write(message+"\n");
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more
Fix collectd metric processing #3
Fix collectd metric processing #3
Changes from 1 commit
ebca67d6ad01f6e64ccd1File filter...
Jump to…
Improve on @donjohnson's ideas