Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the Librato output-plugin #722

Closed
wants to merge 1 commit into from
Closed

Fixing the Librato output-plugin #722

wants to merge 1 commit into from

Conversation

chrusty
Copy link
Contributor

@chrusty chrusty commented Feb 19, 2016

The Librato plugin simply didn't work, was never going to work in its current state.

I've done enough here to get it up and running, and also make it work with tagged metrics (by joining them with dots, as seems to be the way Librato would expect).

@chrusty
Copy link
Contributor Author

chrusty commented Feb 19, 2016

@jipperinbham Did you ever manage to get this to work? I've used this branch to successfully send metrics to Librato (one of my clients uses Librato).

@sparrc
Copy link
Contributor

sparrc commented Feb 19, 2016

you need to update the unit tests


### Build metric names from tag-values
### Uses the measurement, tag-values and field-names to derive the Librato metric name.
# name_from_tags = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why supply this as an option? why not always build the name from tags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mainly didn't want to scare people with huge metric names in Librato!

@chrusty
Copy link
Contributor Author

chrusty commented Feb 22, 2016

@sparrc OK I got the tests working (had to downgrade to GO 1.4.3 to get around the "internal package" thing.

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

In that case there might be something wrong with your GOPATH, you should be allowed to import the internal package within influxdata/telegraf.

if you paste the output of go env I could help.

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

or it might also be that your source code is in $GOPATH/src/github.com/influxdb/telegraf rather than $GOPATH/src/github.com/influxdata/telegraf

tagValues = append(tagValues, tagValue)
}
}
gaugeName = strings.Replace(fmt.Sprintf("%v.%v.%v", m.Name(), strings.Join(tagValues, "."), fieldName), "/", "-", -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it could be non-deterministic for the ordering of the tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could always sort them.

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

I'm not super familiar with librato, so correct me if I'm wrong, but I think that the measurement names are the same as on graphite, correct? (ie, dot buckets like cpu.usage.idle.

For this, I think you should use the graphite serializer: https://github.com/influxdata/telegraf/blob/master/plugins/serializers/graphite/graphite.go to get the graphite bucket name.

With your approach, there is an issue where you will get overwritten metrics when not using tags within the bucket. For example, these two separate influx line-protocol metrics:

1. cpu,cpu=cpu0 usage_idle=99 <timestamp>
2. cpu,cpu=cpu1 usage_idle=99 <timestamp>

would both be translated into the same graphite dot-bucket:

cpu.usage.idle  99  <timestamp>

but if you include the tags, they will be separated:

cpu.cpu0.usage.idle  99  <timestamp>
cpu.cpu1.usage.idle  99  <timestamp>

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

PS: feel free to make a new public function on the graphite serializer just for getting the bucket name(s)

@chrusty
Copy link
Contributor Author

chrusty commented Feb 22, 2016

Actually yes, that's why I added the option to "build names from tags" because in its original state, this plugin would have behaved exactly as you suggest. I'll check out the graphite-serialiser and try to use that.

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

even if the metric names get large, I'd rather not allow people to be sending metrics that get overwritten (people will undoubtedly use this option and then not understand why their metrics are off)

Soon the graphite serializer should be able to support templates that allow for users to specify which tags they want in their output.

@chrusty
Copy link
Contributor Author

chrusty commented Feb 22, 2016

I've removed that option completely, and switched to the graphite serializer.

@sparrc
Copy link
Contributor

sparrc commented Feb 22, 2016

Thanks, can you remove the code duplication in serializers/graphite? Serialize should call SerializeBucketName.

Also please add unit tests for the new function, SerializeBucketName

@chrusty
Copy link
Contributor Author

chrusty commented Feb 25, 2016

@sparrc this seems to work now

@jipperinbham
Copy link
Contributor

@chrusty the initial implementation worked with the account I had created to test with but many things have changed in telegraf since (for the better) and it's also possible the librato API changed.

thanks for getting this fixed up

@chrusty
Copy link
Contributor Author

chrusty commented Feb 25, 2016

@jipperinbham Hey man, no problem

@sparrc
Copy link
Contributor

sparrc commented Feb 26, 2016

@chrusty Thanks for this fix.

I'm having problems rebasing this though, can you squash your commits and rebase with master?

@chrusty
Copy link
Contributor Author

chrusty commented Feb 26, 2016

@sparrc OK, I think it should work now. That WAS a whole lot of commits.

@sparrc sparrc closed this in baa38d6 Feb 29, 2016
@sparrc
Copy link
Contributor

sparrc commented Feb 29, 2016

thanks @chrusty

@chrusty
Copy link
Contributor Author

chrusty commented Mar 3, 2016

@sparrc hey are you on any chats (Slack, IRC etc)? I've got a couple of other PRs in the pipeline

@sparrc
Copy link
Contributor

sparrc commented Mar 3, 2016

@chrusty Yes, you can find me in the Gophers slack room under username "cameronsparr"

geodimm pushed a commit to miketonks/telegraf that referenced this pull request Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants