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,
|
Value: rs.Name,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if ss.SourceTypeName != "" {
|
||||||
|
labels = append(labels, prompbmarshal.Label{
|
||||||
|
Name: "source_type_name",
|
||||||
|
Value: ss.SourceTypeName,
|
||||||
|
})
|
||||||
|
}
|
||||||
for _, tag := range ss.Tags {
|
for _, tag := range ss.Tags {
|
||||||
name, value := datadogutils.SplitTag(tag)
|
name, value := datadogutils.SplitTag(tag)
|
||||||
if name == "host" {
|
if name == "host" {
|
||||||
|
@ -59,6 +59,9 @@ func insertRows(series []datadogv2.Series, extraLabels []prompbmarshal.Label) er
|
|||||||
}
|
}
|
||||||
ctx.AddLabel(name, value)
|
ctx.AddLabel(name, value)
|
||||||
}
|
}
|
||||||
|
if ss.SourceTypeName != "" {
|
||||||
|
ctx.AddLabel("source_type_name", ss.SourceTypeName)
|
||||||
|
}
|
||||||
for j := range extraLabels {
|
for j := range extraLabels {
|
||||||
label := &extraLabels[j]
|
label := &extraLabels[j]
|
||||||
ctx.AddLabel(label.Name, label.Value)
|
ctx.AddLabel(label.Name, label.Value)
|
||||||
|
@ -76,11 +76,10 @@ type Series struct {
|
|||||||
Metric string `json:"metric"`
|
Metric string `json:"metric"`
|
||||||
|
|
||||||
// Points points for the given metric
|
// Points points for the given metric
|
||||||
Points []Point `json:"points"`
|
Points []Point `json:"points"`
|
||||||
Resources []Resource `json:"resources"`
|
|
||||||
|
|
||||||
// Do not decode SourceTypeName, since it isn't used by VictoriaMetrics
|
Resources []Resource `json:"resources"`
|
||||||
// SourceTypeName string `json:"source_type_name"`
|
SourceTypeName string `json:"source_type_name"`
|
||||||
|
|
||||||
Tags []string
|
Tags []string
|
||||||
|
|
||||||
@ -106,6 +105,8 @@ func (s *Series) reset() {
|
|||||||
}
|
}
|
||||||
s.Resources = resources[:0]
|
s.Resources = resources[:0]
|
||||||
|
|
||||||
|
s.SourceTypeName = ""
|
||||||
|
|
||||||
tags := s.Tags
|
tags := s.Tags
|
||||||
for i := range tags {
|
for i := range tags {
|
||||||
tags[i] = ""
|
tags[i] = ""
|
||||||
|
@ -50,6 +50,7 @@ func TestRequestUnmarshalJSONSuccess(t *testing.T) {
|
|||||||
"type": "host"
|
"type": "host"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"source_type_name": "kubernetes",
|
||||||
"tags": ["environment:test"]
|
"tags": ["environment:test"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -69,6 +70,7 @@ func TestRequestUnmarshalJSONSuccess(t *testing.T) {
|
|||||||
Type: "host",
|
Type: "host",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
SourceTypeName: "kubernetes",
|
||||||
Tags: []string{
|
Tags: []string{
|
||||||
"environment:test",
|
"environment:test",
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user