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

Add public function to graphite parser to apply template #4348

Closed
wants to merge 1 commit into from

Conversation

sparrc
Copy link
Contributor

@sparrc sparrc commented Oct 6, 2015

This is to support the Telegraf statsd plugin, where I want to provide templating for statsd/graphite-style buckets -> influxdb info.

For Telegraf I don't want the full point parsing (Parser.Parse), I only want to parse the measurement name and tags.

@@ -50,7 +50,9 @@ func NewParserWithOptions(options Options) (*Parser, error) {
filter := ""
// Format is [filter] <template> [tag1=value1,tag2=value2]
parts := strings.Fields(pattern)
if len(parts) >= 2 {
if len(parts) < 1 {
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this a bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, it panic'ed if the user supplied an empty string template, which I found out completely on accident

@otoolep
Copy link
Contributor

otoolep commented Oct 6, 2015

+1, assuming the case I asked about is handled.

@sparrc
Copy link
Contributor Author

sparrc commented Oct 6, 2015

Good question, I'll add a test to verify that it doesn't do anything to the measurement name if it doesn't match.

@sparrc
Copy link
Contributor Author

sparrc commented Oct 7, 2015

closed by 883d32c

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.

None yet

3 participants