From 422e2db67b27eed8b709cddcce3ac732e8b0136c Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Mon, 20 Nov 2023 23:09:51 +0300 Subject: [PATCH] chore: fix lint issues --- cmd/chotel/main.go | 3 +++ integration/chotele2e/e2e_test.go | 4 ++-- internal/chtrace/chtrace.go | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/chotel/main.go b/cmd/chotel/main.go index 02c58bc5..55771e5e 100644 --- a/cmd/chotel/main.go +++ b/cmd/chotel/main.go @@ -40,6 +40,7 @@ func main() { }) } +// App is the trace exporter application. type App struct { log *zap.Logger metrics *app.Metrics @@ -64,6 +65,7 @@ const DDL = `CREATE TABLE IF NOT EXISTS opentelemetry_span_export TTL toStartOfMinute(exported_at) + INTERVAL 10 MINUTE ` +// NewApp initializes the trace exporter application. func NewApp(logger *zap.Logger, metrics *app.Metrics) (*App, error) { a := &App{ log: logger, @@ -81,6 +83,7 @@ func NewApp(logger *zap.Logger, metrics *app.Metrics) (*App, error) { return a, nil } +// Run starts and runs the application. func (a *App) Run(ctx context.Context) error { ctx = zctx.Base(ctx, a.log) if err := a.setup(ctx); err != nil { diff --git a/integration/chotele2e/e2e_test.go b/integration/chotele2e/e2e_test.go index 8bd3320e..2de196cb 100644 --- a/integration/chotele2e/e2e_test.go +++ b/integration/chotele2e/e2e_test.go @@ -30,7 +30,7 @@ type randomIDGenerator struct { } // NewSpanID returns a non-zero span ID from a randomly-chosen sequence. -func (gen *randomIDGenerator) NewSpanID(ctx context.Context, traceID trace.TraceID) (sid trace.SpanID) { +func (gen *randomIDGenerator) NewSpanID(context.Context, trace.TraceID) (sid trace.SpanID) { gen.Lock() defer gen.Unlock() gen.rand.Read(sid[:]) @@ -39,7 +39,7 @@ func (gen *randomIDGenerator) NewSpanID(ctx context.Context, traceID trace.Trace // NewIDs returns a non-zero trace ID and a non-zero span ID from a // randomly-chosen sequence. -func (gen *randomIDGenerator) NewIDs(ctx context.Context) (tid trace.TraceID, sid trace.SpanID) { +func (gen *randomIDGenerator) NewIDs(context.Context) (tid trace.TraceID, sid trace.SpanID) { gen.Lock() defer gen.Unlock() gen.rand.Read(tid[:]) diff --git a/internal/chtrace/chtrace.go b/internal/chtrace/chtrace.go index 925a15d2..d9589379 100644 --- a/internal/chtrace/chtrace.go +++ b/internal/chtrace/chtrace.go @@ -21,6 +21,7 @@ type Table struct { Attributes proto.ColMap[string, string] // attribute } +// Rows returns Trace per row. func (t Table) Rows() []Trace { var out []Trace for i := 0; i < t.TraceID.Rows(); i++ { @@ -40,6 +41,7 @@ func (t Table) Rows() []Trace { return out } +// Trace is a single trace span. type Trace struct { TraceID trace.TraceID SpanID trace.SpanID @@ -50,6 +52,7 @@ type Trace struct { Attributes map[string]string } +// Result returns proto.Results for Table. func (t *Table) Result() proto.Results { return proto.Results{ {Name: "trace_id", Data: &t.TraceID}, @@ -63,6 +66,7 @@ func (t *Table) Result() proto.Results { } } +// Columns returns column names (and mappings) for doing SELECTS. func (t *Table) Columns() []string { var out []string for _, v := range t.Result() { @@ -78,6 +82,7 @@ func (t *Table) Columns() []string { return out } +// NewTable creates and initializes new Table. func NewTable() *Table { return &Table{ OperationName: new(proto.ColStr).LowCardinality(),