-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Adding conjoined-field-names for graphite templates #5562
Adding conjoined-field-names for graphite templates #5562
Conversation
@chrusty This was discussed awhile back. One issue w/ Before this can be merged, we need to figure out how to handle these cases:
Could you add some test cases for this combination? |
@@ -237,6 +237,9 @@ func (t *template) Apply(line string) (string, map[string]string, string, error) | |||
return "", nil, "", fmt.Errorf("'field' can only be used once in each template: %q", line) | |||
} | |||
field = fields[i] | |||
} else if tag == "field*" { | |||
field = strings.Join(fields[i:], "_") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use t.separator
instead of hard-coded _
.
@jwilder OK, fair-enough. I've made the changes you suggested (after hitting a conflict with some concurrent changes in master). Let me know what you think, and I'll squash it down to one commit. |
wildcard_field_specified = true | ||
} | ||
} | ||
if wildcard_field_specified && wildcard_measurement_specified { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go style is to use mixedCaps
instead of underscores: https://golang.org/doc/effective_go.html#mixed-caps
Can you rename to something like hasFieldWildcard
and hasMeasurementWildcard
?
@chrusty Small styling issue and can you update the changelog and credit yourself for this PR? After that, looks good. |
@chrusty Also, can you sign the CLA? https://influxdata.com/community/cla/ |
…ames-for-graphite-templates
@jwilder OK, that's all done. Thanks for your patience! |
@chrusty Changes look good. Needs a rebase again though. |
…ames-for-graphite-templates
@jwilder OK, conflicts are gone |
👍 Thanks @chrusty! |
…ite-templates Adding conjoined-field-names for graphite templates
I've been working on moving several of my clients away from using Graphite recently, switching to InfluxDB and Telegraf.
One of these clients has 200+ microservices all sending metrics through StatsD to Graphite, so I'm looking for a way to drop Telegraf in (running the statsd-input) as a replacement, using templates to massage the metrics into InfluxDB with tags (rather than re-build and re-deploy all of these things to support tagged metrics).
Consider this example:
Input::
com.company.service.helloworld.handler.hellorequest.error
Template:
com.company.service.* measurement.measurement.measurement.measurement.field*
The result would be:
Measurement:
com_company_service_helloworld
Field:
handler_hellorequest_error
I realise there is also some work required for Telegraf to support this in conjunction with "timing" metrics.
Please let me know if you think this is crazy, or worth pursuing. Also, thanks for all the work on InfluxDB and Telegraf - these are really great tools!