Преглед изворни кода

profiling: set `SampleType` name

Anton Petruhin пре 2 година
родитељ
комит
44f6e37e99
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      profiling/profiling.go

+ 2 - 2
profiling/profiling.go

@@ -54,7 +54,6 @@ func Init(hostId, hostName string) chan<- containers.ProcessInfo {
 	constLabels = labels.Labels{
 	constLabels = labels.Labels{
 		{Name: "host.name", Value: hostName},
 		{Name: "host.name", Value: hostName},
 		{Name: "host.id", Value: hostId},
 		{Name: "host.id", Value: hostId},
-		{Name: "profile.source", Value: "ebpf"},
 	}
 	}
 
 
 	reg := prometheus.NewRegistry()
 	reg := prometheus.NewRegistry()
@@ -167,6 +166,7 @@ func upload(b *pprof.ProfileBuilder) error {
 	}
 	}
 	u.RawQuery = q.Encode()
 	u.RawQuery = q.Encode()
 
 
+	b.Profile.SampleType[0].Type = "ebpf:cpu:nanoseconds"
 	b.Profile.DurationNanos = CollectInterval.Nanoseconds()
 	b.Profile.DurationNanos = CollectInterval.Nanoseconds()
 	body := bytes.NewBuffer(nil)
 	body := bytes.NewBuffer(nil)
 	_, err := b.Write(body)
 	_, err := b.Write(body)
@@ -174,7 +174,7 @@ func upload(b *pprof.ProfileBuilder) error {
 		return err
 		return err
 	}
 	}
 
 
-	req, err := http.NewRequest("POST", u.String(), body)
+	req, err := http.NewRequest(http.MethodPost, u.String(), body)
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}