Always render all sources from default target
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
st "git.ipng.ch/ipng/nginx-logtail/internal/store"
|
||||
pb "git.ipng.ch/ipng/nginx-logtail/proto/logtailpb"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Handler is the HTTP handler for the frontend.
|
||||
@@ -526,7 +527,21 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
trendCh <- trendResult{resp, err}
|
||||
}()
|
||||
go func() {
|
||||
resp, err := client.ListTargets(ctx, &pb.ListTargetsRequest{})
|
||||
// Always query the default target for ListTargets so we get the full
|
||||
// list of available sources even when viewing a specific collector.
|
||||
ltClient := client
|
||||
var ltConn *grpc.ClientConn
|
||||
if params.Target != h.defaultTarget {
|
||||
c, cl, err := dial(h.defaultTarget)
|
||||
if err == nil {
|
||||
ltConn = c
|
||||
ltClient = cl
|
||||
}
|
||||
}
|
||||
resp, err := ltClient.ListTargets(ctx, &pb.ListTargetsRequest{})
|
||||
if ltConn != nil {
|
||||
ltConn.Close()
|
||||
}
|
||||
if err != nil {
|
||||
ltCh <- nil
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user