Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdurham committed Dec 13, 2023
1 parent d81d463 commit 29a4b7c
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions component/prometheus/test/metrics/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"sync"
"time"

"github.com/grafana/agent/pkg/flow/logging/level"

"github.com/gorilla/mux"

"github.com/grafana/agent/component"
Expand Down Expand Up @@ -51,7 +53,7 @@ func (c *Component) discovery(w httpgo.ResponseWriter, r *httpgo.Request) {
w.Header().Set("Content-Type", "application/json")
instances := make([]target, len(c.instances))
for x := range c.instances {
instances[x] = createTarget(c.handler.HTTPListenAddr, c.path+fmt.Sprintf("instance/%d/metrics", x))
instances[x] = createTarget(c.handler.HTTPListenAddr, fmt.Sprintf("%sinstance/%d/metrics", c.path, x))
}
marshalledBytes, _ := json.Marshal(instances)
_, _ = w.Write(marshalledBytes)
Expand All @@ -61,6 +63,7 @@ func (c *Component) serveMetrics(w httpgo.ResponseWriter, r *httpgo.Request) {
vars := mux.Vars(r)
id, err := strconv.Atoi(vars["id"])
if err != nil {
level.Error(c.o.Logger).Log("msg", "id not found", "id", vars["id"], "err", err)
w.WriteHeader(httpgo.StatusNotFound)
return
}
Expand Down Expand Up @@ -117,18 +120,6 @@ func (c *Component) Update(args component.Arguments) error {
return nil
}

func (c *Component) generateDiscovery() []byte {
c.mut.Lock()
defer c.mut.Unlock()

instances := make([]target, len(c.instances))
for x := range c.instances {
instances[x] = createTarget(c.handler.HTTPListenAddr, c.path+fmt.Sprintf("instance/%d/metrics", x))
}
marshalledBytes, _ := json.Marshal(instances)
return marshalledBytes
}

type Arguments struct {
NumberOfInstances int `river:"number_of_instances,attr"`
NumberOfMetrics int `river:"number_of_metrics,attr"`
Expand Down

0 comments on commit 29a4b7c

Please sign in to comment.