Sumo Logic output plugin: carbon2 default to include field in metric#8132
Conversation
…-to-carbon2-format-including-field-in-metric-pr
| } | ||
|
|
||
| func (s *Serializer) SetMetricsFormat(f format) { | ||
| s.metricsFormatLock.Lock() |
There was a problem hiding this comment.
In general yes because we don't know how it will be called.
Perhaps calling SetMetricsFormat and IsMetricsFormatUnset from different goroutines will never happen but this is just to be sure.
It's not a hot path so my assumption is that it's ok.
Unless there's a specific concern here I'd leave it this way.
EDIT
Actually, what I'm most concerned is the getMetricsFormat which is called in createObject, which in turn is called in Serialize and SerializeBatch and that I'd like to protect with a lock.
There was a problem hiding this comment.
Unless you've specifically seen race conditions, this should be unnecessary. Plugins have their own dedicated goroutines and the interface functions are never called in parallel by Telegraf. We try to avoid this type of defensive programming, as it tends to be confusing and sets a bad example for other plugins.
There was a problem hiding this comment.
Got it. Removed.
This PR will make Sumo Logic output plugin fallback to include field in metric name when using Carbon2 metrics format without a specified
data_formatfieldRequired for all PRs: