generated from xmidt-org/.go-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.go
63 lines (54 loc) · 1.64 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package syslog
import (
"github.com/xmidt-org/ears/internal/pkg/syncer"
"sync"
"github.com/rs/zerolog"
pkgplugin "github.com/xmidt-org/ears/pkg/plugin"
"github.com/xmidt-org/ears/pkg/receiver"
"github.com/xmidt-org/ears/pkg/tenant"
"go.opentelemetry.io/otel/metric"
)
var _ receiver.Receiver = (*Receiver)(nil)
var (
Name = "syslog"
Version = "v0.0.0"
CommitID = ""
)
func NewPlugin() (*pkgplugin.Plugin, error) {
return NewPluginVersion(Name, Version, CommitID)
}
func NewPluginVersion(name string, version string, commitID string) (*pkgplugin.Plugin, error) {
return pkgplugin.NewPlugin(
pkgplugin.WithName(name),
pkgplugin.WithVersion(version),
pkgplugin.WithCommitID(commitID),
pkgplugin.WithNewReceiver(NewReceiver),
)
}
type ReceiverConfig struct {
Port string `json:"port"`
}
var DefaultReceiverConfig = ReceiverConfig{
Port: "7531",
}
type Receiver struct {
sync.Mutex
logger *zerolog.Logger
config ReceiverConfig
name string
plugin string
tid tenant.Id
eventSuccessCounter metric.BoundInt64Counter
eventFailureCounter metric.BoundInt64Counter
eventBytesCounter metric.BoundInt64Counter
next receiver.NextFn
syslogServer *SyslogServer
successCounter int
errorCounter int
successVelocityCounter int
errorVelocityCounter int
currentSuccessVelocityCounter int
currentErrorVelocityCounter int
currentSec int64
tableSyncer syncer.DeltaSyncer
}