point

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 25 Imported by: 2

README

DataKit 采集的数据结构定义

Point

Point 是 DataKit 中最常用的一种数据表示形式,目前 Point 有两种表现形式:

  1. 行协议
  2. Protobuf

由于行协议表达能力有限,后面会逐渐迁移到 Protobuf,同时中心仍然长期支持行协议写入(不同的 API 版本)。除此之外,行协议和 Protobuf 之间并无实质性的差异,效率上而言(非极端情况):

  • 编码体积上,Protobuf 稍占上风(10% ~ 20%)
  • 编码效率上,Protobuf 在效率(~2.5 倍)和内存占用(~8 倍)上,都较行协议更好
  • 解码效率上,Protobuf 更慢一点,行协议解码更快(~1.3 倍),但其内存开销更大(~1.44 倍)。而 Protobuf 解码较慢,内存开销较小,但内存分配次数更多(可能导致碎片)。

以上测试,参见 TestSize/BenchmarkEncode/BenchmarkDecode。 可参考如下结果:

### BAD
$ CGO_CFLAGS=-Wno-undef-prefix go test -run XXX -test.benchmem -test.v -bench BenchmarkDecode

goos: darwin
goarch: arm64
pkg: github.com/GuanceCloud/cliutils/point
BenchmarkDecode
BenchmarkDecode/bench-decode-lp
BenchmarkDecode/bench-decode-lp-10         	     100	  10841921 ns/op	 5324489 B/op	   90675 allocs/op
BenchmarkDecode/bench-decode-pb
BenchmarkDecode/bench-decode-pb-10         	     268	   4428517 ns/op	 3609821 B/op	   69974 allocs/op
BenchmarkDecode/bench-decode-json
BenchmarkDecode/bench-decode-json-10       	      93	  12543126 ns/op	 6545212 B/op	  136204 allocs/op
PASS
ok  	github.com/GuanceCloud/cliutils/point	5.357s

#################
$ CGO_CFLAGS=-Wno-undef-prefix go test -run XXX -test.benchmem -test.v -bench BenchmarkDecode

goos: darwin
goarch: arm64
pkg: github.com/GuanceCloud/cliutils/point
BenchmarkDecode/bench-decode-lp
BenchmarkDecode/bench-decode-lp-10   307  3633334 ns/op 7739994 B/op   9274 allocs/op
BenchmarkDecode/bench-decode-pb
BenchmarkDecode/bench-decode-pb-10   253  4665668 ns/op 3991108 B/op  69996 allocs/op
BenchmarkDecode/bench-decode-json
BenchmarkDecode/bench-decode-json-10  75 15639139 ns/op 8177715 B/op 171342 allocs/op
PASS
ok      github.com/GuanceCloud/cliutils/point   6.102s

$ CGO_CFLAGS=-Wno-undef-prefix go test -run XXX -test.benchmem -test.v -bench BenchmarkEncode

goos: darwin
goarch: arm64
pkg: github.com/GuanceCloud/cliutils/point
BenchmarkEncode
BenchmarkEncode/bench-encode-lp
BenchmarkEncode/bench-encode-lp-10   184  6458907 ns/op 9200867 B/op 71709 allocs/op
BenchmarkEncode/bench-encode-pb
BenchmarkEncode/bench-encode-pb-10   493  2420451 ns/op 1119577 B/op  1015 allocs/op
BenchmarkEncode/bench-encode-json
BenchmarkEncode/bench-encode-json-10  94 11157400 ns/op 8557953 B/op 88206 allocs/op
PASS
ok      github.com/GuanceCloud/cliutils/point   4.816s

Point 的约束

Point 构建函数:

pt := NewPointV2(name []byte, kvs KVs, opts... Option)

NewPoint() 已 Deprecated.

由于 Point 最终需要写入后端存储,故而受到后端存储的各种限制,但原则上采集端仍然做尽量少的限制,以保证数据采集的多样性和完整性。目前 Point 限制如下(本次放开/新加的约束,粗体表示):

  1. 概念上,仍旧区分 tag 和 field。但在底层数据结构上,它们的类型一致,都是 key-value,只是在特定的 key-value 上,会标注其是否为 tag(IsTag)。可以简单理解为 tag/field 都是 key。field 概念不再重要,在这些 key-value 对中,tag 只是更特化的一种 key-value,非 tag 的 key-value 都可以视为 field。

  2. kvs 本质上是一个数组结构,在增加/删除的过程中,它一直是有序存放(以 key 排序)

  3. 同一个 point 中,tag 和 field 之间不允许出现同名的 key。这一限制主要用来确保 DQL 查询时字段的唯一性。如果 tag/field 中出现同名 key,最终的 Point 中会移除 field 中对应的 key。

  4. tag/field key 以及 value 目前不做协议上的限制,这一限制可以在应用层(比如 datakit/kodo)通过 Option 配置来控制

  5. tag/field key/value 的内容均有几个方面的限制:

    • tag key 和 value 中均不允许出现换行字符,如果出现,SDK 会将其替换成空格。如字符串 "abc\ndef" 会被替换成 "abc def"。该限制无法通过 Option 控制。
    • Point 可以没有任何 key(即可以没有 tag 和 field)。对于这样的 point,在上传过程中,自动忽略,但不会影响其它正常 point 的处理。
    • tag key 和 value 均不允许以反斜杠 \ 结尾,如果出现,SDK 会将其移除掉。如字符串 "abc\" 会被替换成 "abc"。该限制无法通过 Option 控制。
    • 对日志类数据(非时序数据)而言,tag/field 的 key 中不允许出现 . 字符,如果出现,SDK 会将其替换成 _,如字符串 "abc.def" 会被替换成 "abc_def"。该限制可以通过 Option 控制。(注:这一限制主要因后端使用 ES 作为存储所致,如果不用 ES 可以移除这一限制)
    • tag/field 个数、 各个 tag/field key/value 长度(此处特指字符串长度)均可以通过 Option 设置。
    • 某些特定的数据类型(T/L/R/O/...),可以禁用某些 key(这里的 key 是带类型的,比如对象上不允许出现 key 为 class value 为 string 类型的 key-value,但如果某个 class 字段为 int,原则上还是允许存在的),一旦出现这些 key,最终的 Point 数据中,这些 key 将被自动移除掉。
      • 所有在构建点的过程中,如果出现自动调整(比如移除某些字段),均会在最终的 point 结构中出现对应的 warning 信息(通过 point.Pretty() 可以查看)
  6. 构建 point 过程中出现的 warning/debug 信息,如果用 PB 结构上报,会一并上传到中心(kodo),中心在写入存储的时候,可以不用理会这些信息,主要是调试用

  7. tag value 目前只支持 []byte/string 两种值。对 string,底层会转成 []byte 存放

  8. field value 目前支持:

    • int8/int16/int32/uint8/uint16/uint32/ 均被转换成 int64 来处理
    • int64:最大支持 math.MaxInt64,对于大于该数值的 field,建议将其进行单位转换,避免其越界。比如字节(Byte)可以转换成 MB

      为什么此处限制了超过 1<<63 - 1 的整数?因为目前我们使用的 influxdb 版本(1.7)可能不支持 uint64

    • uint64:行协议编码时,如果该 uint64 数值小于 math.MaxInt64,会将其类型转成 int64(目前我们采用的行协议不支持 uint 解析)。否则丢弃该字段。PB 协议编码时,无此限制
    • float64:浮点数,暂无限制
    • bool:暂无限制
    • []byte/string:暂无限制
      • nil:空值字段(即什么都没有,对应各种语言里面的 null/nil/NULL 等),对于值为 nil 的 kv,编码过程中会将其丢弃
Option 说明

由于支持的数据类型较多,需要对各种数据字段做不同的约束尺度,可通过 Option 来调节这些差异。

目前可调节的维度有:

  1. 数据内容维度:

    • 字段名(tag/field)限制:有些字段名在不同的数据类型中,是保留字段,采集器在构建数据时,不应(在 Tag 和 Field 中)使用这些字段,比如对象中的 class 字段,日志中的 source 字段等。
    • 最大字段个数限制:某些情况下,需要对字段个数做限制(tag 个数和 field 个数)
    • 单个字段 key 长度限制:某些情况下,key 命名过长会违反某些存储的命名约束
    • 单个字段 value 长度限制:某些情况下,value 过长(一般是字符串)会违反某些存储的命名约束
  2. 编码维度:

    • 开启 protobuf(当前默认不开启):如果开启 protobuf,Point 数据将以 protobuf 形式被上传到中心(中心需支持对应的 API)
      • 禁用 precheck(默认不开启):如果不希望数据做任何规整,可以关闭数据检查(但最终会检查并对其做必要的数据调整)

Protobuf VS Line-Protocol

这两种不同的编码形态只影响数据的编码和解码,在日常的 point 使用过程中,基本上不用关注它们。

编解码

对一组 Point 而言,当前 SDK 提供简单的编码功能,主要用于将批量数据点变成字节流,便于网络传输。

其主要有几个特征:

  • 对 N 个数据点,支持从个数的维度对最终的字节流分包
    • 老的分包是以行协议当前字节流长度来分包,这个相对不好控制。但以点数来分包,包大小因点长度不一致,会参差不齐。但后者比前者更利于编码实现(特别是针对 Protobuf Point 而言)。
  • 支持传入一个回调函数,直接在编码过程中以类似迭代器的方式进行数据处理

示例:

import (
	"github.com/GuanceCloud/cliutils/point"
)

enc := GetEncoder(WithEncEncoding(Protobuf),
	WithEncBatchSize(100)) // 100 point
defer PutEncoder(enc)

bufs, err := enc.Encode(points)
if err != nil {
	// error handling
}

for _, buf := range bufs {
	// send them to somewhere
}
解码

解码主要用于服务端用来处理外部输入的字节流数据,解码的时候需要提供对应的 option,用来指示输入的字节流是行协议还是 protobuf:

import (
	"github.com/GuanceCloud/cliutils/point"
)

dec := GetDecoder(WithDecEncoding(Protobuf)) // set encoding to protobuf
defer PutDecoder(dec)

points, err := dec.Decode(buffer)
if err != nil {
	// error handling
}

for _, p := range points {
	// do something with p
}

如果 data 格式有问题,对行协议而言,一般的解析错误为:

lineproto parse error: missing tag value

当前 SDK 对行协议报错做了简化,报错中不再会报告原始数据,影响阅读。但在 Decoder 中增加了一个 DetailedError 字段,用来保留原始行协议解析的错误信息。

而 Protobuf 解析错误为:

proto: cannot parse invalid wire-format data

DataKit 端的 Point 运行机制

DataKit 对采集到的数据原则上不做任何约束,即只要符合基本 Point 结构,都支持上传到中心,所谓 Point 结构指:

  • measurement:指标集名称,不允许出现非 ascii 字符。如果出现,会对其 base64 编码
  • kvs:该 Point 对应的一组 key-value 值(数组),某些 key-value 可以被标注为 tag
  • time:该 Point 对应的时间。time 实际上不是必须的,中心可以用接受时间作为 Point 时间(虽然不准)

Documentation

Overview

Package point implements datakits basic data structure.

Index

Constants

View Source
const (
	UnknownCategory Category = iota
	DynamicDWCategory
	MetricDeprecated

	Metric
	Network
	KeyEvent
	Object
	CustomObject
	Logging
	Tracing
	RUM
	Security
	Profiling

	SUnknownCategory   = "unknown"
	SDynamicDWCategory = "dynamic_dw" // NOTE: not used
	SMetric            = "metric"
	SMetricDeprecated  = "metrics"
	SNetwork           = "network"
	SKeyEvent          = "keyevent"
	SObject            = "object"
	SCustomObject      = "custom_object"
	SLogging           = "logging"
	STracing           = "tracing"
	SRUM               = "rum"
	SSecurity          = "security"
	SProfiling         = "profiling"

	URLUnknownCategory   = "/v1/write/unknown"
	URLDynamicDWCategory = "/v1/write/dynamic_dw" // NOTE: not used
	URLMetric            = "/v1/write/metric"
	URLMetricDeprecated  = "/v1/write/metrics"
	URLNetwork           = "/v1/write/network"
	URLKeyEvent          = "/v1/write/keyevent"
	URLObject            = "/v1/write/object"
	URLCustomObject      = "/v1/write/custom_object"
	URLLogging           = "/v1/write/logging"
	URLTracing           = "/v1/write/tracing"
	URLRUM               = "/v1/write/rum"
	URLSecurity          = "/v1/write/security"
	URLProfiling         = "/v1/write/profiling"

	CUnknown   = "UNKNOWN"
	CDynamicDW = "DYNAMIC_DW"
	CM         = "M"
	CN         = "N"
	CE         = "E"
	CO         = "O"
	CCO        = "CO"
	CL         = "L"
	CT         = "T"
	CR         = "R"
	CS         = "S"
	CP         = "P"
)
View Source
const (
	WarnMaxTags               = "exceed_max_tags"
	WarnMaxFields             = "exceed_max_fields"
	WarnNoField               = "no_field"
	WarnMaxTagKeyLen          = "exceed_max_tag_key_len"
	WarnMaxTagValueLen        = "exceed_max_tag_value_len"
	WarnMaxFieldKeyLen        = "exceed_max_field_key_len"
	WarnMaxFieldValueLen      = "exceed_max_field_value_len"
	WarnMaxFieldValueInt      = "exceed_max_field_value_int"
	WarnInvalidUTF8String     = "invalid_utf8_string"
	WarnMaxTagKeyValueCompose = "exceed_max_tag_key_value_compose"

	WarnInvalidTagKey         = "invalid_tag_key"
	WarnInvalidTagValue       = "invalid_tag_value"
	WarnInvalidMeasurement    = "invalid_measurement"
	WarnInvalidFieldValueType = "invalid_field_value_type"
	WarnAddRequiredKV         = "add_required_kv"

	WarnFieldDisabled = "field_disabled"
	WarnTagDisabled   = "tag_disabled"

	WarnSameTagFieldKey = "same_tag_field_key"
	WarnDotInkey        = "dot_in_key"
	WarnFieldB64Encoded = "field_base64_encoded"
	WarnNilField        = "nil_field"
)

Point warnnings.

View Source
const (
	Psent  = 1 << iota // The Point has been sent
	Ppb                // the point is Protobuf point
	Pcheck             // checked

)
View Source
const (
	EnvDefaultEncoding = "ENV_DEFAULT_ENCODING"
)

Variables

View Source
var (
	ErrNoFields            = errors.New("no fields")
	ErrInvalidLineProtocol = errors.New("invalid lineprotocol")
)
View Source
var (
	KeyType_name = map[int32]string{
		0: "X",
		1: "I",
		2: "U",
		3: "F",
		4: "B",
		5: "D",
		6: "NIL",
		7: "S",
		8: "A",
	}
	KeyType_value = map[string]int32{
		"X":   0,
		"I":   1,
		"U":   2,
		"F":   3,
		"B":   4,
		"D":   5,
		"NIL": 6,
		"S":   7,
		"A":   8,
	}
)

Enum value maps for KeyType.

View Source
var (
	MetricType_name = map[int32]string{
		0: "UNSPECIFIED",
		1: "COUNT",
		2: "RATE",
		3: "GAUGE",
	}
	MetricType_value = map[string]int32{
		"UNSPECIFIED": 0,
		"COUNT":       1,
		"RATE":        2,
		"GAUGE":       3,
	}
)

Enum value maps for MetricType.

View Source
var (
	DefaultMeasurementName = "__default"

	KeyTime        = NewKey("time", KeyType_I)
	KeyMeasurement = NewKey("measurement", KeyType_S)
	KeySource      = NewKey("source", KeyType_S)
	KeyClass       = NewKey("class", KeyType_S)
	KeyDate        = NewKey("date", KeyType_I)

	KeyName   = NewKey("name", KeyType_D, []byte(defaultObjectName))
	KeyStatus = NewKey("status", KeyType_D, []byte(defaultLoggingStatus))
)
View Source
var (
	DefaultEncoding = LineProtocol
)
View Source
var File_point_proto protoreflect.FileDescriptor

Functions

func AnyRaw added in v0.1.6

func AnyRaw(x *anypb.Any) (any, error)

AnyRaw get underlying wrapped value within anypb.

func GetCfg

func GetCfg(opts ...Option) *cfg

func MustAnyRaw added in v0.1.6

func MustAnyRaw(x *anypb.Any) any

MustAnyRaw get underlying wrapped value, and panic if any error.

func MustNewAny added in v0.1.6

func MustNewAny(x proto.Message) *anypb.Any

MustNewAny create anypb based on exist proto message, and panic if any error.

func MustNewAnyArray added in v0.1.6

func MustNewAnyArray(a ...any) *anypb.Any

MustNewAnyArray wrapped mix-basic-typed list into anypb.Any, and panic if any error.

func MustNewBoolArray added in v0.1.6

func MustNewBoolArray(b ...bool) *anypb.Any

MustNewBoolArray wrapped boolean list into anypb.Any, and panic if any error.

func MustNewFloatArray added in v0.1.6

func MustNewFloatArray[T float32 | float64](f ...T) *anypb.Any

MustNewFloatArray wrapped float list into anypb.Any, and panic if any error.

func MustNewIntArray added in v0.1.6

func MustNewIntArray[T int8 | int16 | int | int32 | int64](i ...T) *anypb.Any

MustNewIntArray wrapped signed int list into anypb.Any, and panic if any error.

func MustNewStringArray added in v0.1.6

func MustNewStringArray(s ...string) *anypb.Any

MustNewStringArray wrapped string list into anypb.Any, and panic if any error.

func MustNewUintArray added in v0.1.6

func MustNewUintArray[T uint16 | uint | uint32 | uint64](i ...T) *anypb.Any

MustNewUintArray wrapped unsigned int list into anypb.Any, and panic if any error.

func NewAny added in v0.1.6

func NewAny(x proto.Message) (*anypb.Any, error)

NewAny create anypb based on exist proto message.

func NewAnyArray added in v0.1.6

func NewAnyArray(a ...any) (*anypb.Any, error)

NewAnyArray wrapped mix-basic-typed list into anypb.Any.

func NewBoolArray added in v0.1.6

func NewBoolArray(b ...bool) (*anypb.Any, error)

NewBoolArray wrapped boolean list into anypb.Any.

func NewFloatArray added in v0.1.6

func NewFloatArray[T float32 | float64](f ...T) (*anypb.Any, error)

NewFloatArray wrapped float list into anypb.Any.

func NewIntArray added in v0.1.6

func NewIntArray[T int8 | int16 | int | int32 | int64](i ...T) (*anypb.Any, error)

NewIntArray wrapped signed int list into anypb.Any.

func NewRander

func NewRander(opts ...RandOption) *ptRander

func NewStringArray added in v0.1.6

func NewStringArray(s ...string) (*anypb.Any, error)

NewStringArray wrapped string list into anypb.Any.

func NewUintArray added in v0.1.6

func NewUintArray[T uint16 | uint | uint32 | uint64](i ...T) (*anypb.Any, error)

NewUintArray wrapped unsigned int list into anypb.Any.

func PB2LP

func PB2LP(pb []byte) (lp []byte, err error)

PB2LP convert protobuf Point to line-protocol Point.

func PutCfg

func PutCfg(c *cfg)

func PutDecoder

func PutDecoder(d *Decoder)

func PutEncoder

func PutEncoder(e *Encoder)

func SortByTime added in v0.1.6

func SortByTime(pts []*Point)

SortByTime sort(ASC) pts according to time.

Types

type AnyDemo

type AnyDemo struct {
	Demo string `protobuf:"bytes,1,opt,name=demo,proto3" json:"demo,omitempty"`
	// contains filtered or unexported fields
}

example of pb.Any

func (*AnyDemo) Descriptor deprecated

func (*AnyDemo) Descriptor() ([]byte, []int)

Deprecated: Use AnyDemo.ProtoReflect.Descriptor instead.

func (*AnyDemo) GetDemo

func (x *AnyDemo) GetDemo() string

func (*AnyDemo) ProtoMessage

func (*AnyDemo) ProtoMessage()

func (*AnyDemo) ProtoReflect

func (x *AnyDemo) ProtoReflect() protoreflect.Message

func (*AnyDemo) Reset

func (x *AnyDemo) Reset()

func (*AnyDemo) String

func (x *AnyDemo) String() string

type Array added in v0.1.6

type Array struct {
	Arr []*BasicTypes `protobuf:"bytes,1,rep,name=arr,proto3" json:"arr,omitempty"`
	// contains filtered or unexported fields
}

func NewArray added in v0.1.6

func NewArray(ents ...any) (arr *Array, err error)

NewArray create array value that can be used in point field. The types within ents can be mixed basic types.

func (*Array) Descriptor deprecated added in v0.1.6

func (*Array) Descriptor() ([]byte, []int)

Deprecated: Use Array.ProtoReflect.Descriptor instead.

func (*Array) GetArr added in v0.1.6

func (x *Array) GetArr() []*BasicTypes

func (*Array) ProtoMessage added in v0.1.6

func (*Array) ProtoMessage()

func (*Array) ProtoReflect added in v0.1.6

func (x *Array) ProtoReflect() protoreflect.Message

func (*Array) Reset added in v0.1.6

func (x *Array) Reset()

func (*Array) String added in v0.1.6

func (x *Array) String() string

type BasicTypes added in v0.1.6

type BasicTypes struct {

	// Types that are assignable to X:
	//	*BasicTypes_I
	//	*BasicTypes_U
	//	*BasicTypes_F
	//	*BasicTypes_B
	//	*BasicTypes_D
	//	*BasicTypes_S
	X isBasicTypes_X `protobuf_oneof:"x"`
	// contains filtered or unexported fields
}

func (*BasicTypes) Descriptor deprecated added in v0.1.6

func (*BasicTypes) Descriptor() ([]byte, []int)

Deprecated: Use BasicTypes.ProtoReflect.Descriptor instead.

func (*BasicTypes) GetB added in v0.1.6

func (x *BasicTypes) GetB() bool

func (*BasicTypes) GetD added in v0.1.6

func (x *BasicTypes) GetD() []byte

func (*BasicTypes) GetF added in v0.1.6

func (x *BasicTypes) GetF() float64

func (*BasicTypes) GetI added in v0.1.6

func (x *BasicTypes) GetI() int64

func (*BasicTypes) GetS added in v0.1.6

func (x *BasicTypes) GetS() string

func (*BasicTypes) GetU added in v0.1.6

func (x *BasicTypes) GetU() uint64

func (*BasicTypes) GetX added in v0.1.6

func (m *BasicTypes) GetX() isBasicTypes_X

func (*BasicTypes) ProtoMessage added in v0.1.6

func (*BasicTypes) ProtoMessage()

func (*BasicTypes) ProtoReflect added in v0.1.6

func (x *BasicTypes) ProtoReflect() protoreflect.Message

func (*BasicTypes) Reset added in v0.1.6

func (x *BasicTypes) Reset()

func (*BasicTypes) String added in v0.1.6

func (x *BasicTypes) String() string

type BasicTypes_B added in v0.1.6

type BasicTypes_B struct {
	B bool `protobuf:"varint,4,opt,name=b,proto3,oneof"` // bool
}

type BasicTypes_D added in v0.1.6

type BasicTypes_D struct {
	D []byte `protobuf:"bytes,5,opt,name=d,proto3,oneof"` // bytes, for binary data
}

type BasicTypes_F added in v0.1.6

type BasicTypes_F struct {
	F float64 `protobuf:"fixed64,3,opt,name=f,proto3,oneof"` // float64
}

type BasicTypes_I added in v0.1.6

type BasicTypes_I struct {
	I int64 `protobuf:"varint,1,opt,name=i,proto3,oneof"` // signed int
}

type BasicTypes_S added in v0.1.6

type BasicTypes_S struct {
	S string `protobuf:"bytes,6,opt,name=s,proto3,oneof"` // string, for string data
}

type BasicTypes_U added in v0.1.6

type BasicTypes_U struct {
	U uint64 `protobuf:"varint,2,opt,name=u,proto3,oneof"` // unsigned int
}

type Callback

type Callback func(*Point) (*Point, error)

type Category

type Category int

func AllCategories

func AllCategories() []Category

func CatAlias

func CatAlias(c string) Category

func CatString

func CatString(c string) Category

func CatURL

func CatURL(c string) Category

func (Category) Alias

func (c Category) Alias() string

func (Category) String

func (c Category) String() string

func (Category) URL

func (c Category) URL() string

type Debug

type Debug struct {
	Info string `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	// contains filtered or unexported fields
}

Debug used to attached some debug info for the point, these debug info will encoded into payload, storage can take optional handle on these debug info.

func (*Debug) Descriptor deprecated

func (*Debug) Descriptor() ([]byte, []int)

Deprecated: Use Debug.ProtoReflect.Descriptor instead.

func (*Debug) GetInfo

func (x *Debug) GetInfo() string

func (*Debug) ProtoMessage

func (*Debug) ProtoMessage()

func (*Debug) ProtoReflect

func (x *Debug) ProtoReflect() protoreflect.Message

func (*Debug) Reset

func (x *Debug) Reset()

func (*Debug) String

func (x *Debug) String() string

type DecodeFn

type DecodeFn func([]*Point) error

DecodeFn used to iterate on []*Point payload, if error returned, the iterate terminated.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func GetDecoder

func GetDecoder(opts ...DecoderOption) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(data []byte, opts ...Option) ([]*Point, error)

func (*Decoder) DetailedError

func (d *Decoder) DetailedError() error

type DecoderOption

type DecoderOption func(e *Decoder)

func WithDecEncoding

func WithDecEncoding(enc Encoding) DecoderOption

func WithDecFn

func WithDecFn(fn DecodeFn) DecoderOption

type EncodeFn

type EncodeFn func(batchSize int, payload []byte) error

EncodeFn used to iterate on []*Point payload, if error returned, the iterate terminated.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func GetEncoder

func GetEncoder(opts ...EncoderOption) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(pts []*Point) ([][]byte, error)

Encode get bytes form of multiple Points, often used to Write to somewhere(file/network/...), batchSize used to split huge points into multiple part. Set batchSize to 0 to disable the split.

type EncoderOption

type EncoderOption func(e *Encoder)

func WithEncBatchBytes added in v0.1.6

func WithEncBatchBytes(bytes int) EncoderOption

func WithEncBatchSize

func WithEncBatchSize(size int) EncoderOption

func WithEncEncoding

func WithEncEncoding(enc Encoding) EncoderOption

func WithEncFn

func WithEncFn(fn EncodeFn) EncoderOption

type Encoding

type Encoding int
const (
	LineProtocol Encoding = iota
	Protobuf
	JSON
)

func EncodingStr

func EncodingStr(s string) Encoding

EncodingStr convert encoding-string in configure file to encoding enum.

Here v1/v2 are alias for lineprotocol and protobuf, this makes people easy to switch between lineprotocol and protobuf. For json, you should not configure json encoding in production environments(json do not classify int and float).

func HTTPContentType added in v0.1.5

func HTTPContentType(ct string) Encoding

func (Encoding) HTTPContentType added in v0.1.5

func (e Encoding) HTTPContentType() string

func (Encoding) String added in v0.1.5

func (e Encoding) String() string

type Field

type Field struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // field name
	// See https://developers.google.com/protocol-buffers/docs/proto3#json
	//
	// Types that are assignable to Val:
	//	*Field_I
	//	*Field_U
	//	*Field_F
	//	*Field_B
	//	*Field_D
	//	*Field_S
	//	*Field_A
	Val   isField_Val `protobuf_oneof:"val"`
	IsTag bool        `protobuf:"varint,8,opt,name=is_tag,proto3" json:"is_tag,omitempty"` // set field as a tag or not
	Type  MetricType  `protobuf:"varint,9,opt,name=type,proto3,enum=point.MetricType" json:"type,omitempty"`
	// field unit name
	Unit string `protobuf:"bytes,10,opt,name=unit,proto3" json:"unit,omitempty"` // metric unit, such as bytes(B), duration(ms/us) and so on.
	// contains filtered or unexported fields
}

func NewKV

func NewKV(k string, v any, opts ...KVOption) *Field

NewKV get kv from specified key and value.

func (*Field) Descriptor deprecated

func (*Field) Descriptor() ([]byte, []int)

Deprecated: Use Field.ProtoReflect.Descriptor instead.

func (*Field) GetA

func (x *Field) GetA() *anypb.Any

func (*Field) GetB

func (x *Field) GetB() bool

func (*Field) GetD

func (x *Field) GetD() []byte

func (*Field) GetF

func (x *Field) GetF() float64

func (*Field) GetI

func (x *Field) GetI() int64

func (*Field) GetIsTag

func (x *Field) GetIsTag() bool

func (*Field) GetKey

func (x *Field) GetKey() string

func (*Field) GetS added in v0.1.6

func (x *Field) GetS() string

func (*Field) GetType

func (x *Field) GetType() MetricType

func (*Field) GetU

func (x *Field) GetU() uint64

func (*Field) GetUnit

func (x *Field) GetUnit() string

func (*Field) GetVal

func (m *Field) GetVal() isField_Val

func (*Field) ProtoMessage

func (*Field) ProtoMessage()

func (*Field) ProtoReflect

func (x *Field) ProtoReflect() protoreflect.Message

func (*Field) Raw added in v0.1.6

func (kv *Field) Raw() any

Raw return underlying raw data.

func (*Field) Reset

func (x *Field) Reset()

func (*Field) String

func (x *Field) String() string

type Field_A

type Field_A struct {
	// XXX: not used
	A *anypb.Any `protobuf:"bytes,7,opt,name=a,proto3,oneof"` // any data
}

type Field_B

type Field_B struct {
	B bool `protobuf:"varint,5,opt,name=b,proto3,oneof"` // bool
}

type Field_D

type Field_D struct {
	D []byte `protobuf:"bytes,6,opt,name=d,proto3,oneof"` // bytes, for binary data
}

type Field_F

type Field_F struct {
	F float64 `protobuf:"fixed64,4,opt,name=f,proto3,oneof"` // float64
}

type Field_I

type Field_I struct {
	I int64 `protobuf:"varint,2,opt,name=i,proto3,oneof"` // signed int
}

type Field_S added in v0.1.6

type Field_S struct {
	S string `protobuf:"bytes,11,opt,name=s,proto3,oneof"` // string, for string data
}

type Field_U

type Field_U struct {
	U uint64 `protobuf:"varint,3,opt,name=u,proto3,oneof"` // unsigned int
}

type JSONPoint

type JSONPoint struct {
	// Requride
	Measurement string `json:"measurement"`

	// Optional
	Tags map[string]string `json:"tags,omitempty"`

	// Requride
	Fields map[string]interface{} `json:"fields"`

	// Unix nanosecond
	Time int64 `json:"time,omitempty"`
}

func (*JSONPoint) Point

func (jp *JSONPoint) Point(opts ...Option) (*Point, error)

type KVOption

type KVOption func(kv *Field)

func WithKVTagSet

func WithKVTagSet(on bool) KVOption

func WithKVType

func WithKVType(t MetricType) KVOption

func WithKVUnit

func WithKVUnit(u string) KVOption

type KVs

type KVs []*Field

func NewKVs

func NewKVs(kvs map[string]interface{}) (res KVs)

NewKVs create kvs slice from map structure.

func NewTags

func NewTags(tags map[string]string) (arr KVs)

NewTags create tag kvs from map structure.

func (KVs) Add

func (x KVs) Add(k string, v any, isTag, force bool) KVs

Add add new field

If force enabled, overwrite exist key.

func (KVs) AddKV

func (x KVs) AddKV(kv *Field, force bool) KVs

func (KVs) AddTag

func (x KVs) AddTag(k, v string) KVs

func (KVs) Del

func (x KVs) Del(k string) KVs

Del delete specified k.

func (KVs) FieldCount

func (x KVs) FieldCount() (i int)

func (KVs) Fields

func (x KVs) Fields() (arr KVs)

func (KVs) Get

func (x KVs) Get(k string) *Field

Get get k's value, if k not exist, return nil.

func (KVs) GetTag

func (x KVs) GetTag(k string) string

GetTag get tag k's value, if the tag not exist, return nil.

func (KVs) Has

func (x KVs) Has(k string) bool

Has test if k exist.

func (KVs) InfluxFields

func (x KVs) InfluxFields() map[string]any

InfluxFields convert KVs to map structure.

func (KVs) InfluxTags

func (x KVs) InfluxTags() (res influxm.Tags)

InfluxTags convert tag KVs to map structure.

func (KVs) Keys

func (x KVs) Keys() *Keys

Keys get k's value, if k not exist, return nil.

func (KVs) Len

func (x KVs) Len() int

func (KVs) Less

func (x KVs) Less(i, j int) bool

func (KVs) MustAddKV

func (x KVs) MustAddKV(kv *Field) KVs

func (KVs) MustAddTag

func (x KVs) MustAddTag(k, v string) KVs

func (KVs) Pretty

func (x KVs) Pretty() string

func (KVs) Swap

func (x KVs) Swap(i, j int)

func (KVs) TagCount

func (x KVs) TagCount() (i int)

func (KVs) Tags

func (x KVs) Tags() (arr KVs)

func (KVs) TrimFields

func (x KVs) TrimFields(n int) (arr KVs)

TrimFields keep max-n field kvs.

func (KVs) TrimTags

func (x KVs) TrimTags(n int) (arr KVs)

TrimTags keep max-n tag kvs.

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key is the key-name and it's type composite.

func KVKey

func KVKey(f *Field) *Key

func NewKey

func NewKey(k string, t KeyType, defaultVal ...any) *Key

NewKey create Key.

func NewTagKey

func NewTagKey(k string, defaultVal string) *Key

NewTagKey create tag key with type []byte.

func (*Key) Default

func (k *Key) Default() any

Default get key's default value.

func (*Key) Key

func (k *Key) Key() string

Key get key-name.

func (*Key) Type

func (k *Key) Type() KeyType

Type get key-type.

type KeyType

type KeyType int32
const (
	KeyType_X   KeyType = 0 // unknown
	KeyType_I   KeyType = 1
	KeyType_U   KeyType = 2
	KeyType_F   KeyType = 3
	KeyType_B   KeyType = 4
	KeyType_D   KeyType = 5
	KeyType_NIL KeyType = 6
	KeyType_S   KeyType = 7
	KeyType_A   KeyType = 8
)

func PBType

func PBType(v isField_Val) KeyType

func (KeyType) Descriptor

func (KeyType) Descriptor() protoreflect.EnumDescriptor

func (KeyType) Enum

func (x KeyType) Enum() *KeyType

func (KeyType) EnumDescriptor deprecated

func (KeyType) EnumDescriptor() ([]byte, []int)

Deprecated: Use KeyType.Descriptor instead.

func (KeyType) Number

func (x KeyType) Number() protoreflect.EnumNumber

func (KeyType) String

func (x KeyType) String() string

func (KeyType) Type

func (KeyType) Type() protoreflect.EnumType

type Keys

type Keys struct {
	// contains filtered or unexported fields
}

Keys is sorted Keys.

func (*Keys) Add

func (x *Keys) Add(k *Key)

Add add specific k. if key & type exist, do nothing.

func (*Keys) Del

func (x *Keys) Del(k *Key)

Del remove specific k.

func (*Keys) Has

func (x *Keys) Has(k *Key) bool

Has test if k exist.

func (*Keys) Hash

func (x *Keys) Hash() uint64

Hash calculate x's hash.

func (*Keys) Len

func (x *Keys) Len() int

func (*Keys) Less

func (x *Keys) Less(i, j int) bool

func (*Keys) Pretty

func (x *Keys) Pretty() string

Pretty get pretty showing of all keys.

func (*Keys) Swap

func (x *Keys) Swap(i, j int)

type Map added in v0.1.6

type Map struct {
	Map map[string]*BasicTypes `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

func MustNewMap added in v0.1.6

func MustNewMap(ents map[string]any) *Map

MustNewMap create map value that can be used in point field, and panic if any error.

func NewMap added in v0.1.6

func NewMap(ents map[string]any) (dict *Map, err error)

NewMap create map value that can be used in point field.

func (*Map) Descriptor deprecated added in v0.1.6

func (*Map) Descriptor() ([]byte, []int)

Deprecated: Use Map.ProtoReflect.Descriptor instead.

func (*Map) GetMap added in v0.1.6

func (x *Map) GetMap() map[string]*BasicTypes

func (*Map) ProtoMessage added in v0.1.6

func (*Map) ProtoMessage()

func (*Map) ProtoReflect added in v0.1.6

func (x *Map) ProtoReflect() protoreflect.Message

func (*Map) Reset added in v0.1.6

func (x *Map) Reset()

func (*Map) String added in v0.1.6

func (x *Map) String() string

type MetricType

type MetricType int32
const (
	MetricType_UNSPECIFIED MetricType = 0
	MetricType_COUNT       MetricType = 1
	MetricType_RATE        MetricType = 2
	MetricType_GAUGE       MetricType = 3
)

func (MetricType) Descriptor

func (MetricType) Descriptor() protoreflect.EnumDescriptor

func (MetricType) Enum

func (x MetricType) Enum() *MetricType

func (MetricType) EnumDescriptor deprecated

func (MetricType) EnumDescriptor() ([]byte, []int)

Deprecated: Use MetricType.Descriptor instead.

func (MetricType) Number

func (x MetricType) Number() protoreflect.EnumNumber

func (MetricType) String

func (x MetricType) String() string

func (MetricType) Type

type Option

type Option func(*cfg)

func CommonLoggingOptions added in v0.1.1

func CommonLoggingOptions() []Option

CommonLoggingOptions defined options on RUM/Tracing/Security/Event/Profile/Network point.

func DefaultLoggingOptions

func DefaultLoggingOptions() []Option

DefaultLoggingOptions defined options on Logging point.

func DefaultMetricOptions

func DefaultMetricOptions() []Option

DefaultMetricOptions defined options on Metric point.

func DefaultMetricOptionsForInflux1X

func DefaultMetricOptionsForInflux1X() []Option

DefaultMetricOptionsForInflux1X get influxdb 1.x options. For influxdb 1.x, uint64 not support.

func DefaultObjectOptions

func DefaultObjectOptions() []Option

DefaultObjectOptions defined options on Object/CustomObject point.

func WithCallback

func WithCallback(fn Callback) Option

func WithDisabledKeys

func WithDisabledKeys(keys ...*Key) Option

func WithDotInKey

func WithDotInKey(on bool) Option

func WithEncoding

func WithEncoding(enc Encoding) Option

func WithExtraTags

func WithExtraTags(tags map[string]string) Option

func WithKeySorted added in v0.1.6

func WithKeySorted(on bool) Option

func WithMaxFieldKeyLen

func WithMaxFieldKeyLen(n int) Option

func WithMaxFieldValLen

func WithMaxFieldValLen(n int) Option

func WithMaxFields

func WithMaxFields(n int) Option

func WithMaxKVComposeLen

func WithMaxKVComposeLen(n int) Option

func WithMaxMeasurementLen

func WithMaxMeasurementLen(n int) Option

func WithMaxTagKeyLen

func WithMaxTagKeyLen(n int) Option

func WithMaxTagValLen

func WithMaxTagValLen(n int) Option

func WithMaxTags

func WithMaxTags(n int) Option

func WithPrecheck

func WithPrecheck(on bool) Option

func WithPrecision

func WithPrecision(p Precision) Option

func WithRequiredKeys

func WithRequiredKeys(keys ...*Key) Option

func WithStrField

func WithStrField(on bool) Option

func WithTime

func WithTime(t time.Time) Option

func WithU64Field

func WithU64Field(on bool) Option

type PBPoint

type PBPoint struct {
	Name   string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Fields []*Field `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"`
	Time   int64    `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"`
	// Auxiliary fields for the point, they should not
	// write to the final storage on production.
	Warns  []*Warn  `protobuf:"bytes,4,rep,name=warns,proto3" json:"warns,omitempty"`
	Debugs []*Debug `protobuf:"bytes,5,rep,name=debugs,proto3" json:"debugs,omitempty"`
	// contains filtered or unexported fields
}

func (*PBPoint) Descriptor deprecated

func (*PBPoint) Descriptor() ([]byte, []int)

Deprecated: Use PBPoint.ProtoReflect.Descriptor instead.

func (*PBPoint) GetDebugs

func (x *PBPoint) GetDebugs() []*Debug

func (*PBPoint) GetFields

func (x *PBPoint) GetFields() []*Field

func (*PBPoint) GetName

func (x *PBPoint) GetName() string

func (*PBPoint) GetTime

func (x *PBPoint) GetTime() int64

func (*PBPoint) GetWarns

func (x *PBPoint) GetWarns() []*Warn

func (*PBPoint) ProtoMessage

func (*PBPoint) ProtoMessage()

func (*PBPoint) ProtoReflect

func (x *PBPoint) ProtoReflect() protoreflect.Message

func (*PBPoint) Reset

func (x *PBPoint) Reset()

func (*PBPoint) String

func (x *PBPoint) String() string

type PBPoints

type PBPoints struct {
	Arr []*PBPoint `protobuf:"bytes,1,rep,name=arr,proto3" json:"arr,omitempty"`
	// contains filtered or unexported fields
}

batch of pbpoint.

func RandPBPoints

func RandPBPoints(count int) *PBPoints

RandPBPoints deprecated.

func (*PBPoints) Descriptor deprecated

func (*PBPoints) Descriptor() ([]byte, []int)

Deprecated: Use PBPoints.ProtoReflect.Descriptor instead.

func (*PBPoints) GetArr

func (x *PBPoints) GetArr() []*PBPoint

func (*PBPoints) ProtoMessage

func (*PBPoints) ProtoMessage()

func (*PBPoints) ProtoReflect

func (x *PBPoints) ProtoReflect() protoreflect.Message

func (*PBPoints) Reset

func (x *PBPoints) Reset()

func (*PBPoints) String

func (x *PBPoints) String() string

type Point

type Point struct {
	// contains filtered or unexported fields
}

func FromJSONPoint

func FromJSONPoint(j *JSONPoint) *Point

func FromLP

func FromLP(lp influxm.Point) *Point

func FromModelsLP

func FromModelsLP(lp influxm.Point) *Point

func FromPB

func FromPB(pb *PBPoint) *Point

func FromPBJson

func FromPBJson(j []byte) (*Point, error)

func MustFromPBJson

func MustFromPBJson(j []byte) *Point

func NewLPPoint

func NewLPPoint(lp influxm.Point) *Point

NewLPPoint create Point based on a lineproto point.

func NewPoint deprecated

func NewPoint(name string, tags map[string]string, fields map[string]any, opts ...Option) (*Point, error)

NewPoint returns a new Point given name(measurement), tags, fields and optional options.

If fields empty(or nil), error ErrNoField will returned.

Values in fields only allowed for int/uint(8-bit/16-bit/32-bit/64-bit), string, bool, float(32-bit/64-bit) and []byte, other types are ignored.

Deprecated: use NewPointV2.

func NewPointV2

func NewPointV2(name string, kvs KVs, opts ...Option) *Point

func RandPoints

func RandPoints(count int) []*Point

RandPoints deprecated.

func WrapPoint

func WrapPoint(pts []influxm.Point) (arr []*Point)

WrapPoint wrap lagacy line-protocol point into Point.

func (*Point) Add

func (p *Point) Add(k string, v any)

Add add specific key value to fields, if k exist, do nothing.

func (*Point) AddDebug

func (p *Point) AddDebug(d *Debug)

func (*Point) AddKV

func (p *Point) AddKV(kv *Field)

AddKV add kv, if the key exist, do nothing.

func (*Point) AddTag

func (p *Point) AddTag(k, v string)

AddTag add specific key value to fields, if k exist, do nothing.

func (*Point) ClearFlag

func (p *Point) ClearFlag(f uint64)

ClearFlag clear specific bit.

func (*Point) Del

func (p *Point) Del(k string)

Del delete specific key from tags/fields.

func (*Point) Equal

func (p *Point) Equal(x *Point) bool

Equal test if two point are the same. Equality test NOT check on warns and debugs. If two points equal, they have the same ID(MD5/Sha256), but same ID do not means they are equal.

func (*Point) EqualWithReason

func (p *Point) EqualWithReason(x *Point) (bool, string)

func (*Point) Fields

func (p *Point) Fields() (arr KVs)

Fields return point's key-values except tags.

func (*Point) Get

func (p *Point) Get(k string) any

Get get specific key from point.

func (*Point) GetTag

func (p *Point) GetTag(k string) string

GetTag get value of tag k. If key k not tag or k not eixst, return nil.

func (*Point) HasFlag

func (p *Point) HasFlag(f uint) bool

HasFlag test if specific bit set.

func (*Point) InfluxFields

func (p *Point) InfluxFields() map[string]any

InfluxFields convert fields to map structure.

func (*Point) InfluxTags

func (p *Point) InfluxTags() influxm.Tags

InfluxTags convert tags to map structure.

func (*Point) KVMap added in v0.1.6

func (p *Point) KVMap() map[string]any

KVMap return all key-value in map.

func (*Point) KVs

func (p *Point) KVs() (arr KVs)

KVs return point's all key-values.

func (*Point) Keys

func (p *Point) Keys() *Keys

Keys get points all keys.

func (*Point) LPPoint

func (p *Point) LPPoint() (influxm.Point, error)

LPPoint get line-protocol part of the point.

func (*Point) LPSize

func (p *Point) LPSize() int

LPSize get point line-protocol size.

func (*Point) LineProto

func (p *Point) LineProto(prec ...Precision) string

LineProto convert point to text lineprotocol(both for lineproto point and protobuf point).

func (*Point) MD5

func (p *Point) MD5() string

MD5 get point MD5 id.

func (*Point) MapTags added in v0.1.6

func (p *Point) MapTags() map[string]string

MapTags convert all key-value to map.

func (*Point) MarshalJSON

func (p *Point) MarshalJSON() ([]byte, error)

MarshalJSON to protobuf json.

func (*Point) MustAdd

func (p *Point) MustAdd(k string, v any)

MustAdd add specific key value to fields, if k exist, override it.

func (*Point) MustAddKV

func (p *Point) MustAddKV(kv *Field)

MustAddKV add kv, if the key exist, override it.

func (*Point) MustAddTag

func (p *Point) MustAddTag(k, v string)

MustAddTag add specific key value to fields, if k exist, override it.

func (*Point) MustLPPoint added in v0.1.6

func (p *Point) MustLPPoint() influxm.Point

func (*Point) Name

func (p *Point) Name() string

Name return point's measurement name.

func (*Point) PBJson

func (p *Point) PBJson() ([]byte, error)

func (*Point) PBJsonPretty

func (p *Point) PBJsonPretty() ([]byte, error)

func (*Point) PBPoint

func (p *Point) PBPoint() *PBPoint

PBPoint create Point based on a protobuf point.

func (*Point) PBSize

func (p *Point) PBSize() int

PBSize get point protobuf size.

func (*Point) Pretty

func (p *Point) Pretty() string

Pretty get string representation of point, suffixed with all warning(if any) during build the point.

func (*Point) SetFlag

func (p *Point) SetFlag(f uint)

SetFlag set specific bit.

func (*Point) SetName

func (p *Point) SetName(name string)

func (*Point) SetTime

func (p *Point) SetTime(t time.Time)

func (*Point) Sha256

func (p *Point) Sha256() string

Sha256 get point Sha256 id.

func (*Point) Size

func (p *Point) Size() int

Size get underling data size in byte(exclude warning/debug info).

func (*Point) Tags

func (p *Point) Tags() (arr KVs)

Tags return point's key-values except fields.

func (*Point) Time

func (p *Point) Time() time.Time

Time return point's time.

func (*Point) UnmarshalJSON

func (p *Point) UnmarshalJSON(j []byte) error

UnmarshalJSON unmarshal protobuf json.

func (*Point) Warns

func (p *Point) Warns() []*Warn

Warns return warnning info when build the point.

func (*Point) WarnsPretty added in v0.1.6

func (p *Point) WarnsPretty() string

WarnsPretty return human readable warnning info.

type Precision

type Precision int
const (
	NS Precision = iota // nano-second
	US                  // micro-second
	MS                  // milli-second
	S                   // second
	M                   // minute
	H                   // hour

	// XXX: not used.
	D // day
	W // week
)

func PrecStr

func PrecStr(s string) Precision

func (Precision) String

func (p Precision) String() string

type RandOption

type RandOption func(*ptRander)

func WithCategory

func WithCategory(c Category) RandOption

func WithFixedKeys

func WithFixedKeys(on bool) RandOption

func WithFixedTags

func WithFixedTags(on bool) RandOption

func WithKVSorted added in v0.1.6

func WithKVSorted(on bool) RandOption

func WithRandFields

func WithRandFields(n int) RandOption

func WithRandKeyLen

func WithRandKeyLen(n int) RandOption

func WithRandMeasurementPrefix

func WithRandMeasurementPrefix(s string) RandOption

func WithRandPB

func WithRandPB(on bool) RandOption

func WithRandTags

func WithRandTags(n int) RandOption

func WithRandText

func WithRandText(n int) RandOption

func WithRandTime

func WithRandTime(t time.Time) RandOption

func WithRandValLen

func WithRandValLen(n int) RandOption

type Warn

type Warn struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Msg  string `protobuf:"bytes,2,opt,name=msg,json=message,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

Warn used to attach some warning message during building the point.

func (*Warn) Descriptor deprecated

func (*Warn) Descriptor() ([]byte, []int)

Deprecated: Use Warn.ProtoReflect.Descriptor instead.

func (*Warn) GetMsg

func (x *Warn) GetMsg() string

func (*Warn) GetType

func (x *Warn) GetType() string

func (*Warn) ProtoMessage

func (*Warn) ProtoMessage()

func (*Warn) ProtoReflect

func (x *Warn) ProtoReflect() protoreflect.Message

func (*Warn) Reset

func (x *Warn) Reset()

func (*Warn) String

func (x *Warn) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL