mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
lib/protoparser/datadogv2: take into account source_type_name field, since it contains useful value such as kubernetes, docker, system, etc.
This commit is contained in:
parent
b4ba8d0d76
commit
7575f5c501
@ -58,6 +58,12 @@ func insertRows(at *auth.Token, series []datadogv2.Series, extraLabels []prompbm
|
||||
Value: rs.Name,
|
||||
})
|
||||
}
|
||||
if ss.SourceTypeName != "" {
|
||||
labels = append(labels, prompbmarshal.Label{
|
||||
Name: "source_type_name",
|
||||
Value: ss.SourceTypeName,
|
||||
})
|
||||
}
|
||||
for _, tag := range ss.Tags {
|
||||
name, value := datadogutils.SplitTag(tag)
|
||||
if name == "host" {
|
||||
|
@ -59,6 +59,9 @@ func insertRows(series []datadogv2.Series, extraLabels []prompbmarshal.Label) er
|
||||
}
|
||||
ctx.AddLabel(name, value)
|
||||
}
|
||||
if ss.SourceTypeName != "" {
|
||||
ctx.AddLabel("source_type_name", ss.SourceTypeName)
|
||||
}
|
||||
for j := range extraLabels {
|
||||
label := &extraLabels[j]
|
||||
ctx.AddLabel(label.Name, label.Value)
|
||||
|
@ -76,11 +76,10 @@ type Series struct {
|
||||
Metric string `json:"metric"`
|
||||
|
||||
// Points points for the given metric
|
||||
Points []Point `json:"points"`
|
||||
Resources []Resource `json:"resources"`
|
||||
Points []Point `json:"points"`
|
||||
|
||||
// Do not decode SourceTypeName, since it isn't used by VictoriaMetrics
|
||||
// SourceTypeName string `json:"source_type_name"`
|
||||
Resources []Resource `json:"resources"`
|
||||
SourceTypeName string `json:"source_type_name"`
|
||||
|
||||
Tags []string
|
||||
|
||||
@ -106,6 +105,8 @@ func (s *Series) reset() {
|
||||
}
|
||||
s.Resources = resources[:0]
|
||||
|
||||
s.SourceTypeName = ""
|
||||
|
||||
tags := s.Tags
|
||||
for i := range tags {
|
||||
tags[i] = ""
|
||||
|
@ -50,6 +50,7 @@ func TestRequestUnmarshalJSONSuccess(t *testing.T) {
|
||||
"type": "host"
|
||||
}
|
||||
],
|
||||
"source_type_name": "kubernetes",
|
||||
"tags": ["environment:test"]
|
||||
}
|
||||
]
|
||||
@ -69,6 +70,7 @@ func TestRequestUnmarshalJSONSuccess(t *testing.T) {
|
||||
Type: "host",
|
||||
},
|
||||
},
|
||||
SourceTypeName: "kubernetes",
|
||||
Tags: []string{
|
||||
"environment:test",
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user