Skip to content

Commit

Permalink
Sync loki.process with latest Promtail code (grafana#5677)
Browse files Browse the repository at this point in the history
Signed-off-by: Paschalis Tsilias <[email protected]>
  • Loading branch information
tpaschalis authored and hainenber committed Nov 1, 2023
1 parent 7fd6816 commit c0a75ec
Show file tree
Hide file tree
Showing 41 changed files with 11 additions and 149 deletions.
3 changes: 3 additions & 0 deletions component/loki/process/process.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// The code in this package is adapted/ported over from grafana/loki/clients/pkg/logentry.
//
// The last Loki commit scanned for upstream changes was 7d5475541c66a819f6f456a45f8c143a084e6831.
package process

import (
Expand Down
2 changes: 0 additions & 2 deletions component/loki/process/stages/decolorize.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package stages

// NOTE: This code is copied from Promtail (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"github.com/grafana/loki/pkg/logql/log"
)
Expand Down
2 changes: 0 additions & 2 deletions component/loki/process/stages/decolorize_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package stages

// NOTE: This code is copied from Promtail (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"testing"
"time"
Expand Down
3 changes: 0 additions & 3 deletions component/loki/process/stages/drop.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package stages

// NOTE: This package is ported over from grafana/loki/clients/pkg/logentry/stages
// (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/drop_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
3 changes: 0 additions & 3 deletions component/loki/process/stages/extensions.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package stages

// NOTE: This package is ported over from grafana/loki/clients/pkg/logentry/stages
// (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"fmt"
"strings"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/extensions_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"testing"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/geoip.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/inspector.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"fmt"
"io"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/json.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/json_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/label_drop.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/label_drop_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"testing"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/label_keep.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/label_keep_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"testing"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/labels.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/labels_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"errors"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/logfmt.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/logfmt_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"testing"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/match.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
5 changes: 1 addition & 4 deletions component/loki/process/stages/match_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"fmt"
"testing"
Expand Down Expand Up @@ -137,6 +133,7 @@ func TestMatcher(t *testing.T) {
{`{foo="bar",bar!~"te.*"}`, map[string]string{"foo": "bar", "bar": "test"}, MatchActionDrop, false, false, false},

{`{foo=""}`, map[string]string{}, MatchActionKeep, false, true, false},
{`{foo="bar"} |= "foo" | status >= 200`, map[string]string{"foo": "bar"}, MatchActionKeep, false, false, true},
}

for _, tt := range tests {
Expand Down
6 changes: 1 addition & 5 deletions component/loki/process/stages/multiline.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"errors"
Expand Down Expand Up @@ -81,7 +77,7 @@ type multilineState struct {
currentLines uint64 // The number of lines of the current multiline block.
}

// newMulitlineStage creates a MulitlineStage from config
// newMultilineStage creates a MulitlineStage from config
func newMultilineStage(logger log.Logger, config MultilineConfig) (Stage, error) {
err := validateMultilineConfig(&config)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/multiline_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"sort"
"sync"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/output.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"reflect"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/output_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"strings"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/pipeline.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"context"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/pipeline_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"fmt"
"sync"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/regex.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/regex_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"errors"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/replace.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"errors"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/replace_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
2 changes: 0 additions & 2 deletions component/loki/process/stages/sampling.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package stages

// NOTE: This code is copied from Promtail (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"fmt"
"math"
Expand Down
2 changes: 0 additions & 2 deletions component/loki/process/stages/sampling_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package stages

// NOTE: This code is copied from Promtail (07cbef92268aecc0f20d1791a6df390c2df5c072) with changes kept to the minimum.

import (
"fmt"
"testing"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/stage.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"fmt"
"os"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/static_labels.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/static_labels_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"testing"
"time"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/timestamp.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"errors"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/timestamp_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"bytes"
"fmt"
Expand Down
4 changes: 0 additions & 4 deletions component/loki/process/stages/util.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package stages

// This package is ported over from grafana/loki/clients/pkg/logentry/stages.
// We aim to port the stages in steps, to avoid introducing huge amounts of
// new code without being able to slowly review, examine and test them.

import (
"fmt"
"math"
Expand Down
Loading

0 comments on commit c0a75ec

Please sign in to comment.