File tree 5 files changed +17
-17
lines changed
receiver/collectdreceiver
5 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -17,25 +17,25 @@ import (
17
17
)
18
18
19
19
type collectDRecord struct {
20
- Dsnames []* string `json:"dsnames"`
21
- Dstypes []* string `json:"dstypes"`
20
+ Time * float64 `json:"time"`
22
21
Host * string `json:"host"`
23
22
Interval * float64 `json:"interval"`
24
23
Plugin * string `json:"plugin"`
25
24
PluginInstance * string `json:"plugin_instance"`
26
- Time * float64 `json:"time"`
27
25
TypeS * string `json:"type"`
28
26
TypeInstance * string `json:"type_instance"`
29
- Values []* json.Number `json:"values"`
30
27
Message * string `json:"message"`
31
28
Meta map [string ]any `json:"meta"`
32
29
Severity * string `json:"severity"`
30
+ Dstypes []* string `json:"dstypes"`
31
+ Dsnames []* string `json:"dsnames"`
32
+ Values []* json.Number `json:"values"`
33
33
}
34
34
35
35
type createMetricInfo struct {
36
- Name string
37
36
DsType * string
38
37
Val * json.Number
38
+ Name string
39
39
}
40
40
41
41
func (cdr * collectDRecord ) isEvent () bool {
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ import (
13
13
14
14
// Config defines configuration for Collectd receiver.
15
15
type Config struct {
16
- confighttp. ServerConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
17
- Timeout time. Duration `mapstructure:"timeout "`
18
- Encoding string `mapstructure:"encoding "`
19
- AttributesPrefix string `mapstructure:"attributes_prefix "`
16
+ Encoding string `mapstructure:"encoding"`
17
+ AttributesPrefix string `mapstructure:"attributes_prefix "`
18
+ confighttp. ServerConfig `mapstructure:",squash "`
19
+ Timeout time. Duration `mapstructure:"timeout "`
20
20
}
21
21
22
22
func (c * Config ) Validate () error {
Original file line number Diff line number Diff line change @@ -22,9 +22,9 @@ func TestLoadConfig(t *testing.T) {
22
22
t .Parallel ()
23
23
24
24
tests := []struct {
25
- id component.ID
26
25
expected component.Config
27
26
wantErr error
27
+ id component.ID
28
28
}{
29
29
{
30
30
id : component .NewIDWithName (metadata .Type , "" ),
Original file line number Diff line number Diff line change @@ -26,13 +26,13 @@ var _ receiver.Metrics = (*collectdReceiver)(nil)
26
26
27
27
// collectdReceiver implements the receiver.Metrics for CollectD protocol.
28
28
type collectdReceiver struct {
29
+ nextConsumer consumer.Metrics
29
30
logger * zap.Logger
30
31
server * http.Server
31
- defaultAttrsPrefix string
32
- nextConsumer consumer.Metrics
33
32
obsrecv * receiverhelper.ObsReport
34
- createSettings receiver.Settings
35
33
config * Config
34
+ createSettings receiver.Settings
35
+ defaultAttrsPrefix string
36
36
}
37
37
38
38
// newCollectdReceiver creates the CollectD receiver with the given parameters.
Original file line number Diff line number Diff line change @@ -25,22 +25,22 @@ import (
25
25
)
26
26
27
27
type wantedBody struct {
28
+ Attributes map [string ]string
28
29
Name string
29
30
Time float64
30
- Attributes map [string ]string
31
31
Value float64
32
32
}
33
33
34
34
func TestNewReceiver (t * testing.T ) {
35
35
type args struct {
36
+ nextConsumer consumer.Metrics
36
37
config * Config
37
38
attrsPrefix string
38
- nextConsumer consumer.Metrics
39
39
}
40
40
tests := []struct {
41
- name string
42
41
args args
43
42
wantErr error
43
+ name string
44
44
}{
45
45
{
46
46
name : "happy path" ,
@@ -71,8 +71,8 @@ func TestCollectDServer(t *testing.T) {
71
71
HTTPMethod string
72
72
QueryParams string
73
73
RequestBody string
74
- ResponseCode int
75
74
WantData []pmetric.Metrics
75
+ ResponseCode int
76
76
}
77
77
78
78
config := & Config {
You can’t perform that action at this time.
0 commit comments