reorganize log pkg

This commit is contained in:
kongfei 2022-06-02 19:55:13 +08:00
parent a93a696bd0
commit 687c344c7b
75 changed files with 75 additions and 75 deletions

View File

@ -15,18 +15,18 @@ import (
coreconfig "flashcat.cloud/categraf/config"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/pkg/logs/client/http"
"flashcat.cloud/categraf/pkg/logs/diagnostic"
"flashcat.cloud/categraf/pkg/logs/input/file"
"flashcat.cloud/categraf/pkg/logs/input/journald"
"flashcat.cloud/categraf/pkg/logs/input/listener"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/pkg/logs/service"
logService "flashcat.cloud/categraf/pkg/logs/service"
"flashcat.cloud/categraf/pkg/logs/status"
"flashcat.cloud/categraf/logs/auditor"
"flashcat.cloud/categraf/logs/client"
"flashcat.cloud/categraf/logs/client/http"
"flashcat.cloud/categraf/logs/diagnostic"
"flashcat.cloud/categraf/logs/input/file"
"flashcat.cloud/categraf/logs/input/journald"
"flashcat.cloud/categraf/logs/input/listener"
"flashcat.cloud/categraf/logs/pipeline"
"flashcat.cloud/categraf/logs/restart"
"flashcat.cloud/categraf/logs/service"
logService "flashcat.cloud/categraf/logs/service"
"flashcat.cloud/categraf/logs/status"
)
// LogAgent represents the data pipeline that collects, decodes,

View File

@ -15,7 +15,7 @@ import (
"time"
config "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// DefaultRegistryFilename is the default registry filename

View File

@ -1,7 +1,7 @@
package auditor
import (
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// NullAuditor is an auditor not doing anything with the message it received.

View File

@ -13,7 +13,7 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/logs/client"
"flashcat.cloud/categraf/pkg/util/backoff"
httputils "flashcat.cloud/categraf/pkg/util/http"
)

View File

@ -21,7 +21,7 @@ import (
"golang.org/x/net/proxy"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/status"
"flashcat.cloud/categraf/logs/status"
)
const (

View File

@ -11,7 +11,7 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/logs/client"
)
const (

View File

@ -13,7 +13,7 @@ import (
"time"
config "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/parser"
"flashcat.cloud/categraf/logs/parser"
)
// defaultContentLenLimit represents the max size for a line,

View File

@ -10,7 +10,7 @@ import (
"log"
"time"
"flashcat.cloud/categraf/pkg/logs/parser"
"flashcat.cloud/categraf/logs/parser"
)
// LineParser e

View File

@ -12,7 +12,7 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// MessageReceiver interface to handle messages for diagnostics

View File

@ -5,7 +5,7 @@
package diagnostic
import "flashcat.cloud/categraf/pkg/logs/message"
import "flashcat.cloud/categraf/logs/message"
// NoopMessageReceiver for cases where diagnosing messages is unsupported or not needed (serverless, tests)
type NoopMessageReceiver struct{}

View File

@ -7,7 +7,7 @@ package channel
import (
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/logs/pipeline"
)
// Launcher starts a channel reader on the given channel of string.

View File

@ -11,7 +11,7 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// serviceEnvVar is the environment variable of the service tag (this is used only for the serverless agent)

View File

@ -13,7 +13,7 @@ import (
"sort"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/status"
"flashcat.cloud/categraf/logs/status"
)
// OpenFilesLimitWarningType is the key of the message generated when too many

View File

@ -10,7 +10,7 @@ import (
"strconv"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/logs/auditor"
)
// Position returns the position from where logs should be collected.

View File

@ -15,10 +15,10 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/logs/auditor"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/pipeline"
"flashcat.cloud/categraf/logs/restart"
)
// rxContainerID is used in the shouldIgnore func to do a best-effort validation

View File

@ -18,10 +18,10 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/decoder"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/parser"
"flashcat.cloud/categraf/pkg/logs/tag"
"flashcat.cloud/categraf/logs/decoder"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/parser"
"flashcat.cloud/categraf/logs/tag"
)
// DefaultSleepDuration represents the amount of time the tailer waits before reading new data when no data is received

View File

@ -14,7 +14,7 @@ import (
"log"
"path/filepath"
"flashcat.cloud/categraf/pkg/logs/decoder"
"flashcat.cloud/categraf/logs/decoder"
)
// setup sets up the file tailer

View File

@ -14,7 +14,7 @@ import (
"os"
"path/filepath"
"flashcat.cloud/categraf/pkg/logs/decoder"
"flashcat.cloud/categraf/logs/decoder"
)
// setup sets up the file tailer

View File

@ -11,9 +11,9 @@ package journald
import (
"log"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/logs/auditor"
"flashcat.cloud/categraf/logs/pipeline"
"flashcat.cloud/categraf/logs/restart"
)
// Launcher is in charge of starting and stopping new journald tailers

View File

@ -10,8 +10,8 @@ package journald
import (
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/logs/auditor"
"flashcat.cloud/categraf/logs/pipeline"
)
// Launcher is not supported on no systemd environment.

View File

@ -18,7 +18,7 @@ import (
"github.com/coreos/go-systemd/sdjournal"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// defaultWaitDuration represents the delay before which we try to collect a new log from the journal

View File

@ -7,8 +7,8 @@ package listener
import (
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/logs/pipeline"
"flashcat.cloud/categraf/logs/restart"
)
// Launcher summons different protocol specific listeners based on configuration

View File

@ -11,9 +11,9 @@ import (
"net"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/decoder"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/parser"
"flashcat.cloud/categraf/logs/decoder"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/parser"
)
// Tailer reads data from a connection

View File

@ -13,8 +13,8 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/logs/pipeline"
"flashcat.cloud/categraf/logs/restart"
)
// A TCPListener listens and accepts TCP connections and delegates the read operations to a tailer.

View File

@ -11,7 +11,7 @@ import (
"net"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/pipeline"
"flashcat.cloud/categraf/logs/pipeline"
)
// The UDP listener is limited by the size of its read buffer,

View File

@ -9,13 +9,13 @@ import (
"context"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/pkg/logs/client/http"
"flashcat.cloud/categraf/pkg/logs/client/tcp"
"flashcat.cloud/categraf/pkg/logs/diagnostic"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/processor"
"flashcat.cloud/categraf/pkg/logs/sender"
"flashcat.cloud/categraf/logs/client"
"flashcat.cloud/categraf/logs/client/http"
"flashcat.cloud/categraf/logs/client/tcp"
"flashcat.cloud/categraf/logs/diagnostic"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/processor"
"flashcat.cloud/categraf/logs/sender"
)
// Pipeline processes and sends messages to the backend

View File

@ -9,13 +9,13 @@ import (
"context"
"sync/atomic"
"flashcat.cloud/categraf/pkg/logs/diagnostic"
"flashcat.cloud/categraf/logs/diagnostic"
config "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/auditor"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/restart"
"flashcat.cloud/categraf/logs/auditor"
"flashcat.cloud/categraf/logs/client"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/restart"
)
// Provider provides message channels

View File

@ -9,7 +9,7 @@ import (
"unicode"
"unicode/utf8"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// Encoder turns a message into a raw byte array ready to be sent.

View File

@ -9,7 +9,7 @@ import (
"encoding/json"
"time"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
const nanoToMillis = 1000000

View File

@ -9,7 +9,7 @@ import (
"encoding/json"
"time"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// JSONServerlessEncoder is a shared json encoder sending a struct message field

View File

@ -11,8 +11,8 @@ import (
"sync"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/diagnostic"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/diagnostic"
"flashcat.cloud/categraf/logs/message"
)
// A Processor updates messages from an inputChan and pushes

View File

@ -8,8 +8,8 @@ package processor
import (
"time"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/pkg/logs/pb"
"flashcat.cloud/categraf/logs/message"
"flashcat.cloud/categraf/logs/pb"
)
// ProtoEncoder is a shared proto encoder.

View File

@ -10,7 +10,7 @@ import (
"time"
logsconfig "flashcat.cloud/categraf/config/logs"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// RawEncoder is a shared raw encoder.

View File

@ -11,7 +11,7 @@ import (
"sync"
"time"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// batchStrategy contains all the logic to send logs in batch.

View File

@ -6,7 +6,7 @@
package sender
import (
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// MessageBuffer accumulates messages to a buffer until the max capacity is reached.

View File

@ -8,8 +8,8 @@ package sender
import (
"context"
"flashcat.cloud/categraf/pkg/logs/client"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/client"
"flashcat.cloud/categraf/logs/message"
)
// Strategy should contain all logic to send logs to a remote destination

View File

@ -8,7 +8,7 @@ package sender
import (
"bytes"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
var (

View File

@ -9,7 +9,7 @@ import (
"context"
"log"
"flashcat.cloud/categraf/pkg/logs/message"
"flashcat.cloud/categraf/logs/message"
)
// StreamStrategy is a shared stream strategy.