diff --git a/Makefile b/Makefile index f6dca90..1215727 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ PROTO_FILE := $(PROTO_DIR)/logtail.proto GEN_FILES := proto/logtailpb/logtail.pb.go proto/logtailpb/logtail_grpc.pb.go NATIVE_ARCH := $(shell go env GOARCH) -VERSION := 0.9.1 +VERSION := 0.9.2 COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -s -w \ diff --git a/cmd/frontend/frontend_test.go b/cmd/frontend/frontend_test.go index f76e2aa..784c3af 100644 --- a/cmd/frontend/frontend_test.go +++ b/cmd/frontend/frontend_test.go @@ -368,10 +368,10 @@ func TestHandlerRaw(t *testing.T) { } var result struct { - Source string `json:"source"` - Window string `json:"window"` - GroupBy string `json:"group_by"` - Entries []struct { + Collector string `json:"collector"` + Window string `json:"window"` + GroupBy string `json:"group_by"` + Entries []struct { Label string `json:"label"` Count int64 `json:"count"` } `json:"entries"` @@ -379,8 +379,8 @@ func TestHandlerRaw(t *testing.T) { if err := json.Unmarshal([]byte(body), &result); err != nil { t.Fatalf("JSON parse: %v\nbody: %s", err, body) } - if result.Source != "agg" { - t.Errorf("source = %q", result.Source) + if result.Collector != "agg" { + t.Errorf("collector = %q", result.Collector) } if result.Window != "15m" { t.Errorf("window = %q", result.Window) diff --git a/cmd/frontend/handler.go b/cmd/frontend/handler.go index 9ba6b0b..2bcfeca 100644 --- a/cmd/frontend/handler.go +++ b/cmd/frontend/handler.go @@ -75,14 +75,14 @@ type QueryParams struct { // PageData is passed to the HTML template. type PageData struct { Params QueryParams - Source string + Collector string Entries []TableRow TotalCount int64 Sparkline template.HTML Breadcrumbs []Crumb Windows []Tab GroupBys []Tab - Targets []Tab // source/target picker; empty when only one target available + Targets []Tab // collector picker; empty when only one target available TorTabs []Tab // all / tor / no-tor toggle RefreshSecs int Error string @@ -455,7 +455,7 @@ func buildTorTabs(p QueryParams) []Tab { return tabs } -// buildTargetTabs builds the source/target picker tabs from a ListTargets response. +// buildTargetTabs builds the collector picker tabs from a ListTargets response. // Returns nil (hide picker) when only one endpoint is reachable. func (h *Handler) buildTargetTabs(p QueryParams, lt *pb.ListTargetsResponse) []Tab { // "all" always points at the configured aggregator default. @@ -577,7 +577,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { }() go func() { // Always query the default target for ListTargets so we get the full - // list of available sources even when viewing a specific collector. + // list of available collectors even when viewing a specific one. ltClient := client var ltConn *grpc.ClientConn if params.Target != h.defaultTarget { @@ -623,7 +623,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { data := PageData{ Params: params, - Source: tn.resp.Source, + Collector: tn.resp.Source, Entries: rows, TotalCount: total, Sparkline: sparkline, @@ -668,16 +668,16 @@ func writeRawJSON(w http.ResponseWriter, params QueryParams, resp *pb.TopNRespon Count int64 `json:"count"` } type out struct { - Source string `json:"source"` - Window string `json:"window"` - GroupBy string `json:"group_by"` - Entries []entry `json:"entries"` + Collector string `json:"collector"` + Window string `json:"window"` + GroupBy string `json:"group_by"` + Entries []entry `json:"entries"` } o := out{ - Source: resp.Source, - Window: params.WindowS, - GroupBy: params.GroupByS, - Entries: make([]entry, len(resp.Entries)), + Collector: resp.Source, + Window: params.WindowS, + GroupBy: params.GroupByS, + Entries: make([]entry, len(resp.Entries)), } for i, e := range resp.Entries { o.Entries[i] = entry{Label: e.Label, Count: e.Count} diff --git a/cmd/frontend/templates/base.html b/cmd/frontend/templates/base.html index 6371ac6..314dbf3 100644 --- a/cmd/frontend/templates/base.html +++ b/cmd/frontend/templates/base.html @@ -10,8 +10,8 @@ * { box-sizing: border-box; } body { font-family: monospace; font-size: 14px; max-width: 1100px; margin: 2em auto; padding: 0 1.5em; color: #222; } h1 { font-size: 1.1em; font-weight: bold; margin: 0 0 1em; letter-spacing: 0.05em; } -.tabs { display: flex; gap: 0.3em; margin-bottom: 0.7em; flex-wrap: wrap; } -.tabs a { text-decoration: none; padding: 0.2em 0.8em; border: 1px solid #aaa; color: #444; } +.tabs { display: flex; gap: 0.2em; margin-bottom: 0.5em; flex-wrap: wrap; align-items: center; } +.tabs a { text-decoration: none; padding: 0.1em 0.5em; border: 1px solid #aaa; color: #444; font-size: 0.9em; } .tabs a:hover { background: #f0f0f0; } .tabs a.active { background: #222; color: #fff; border-color: #222; } .crumbs { margin-bottom: 0.8em; font-size: 0.9em; } @@ -34,9 +34,7 @@ a:hover { text-decoration: underline; } .error { color: #c00; border: 1px solid #fbb; background: #fff5f5; padding: 0.7em 1em; margin: 1em 0; border-radius: 3px; } .nodata { color: #999; margin: 2em 0; font-style: italic; } footer { margin-top: 2em; padding-top: 0.6em; border-top: 1px solid #e0e0e0; font-size: 0.8em; color: #999; } -.tabs-targets { margin-top: -0.4em; } -.tabs-tor { margin-top: -0.4em; } -.tabs-label { font-size: 0.85em; color: #888; margin-right: 0.2em; align-self: center; } +.tabs-label { font-size: 0.8em; color: #888; margin-right: 0.15em; min-width: 5.5em; } .filter-form { display: flex; gap: 0.4em; align-items: center; margin-bottom: 0.7em; } .filter-input { flex: 1; font-family: monospace; font-size: 13px; padding: 0.25em 0.5em; border: 1px solid #aaa; } .filter-form button { padding: 0.25em 0.8em; border: 1px solid #aaa; background: #f4f4f4; cursor: pointer; font-family: monospace; } diff --git a/cmd/frontend/templates/index.html b/cmd/frontend/templates/index.html index 853f547..755066b 100644 --- a/cmd/frontend/templates/index.html +++ b/cmd/frontend/templates/index.html @@ -2,19 +2,21 @@

nginx-logtail

+ window: {{- range .Windows}} {{.Label}} {{- end}}
+ filter: {{- range .GroupBys}} {{.Label}} {{- end}}
{{if .Targets}}
- source: + collector: {{- range .Targets}} {{.Label}} {{- end}} @@ -53,7 +55,7 @@ {{if .Sparkline}}
- {{.Params.WindowS}} trend · by {{.Params.GroupByS}}{{if .Source}} · source: {{.Source}}{{end}} + {{.Params.WindowS}} trend · by {{.Params.GroupByS}}{{if .Collector}} · collector: {{.Collector}}{{end}} {{.Sparkline}}
{{end}} @@ -88,7 +90,7 @@ {{end}} diff --git a/internal/version/version.go b/internal/version/version.go index 1eb1c14..0aa0531 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -5,7 +5,7 @@ package version import "fmt" var ( - Version = "0.9.1" + Version = "0.9.2" Commit = "unknown" Date = "unknown" )