mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-24 19:30:06 +01:00
543f218fe9
Co-authored-by: Andrew Chubatiuk <andrew.chubatiuk@motional.com> Co-authored-by: Nikolay <https://github.com/f41gh7> Co-authored-by: Roman Khavronenko <roman@victoriametrics.com>
28 lines
660 B
Go
28 lines
660 B
Go
package datadog
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
|
|
)
|
|
|
|
// SplitTag splits DataDog tag into tag name and value.
|
|
//
|
|
// See https://docs.datadoghq.com/getting_started/tagging/#define-tags
|
|
func SplitTag(tag string) (string, string) {
|
|
n := strings.IndexByte(tag, ':')
|
|
if n < 0 {
|
|
// No tag value.
|
|
return tag, "no_label_value"
|
|
}
|
|
return tag[:n], tag[n+1:]
|
|
}
|
|
|
|
// Request represents DataDog submit metrics request
|
|
//
|
|
// See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics
|
|
type Request interface {
|
|
Extract(func(prompbmarshal.TimeSeries) error, func(string) string) error
|
|
Unmarshal([]byte) error
|
|
}
|