2021-09-28 21:47:45 +02:00
|
|
|
package datadog
|
|
|
|
|
|
|
|
import (
|
2022-07-07 00:30:56 +02:00
|
|
|
"strings"
|
2021-09-28 21:47:45 +02:00
|
|
|
|
2023-11-28 14:52:29 +01:00
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/prompbmarshal"
|
2021-09-28 21:47:45 +02:00
|
|
|
)
|
|
|
|
|
2022-07-07 00:30:56 +02:00
|
|
|
// 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:]
|
|
|
|
}
|
|
|
|
|
2023-11-28 14:52:29 +01:00
|
|
|
// Request represents DataDog submit metrics request
|
2021-09-28 21:47:45 +02:00
|
|
|
//
|
|
|
|
// See https://docs.datadoghq.com/api/latest/metrics/#submit-metrics
|
2023-11-28 14:52:29 +01:00
|
|
|
type Request interface {
|
|
|
|
Extract(func(prompbmarshal.TimeSeries) error, func(string) string) error
|
|
|
|
Unmarshal([]byte) error
|
2021-09-28 21:47:45 +02:00
|
|
|
}
|