Skip to content

Commit

Permalink
update golang to version 1.21.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ntap-nmarco authored Dec 7, 2023
1 parent 4a812e8 commit 0906314
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.3
go-version: 1.21.5

- name: Install package dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21.3
go-version: 1.21.5

- name: Install package dependencies
run: |
Expand All @@ -40,7 +40,7 @@ jobs:
run: |
cd /
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sudo sh -s v1.52.0
| sudo sh -s v1.55.2
- name: Run Linter
run: make lint
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 2.2.10 (2023-11-07)
## 2.2.12 (2023-12-07)

* Upgrade Go to 1.21.5
* Include LogCLI binary

## 2.2.11 (2023-11-07)

* Upgrade Go to 1.21.3

Expand Down
2 changes: 1 addition & 1 deletion cmd/fluent-bit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build
COPY . /src/vali
WORKDIR /src/vali
RUN make clean && make BUILD_IN_CONTAINER=false fluent-bit-plugin
Expand Down
2 changes: 1 addition & 1 deletion cmd/logcli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build

ARG TOUCH_PROTOS
COPY . /src/vali
Expand Down
2 changes: 1 addition & 1 deletion cmd/migrate/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build
COPY . /src/vali
WORKDIR /src/vali
RUN make clean && make BUILD_IN_CONTAINER=false migrate
Expand Down
2 changes: 1 addition & 1 deletion cmd/querytee/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build

ARG TOUCH_PROTOS
COPY . /src/vali
Expand Down
2 changes: 1 addition & 1 deletion cmd/querytee/Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.9.1
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile .
FROM golang:1.21.3-alpine as goenv
FROM golang:1.21.5-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand Down
2 changes: 1 addition & 1 deletion cmd/vali-canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/vali-canary/Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile .
FROM golang:1.21.3-alpine as goenv
FROM golang:1.21.5-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand Down
2 changes: 1 addition & 1 deletion cmd/vali/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3 as build
FROM golang:1.21.5 as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/vali/Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t ghcr.io/credativ/vali -f cmd/vali/Dockerfile .
FROM golang:1.21.3-alpine as goenv
FROM golang:1.21.5-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand Down
2 changes: 1 addition & 1 deletion cmd/valitail/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21.3-bullseye as build
FROM golang:1.21.5-bullseye as build
# TOUCH_PROTOS signifies if we should touch the compiled proto files and thus not regenerate them.
# This is helpful when file system timestamps can't be trusted with make
ARG TOUCH_PROTOS
Expand Down
2 changes: 1 addition & 1 deletion cmd/valitail/Dockerfile.cross
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG BUILD_IMAGE=ghcr.io/credativ/vali-build-image:0.12.0
# Directories in this file are referenced from the root of the project not this folder
# This file is intended to be called from the root like so:
# docker build -t ghcr.io/credativ/valitail -f cmd/valitail/Dockerfile .
FROM golang:1.21.3-alpine as goenv
FROM golang:1.21.5-alpine as goenv
RUN go env GOARCH > /goarch && \
go env GOARM > /goarm

Expand Down
9 changes: 5 additions & 4 deletions pkg/logentry/stages/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const (
ErrMetricsStageInvalidType = "invalid metric type '%s', metric type must be one of 'counter', 'gauge', or 'histogram'"
ErrInvalidIdleDur = "max_idle_duration could not be parsed as a time.Duration: '%s'"
ErrSubSecIdleDur = "max_idle_duration less than 1s not allowed"
ErrValueToStringConversion = "failed to convert extracted value to string"
)

// MetricConfig is a single metrics configuration.
Expand Down Expand Up @@ -185,8 +186,8 @@ func (m *metricStage) recordCounter(name string, counter *metric.Counters, label
stringVal, err := getString(v)
if err != nil {
if Debug {
level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+
"can't perform value comparison", "metric", name, "err",
level.Debug(m.logger).Log("msg", ErrValueToStringConversion+
", can't perform value comparison", "metric", name, "err",
fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v)))
}
return
Expand Down Expand Up @@ -218,7 +219,7 @@ func (m *metricStage) recordGauge(name string, gauge *metric.Gauges, labels mode
stringVal, err := getString(v)
if err != nil {
if Debug {
level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+
level.Debug(m.logger).Log("msg", ErrValueToStringConversion+
"can't perform value comparison", "metric", name, "err",
fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v)))
}
Expand Down Expand Up @@ -271,7 +272,7 @@ func (m *metricStage) recordHistogram(name string, histogram *metric.Histograms,
stringVal, err := getString(v)
if err != nil {
if Debug {
level.Debug(m.logger).Log("msg", "failed to convert extracted value to string, "+
level.Debug(m.logger).Log("msg", ErrValueToStringConversion+
"can't perform value comparison", "metric", name, "err",
fmt.Sprintf("can't convert %v to string", reflect.TypeOf(v)))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/logentry/stages/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestPipelineWithMissingKey_Metrics(t *testing.T) {
}
Debug = true
processEntries(pl, newEntry(nil, nil, testMetricLogLineWithMissingKey, time.Now()))
expectedLog := "level=debug msg=\"failed to convert extracted value to string, can't perform value comparison\" metric=bvali_count err=\"can't convert <nil> to string\""
expectedLog := "level=debug msg=\"failed to convert extracted value to string, can't perform value comparison\" metric=vali_count err=\"can't convert <nil> to string\""
if !(strings.Contains(buf.String(), expectedLog)) {
t.Errorf("\nexpected: %s\n+actual: %s", expectedLog, buf.String())
}
Expand Down
33 changes: 19 additions & 14 deletions pkg/logentry/stages/pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import (
"github.com/credativ/vali/pkg/valitail/api"
)

const (
TestLine1 = "test line 1"
TestLine1ColonQuoted = ":\"test line 1\""
)

// Not all these are tested but are here to make sure the different types marshal without error
var testPackYaml = `
pipeline_stages:
Expand Down Expand Up @@ -128,7 +133,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -140,7 +145,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -160,7 +165,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -171,7 +176,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -191,7 +196,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -200,7 +205,7 @@ func Test_packStage_Run(t *testing.T) {
Labels: model.LabelSet{},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"bar\":\"baz\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"bar\":\"baz\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -223,7 +228,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -234,7 +239,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"extr1\":\"etr1val\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"extr1\":\"etr1val\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -257,7 +262,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -268,7 +273,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -291,7 +296,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -302,7 +307,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "{\"ex\\\"tr2\":\"\\\"fd\\\"\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"ex\\\"tr2\":\"\\\"fd\\\"\",\"foo\":\"bar\",\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand All @@ -322,7 +327,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0),
Line: "test line 1",
Line: TestLine1,
},
},
},
Expand All @@ -334,7 +339,7 @@ func Test_packStage_Run(t *testing.T) {
},
Entry: logproto.Entry{
Timestamp: time.Unix(1, 0), // Ignored in test execution below
Line: "{\"" + logql_log.PackedEntryKey + "\":\"test line 1\"}",
Line: "{\"" + logql_log.PackedEntryKey + "\"" + TestLine1ColonQuoted + "}",
},
},
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/logproto/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
// Seconds field just after the latest valid Timestamp.
// This is time.Date(10000, 1, 1, 0, 0, 0, 0, time.UTC).Unix().
maxValidSeconds = 253402300800
TimestampLabel = "timestamp: "
)

// validateTimestamp determines whether a Timestamp is valid.
Expand All @@ -32,13 +33,13 @@ func validateTimestamp(ts *types.Timestamp) error {
return errors.New("timestamp: nil Timestamp")
}
if ts.Seconds < minValidSeconds {
return errors.New("timestamp: " + formatTimestamp(ts) + " before 0001-01-01")
return errors.New(TimestampLabel + formatTimestamp(ts) + " before 0001-01-01")
}
if ts.Seconds >= maxValidSeconds {
return errors.New("timestamp: " + formatTimestamp(ts) + " after 10000-01-01")
return errors.New(TimestampLabel + formatTimestamp(ts) + " after 10000-01-01")
}
if ts.Nanos < 0 || ts.Nanos >= 1e9 {
return errors.New("timestamp: " + formatTimestamp(ts) + ": nanos not in range [0, 1e9)")
return errors.New(TimestampLabel + formatTimestamp(ts) + ": nanos not in range [0, 1e9)")
}
return nil
}
Expand Down
Loading

0 comments on commit 0906314

Please sign in to comment.