We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 480189b commit d2dfc12Copy full SHA for d2dfc12
4 files changed
diskcache/diskcache.go
@@ -104,12 +104,14 @@ func (c *DiskCache) String() string {
104
c.rwlock.Lock()
105
defer c.rwlock.Unlock()
106
107
+ // nolint: lll
108
// if there too many files(>10), only print file count
109
if n := len(c.dataFiles); n > 10 {
110
return fmt.Sprintf("%s/[size: %d][fallback: %v][nosync: %v][nopos: %v][nolock: %v][files: %d][maxDataSize: %d][batchSize: %d][capacity: %d][dataFiles: %d]",
111
c.path, c.size, c.noFallbackOnError, c.noSync, c.noPos, c.noLock, len(c.dataFiles), c.maxDataSize, c.batchSize, c.capacity, n,
112
)
113
} else {
114
115
return fmt.Sprintf("%s/[size: %d][fallback: %v][nosync: %v][nopos: %v][nolock: %v][files: %d][maxDataSize: %d][batchSize: %d][capacity: %d][dataFiles: %v]",
116
c.path, c.size, c.noFallbackOnError, c.noSync, c.noLock, c.noPos, len(c.dataFiles), c.maxDataSize, c.batchSize, c.capacity, c.dataFiles,
117
point/category_test.go
@@ -25,14 +25,14 @@ func TestURL(t *testing.T) {
25
{c: "/v1/write/rum", expect: RUM},
26
{c: "/v1/write/security", expect: Security},
27
{c: "/v1/write/profiling", expect: Profiling},
28
- {c: "/v1/write/event", expect: KeyEvent},
+ {c: "/v1/write/keyevent", expect: KeyEvent},
29
{c: "/v1/write/tracing", expect: Tracing},
30
{c: "/v1/write/dynamic_dw", expect: DynamicDWCategory},
31
}
32
33
for _, tc := range cases {
34
t.Run(tc.c, func(t *testing.T) {
35
- assert.Equal(t, tc.expect, CatURL(tc.c))
+ assert.Equal(t, tc.expect.String(), CatURL(tc.c).String())
36
})
37
38
@@ -76,7 +76,7 @@ func TestString(t *testing.T) {
76
{c: "rum", expect: RUM},
77
{c: "security", expect: Security},
78
{c: "profiling", expect: Profiling},
79
- {c: "event", expect: KeyEvent},
+ {c: "keyevent", expect: KeyEvent},
80
{c: "tracing", expect: Tracing},
81
{c: "dynamic_dw", expect: DynamicDWCategory},
82
point/encode.go
@@ -13,6 +13,19 @@ import (
13
"google.golang.org/protobuf/proto"
14
15
16
+type Encoding int
17
+
18
+func EncodingStr(s string) Encoding {
19
+ switch s {
20
+ case "protobuf":
21
+ return Protobuf
22
+ case "lineproto", "lineprotocol":
23
+ return LineProtocol
24
+ default:
+ }
+}
// EncodeFn used to iterate on []*Point payload, if error returned, the iterate terminated.
type EncodeFn func(batchSize int, payload []byte) error
point/option.go
@@ -10,19 +10,6 @@ import (
10
"time"
11
12
-type Encoding int
-
-func EncodingStr(s string) Encoding {
- switch s {
- case "protobuf":
- return Protobuf
- case "lineproto", "lineprotocol":
- return LineProtocol
- default:
- }
-}
const (
LineProtocol Encoding = iota
Protobuf
@@ -176,6 +163,7 @@ func WithRequiredKeys(keys ...*Key) Option {
176
163
177
164
178
165
166
+// DefaultObjectOptions defined options on Object/CustomObject point.
179
167
func DefaultObjectOptions() []Option {
180
168
return []Option{
181
169
WithDisabledKeys(disabledKeys[Object]...),
@@ -185,15 +173,16 @@ func DefaultObjectOptions() []Option {
185
173
186
174
187
175
+// DefaultLoggingOptions defined options on Logging point.
188
func DefaultLoggingOptions() []Option {
189
- return []Option{
+ return append(CommonLoggingOptions(), []Option{
190
WithDisabledKeys(disabledKeys[Logging]...),
191
WithMaxFieldValLen(defaultMaxFieldValLen),
192
- WithDotInKey(false),
193
WithRequiredKeys(requiredKeys[Logging]...),
194
182
+ }...)
195
183
196
184
+// DefaultMetricOptions defined options on Metric point.
197
func DefaultMetricOptions() []Option {
198
199
WithStrField(false),
@@ -208,3 +197,10 @@ func DefaultMetricOptionsForInflux1X() []Option {
208
WithU64Field(false),
209
210
200
201
+// CommonLoggingOptions defined options on RUM/Tracing/Security/Event/Profile/Network point.
202
+func CommonLoggingOptions() []Option {
203
+ return []Option{
204
+ WithDotInKey(false),
205
206
0 commit comments