From 00f6545fb7ccdf2f8a4678391d857f56219f8f50 Mon Sep 17 00:00:00 2001 From: stone1100 Date: Tue, 6 Aug 2024 10:25:55 +0800 Subject: [PATCH 1/2] [opt]: add error msg when json marshal fail --- pkg/encoding/json.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/encoding/json.go b/pkg/encoding/json.go index 0242e2c..ca50db7 100644 --- a/pkg/encoding/json.go +++ b/pkg/encoding/json.go @@ -32,12 +32,12 @@ var ( func JSONMarshal(v interface{}) []byte { data, err := json.Marshal(v) if err != nil { - log.Error("json marshal error") + log.Error("json marshal error", logger.Error(err)) } return data } -// JSONUnmarshal parses the JSON-encoded data and stores the result +// JSONUnmarshal parses the JSON-encoded data and stores the result. func JSONUnmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) } From 1a4aa3b78ec4b7e7bcf61ee352c7a724cc9209d0 Mon Sep 17 00:00:00 2001 From: stone1100 Date: Thu, 30 Oct 2025 09:21:36 +0800 Subject: [PATCH 2/2] [feat]: add log model --- .golangci.yaml | 185 ++ .golangci.yml | 209 -- Makefile | 2 +- go.mod | 2 +- log/doc.go | 19 + log/row_builder.go | 150 ++ log/row_builder_test.go | 51 + {series => metric}/checker.go | 4 +- {series => metric}/checker_test.go | 6 +- metric/doc.go | 19 + {series => metric}/row_builder.go | 88 +- {series => metric}/row_builder_test.go | 10 +- models/doc.go | 19 + models/kv.go | 42 + models/log.go | 29 + pkg/ltoml/io.go | 4 +- proto/gen/v1/flatLogV1/Field.go | 63 + proto/gen/v1/flatLogV1/Log.go | 93 + proto/gen/v1/flatMetricsV1/CompoundField.go | 17 - proto/gen/v1/flatMetricsV1/Exemplar.go | 17 - proto/gen/v1/flatMetricsV1/KeyValue.go | 17 - proto/gen/v1/flatMetricsV1/Metric.go | 17 - proto/gen/v1/flatMetricsV1/SimpleField.go | 17 - proto/gen/v1/flatMetricsV1/SimpleFieldType.go | 17 - proto/gen/v1/linlog/linlog.pb.go | 719 +++++ proto/gen/v1/linmetrics/linmetrics.pb.go | 17 - proto/gen/v1/lintrace/lintrace.pb.go | 2327 +++++++++++++++++ proto/generate.sh | 1 + proto/v1/linlog.proto | 13 + proto/v1/linmetrics.proto | 98 +- proto/v1/lintrace.proto | 45 + proto/v1/log.fbs | 14 + 32 files changed, 3887 insertions(+), 444 deletions(-) create mode 100644 .golangci.yaml delete mode 100644 .golangci.yml create mode 100644 log/doc.go create mode 100644 log/row_builder.go create mode 100644 log/row_builder_test.go rename {series => metric}/checker.go (97%) rename {series => metric}/checker_test.go (98%) create mode 100644 metric/doc.go rename {series => metric}/row_builder.go (88%) rename {series => metric}/row_builder_test.go (98%) create mode 100644 models/doc.go create mode 100644 models/kv.go create mode 100644 models/log.go create mode 100644 proto/gen/v1/flatLogV1/Field.go create mode 100644 proto/gen/v1/flatLogV1/Log.go create mode 100644 proto/gen/v1/linlog/linlog.pb.go create mode 100644 proto/gen/v1/lintrace/lintrace.pb.go create mode 100644 proto/v1/linlog.proto create mode 100644 proto/v1/lintrace.proto create mode 100644 proto/v1/log.fbs diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..8d9faee --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,185 @@ +version: "2" +run: + build-tags: + - integration + - benchmark +linters: + default: none + enable: + - bodyclose + - copyloopvar + - depguard + - dogsled + - dupl + - errcheck + - funlen + - goconst + - gocritic + - gocyclo + - goprintffuncname + - gosec + - govet + - ineffassign + - lll + - misspell + - nakedret + - noctx + - nolintlint + - staticcheck + - unconvert + - unparam + - unused + - whitespace + settings: + depguard: + rules: + main: + list-mode: lax + files: + - '!**/*_a _file.go' + allow: + - $gostd + deny: + - pkg: github.com/sirupsen/logrus + desc: not allowed + - pkg: github.com/pkg/errors + desc: Should be replaced by standard lib errors package + dupl: + threshold: 100 + funlen: + lines: 180 + statements: 100 + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + disabled-checks: + - dupImport + - ifElseChain + - octalLiteral + - whyNoLint + - wrapperFunc + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + gocyclo: + min-complexity: 50 + gosec: + includes: + - G101 + - G102 + - G103 + - G104 + - G106 + - G107 + - G108 + - G109 + - G110 + - G201 + - G202 + - G203 + - G204 + - G301 + - G302 + - G303 + - G304 + - G305 + - G306 + - G307 + - G401 + - G402 + - G403 + - G404 + - G501 + - G502 + - G503 + - G504 + - G505 + - G601 + excludes: + - G101 + - G102 + - G103 + - G104 + - G106 + - G107 + - G108 + - G109 + - G110 + - G201 + - G202 + - G203 + - G204 + - G301 + - G302 + - G303 + - G304 + - G305 + - G306 + - G307 + - G401 + - G402 + - G403 + - G404 + - G501 + - G502 + - G503 + - G504 + - G505 + - G601 + govet: + disable: + - fieldalignment + settings: + printf: + funcs: + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + lll: + line-length: 140 + misspell: + locale: US + nolintlint: + require-explanation: false + require-specific: false + allow-unused: true + revive: + max-open-files: 512 + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - dupl + - funlen + - gochecknoinits + - mnd + - staticcheck + path: _test\.go + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + settings: + goimports: + local-prefixes: + - github.com/lindb/common + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/.golangci.yml b/.golangci.yml deleted file mode 100644 index ff0dbb1..0000000 --- a/.golangci.yml +++ /dev/null @@ -1,209 +0,0 @@ -linters-settings: - gocyclo: - # Minimal code complexity to report. - # Default: 30 (but we recommend 10-20) - min-complexity: 50 - depguard: - # Rules to apply. - # - # Variables: - # - File Variables - # you can still use and exclamation mark ! in front of a variable to say not to use it. - # Example !$test will match any file that is not a go test file. - # - # `$all` - matches all go files - # `$test` - matches all go test files - # - # - Package Variables - # - # `$gostd` - matches all of go's standard library (Pulled from `GOROOT`) - # - # Default: Only allow $gostd in all files. - rules: - # Name of a rule. - main: - # Used to determine the package matching priority. - # There are three different modes: `original`, `strict`, and `lax`. - # Default: "original" - list-mode: lax - # List of file globs that will match this list of settings to compare against. - # Default: $all - files: - - "!**/*_a _file.go" - # List of allowed packages. - allow: - - $gostd - # Packages that are not allowed where the value is a suggestion. - deny: - - pkg: "github.com/sirupsen/logrus" - desc: not allowed - - pkg: "github.com/pkg/errors" - desc: Should be replaced by standard lib errors package - - dupl: - threshold: 100 - funlen: - lines: 180 - statements: 100 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - - wrapperFunc - goimports: - local-prefixes: github.com/lindb/lindb - - govet: - shadow: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - gosec: - # To select a subset of rules to run. - # Available rules: https://github.com/securego/gosec#available-rules - includes: - - G101 - - G102 - - G103 - - G104 - - G106 - - G107 - - G108 - - G109 - - G110 - - G201 - - G202 - - G203 - - G204 - - G301 - - G302 - - G303 - - G304 - - G305 - - G306 - - G307 - - G401 - - G402 - - G403 - - G404 - - G501 - - G502 - - G503 - - G504 - - G505 - - G601 - # To specify a set of rules to explicitly exclude. - # Available rules: https://github.com/securego/gosec#available-rules - excludes: - - G101 - - G102 - - G103 - - G104 - - G106 - - G107 - - G108 - - G109 - - G110 - - G201 - - G202 - - G203 - - G204 - - G301 - - G302 - - G303 - - G304 - - G305 - - G306 - - G307 - - G401 - - G402 - - G403 - - G404 - - G501 - - G502 - - G503 - - G504 - - G505 - - G601 -linters: - disable-all: true - enable: - - bodyclose - # - deadcode - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - staticcheck - # - structcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - # - varcheck - - whitespace - # - deadcode - - bodyclose - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - funlen - - dupl - - gochecknoinits - - stylecheck - - staticcheck - -run: - timeout: 5m - # timeout for analysis, e.g. 30s, 5m, default is 1m - deadline: 10m - # list of build tags, all linters use it. Default is empty list. - build-tags: - - integration - - benchmark diff --git a/Makefile b/Makefile index fef4c0d..3d31368 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ header: ## check and add license header. lint: ## run lint ifeq (, $(shell which golangci-lint)) # binary will be $(go env GOPATH)/bin/golangci-lint - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.57.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v2.4.0 else echo "Found golangci-lint" endif diff --git a/go.mod b/go.mod index ce16669..0ca5361 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/lindb/common -go 1.22 +go 1.25 require ( github.com/BurntSushi/toml v1.2.1 diff --git a/log/doc.go b/log/doc.go new file mode 100644 index 0000000..0edbca8 --- /dev/null +++ b/log/doc.go @@ -0,0 +1,19 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package log provides logging proto for LindDB. +package log diff --git a/log/row_builder.go b/log/row_builder.go new file mode 100644 index 0000000..2257502 --- /dev/null +++ b/log/row_builder.go @@ -0,0 +1,150 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package log + +import ( + "fmt" + "sync" + + flatbuffers "github.com/google/flatbuffers/go" + + "github.com/lindb/common/models" + "github.com/lindb/common/pkg/fasttime" + "github.com/lindb/common/proto/gen/v1/flatLogV1" +) + +var rowBuilderPool sync.Pool + +type RowBuilder struct { + timestamp int64 + message []byte + + rowKVs models.KVs + + // context for building flat log + flatBuilder *flatbuffers.Builder + keys []flatbuffers.UOffsetT + values []flatbuffers.UOffsetT + fields []flatbuffers.UOffsetT +} + +// NewRowBuilder picks a row builder from pool for building flat log. +func NewRowBuilder() ( + rb *RowBuilder, + releaseFunc func(rb *RowBuilder), +) { + releaseFunc = func(rb *RowBuilder) { rowBuilderPool.Put(rb) } + item := rowBuilderPool.Get() + if item != nil { + builder := item.(*RowBuilder) + builder.Reset() + } + return &RowBuilder{ + flatBuilder: flatbuffers.NewBuilder(1536), + }, releaseFunc +} + +// CreateRowBuilder creates a new row builder, not reused builder. +func CreateRowBuilder() *RowBuilder { + return &RowBuilder{flatBuilder: flatbuffers.NewBuilder(1536)} +} + +// AddTimestamp adds timestamp for log entry. +func (rb *RowBuilder) AddTimestamp(ts int64) *RowBuilder { + rb.timestamp = ts + return rb +} + +// AddMessage adds message for log entry. +func (rb *RowBuilder) AddMessage(message []byte) *RowBuilder { + rb.message = append(rb.message[:0], message...) + return rb +} + +// AddField appends a key-value pair +// Return false if field is invalid +func (rb *RowBuilder) AddField(key, value []byte) *RowBuilder { + if len(key) == 0 || len(value) == 0 { + return rb + } + rb.rowKVs.Count++ + + if rb.rowKVs.Count > len(rb.rowKVs.Values) { + rb.rowKVs.Values = append(rb.rowKVs.Values, models.KV{}) + } + kvIdx := rb.rowKVs.Count - 1 + // copy key + rb.rowKVs.Values[kvIdx].Key = append(rb.rowKVs.Values[kvIdx].Key[:0], key...) + // copy value + rb.rowKVs.Values[kvIdx].Value = append(rb.rowKVs.Values[kvIdx].Value[:0], value...) + return rb +} + +func (rb *RowBuilder) Build() ([]byte, error) { + if len(rb.message) == 0 { + return nil, fmt.Errorf("message is empty") + } + + for i := 0; i < rb.rowKVs.Count; i++ { + rb.keys = append(rb.keys, rb.flatBuilder.CreateByteString(rb.rowKVs.Values[i].Key)) + rb.values = append(rb.values, rb.flatBuilder.CreateByteString(rb.rowKVs.Values[i].Value)) + } + + // building key values vector + for i := range len(rb.keys) { + flatLogV1.FieldStart(rb.flatBuilder) + flatLogV1.FieldAddName(rb.flatBuilder, rb.keys[i]) + flatLogV1.FieldAddValue(rb.flatBuilder, rb.values[i]) + rb.fields = append(rb.fields, flatLogV1.FieldEnd(rb.flatBuilder)) + } + + flatLogV1.LogStartFieldsVector(rb.flatBuilder, rb.rowKVs.Count) + for i := rb.rowKVs.Count - 1; i >= 0; i-- { + rb.flatBuilder.PrependUOffsetT(rb.fields[i]) + } + fields := rb.flatBuilder.EndVector(rb.rowKVs.Count) + + message := rb.flatBuilder.CreateByteString(rb.message) + + flatLogV1.LogStart(rb.flatBuilder) + if rb.timestamp == 0 { + rb.timestamp = fasttime.UnixMilliseconds() + } + flatLogV1.LogAddMessage(rb.flatBuilder, message) + flatLogV1.LogAddTimestamp(rb.flatBuilder, rb.timestamp) + flatLogV1.LogAddFields(rb.flatBuilder, fields) + end := flatLogV1.LogEnd(rb.flatBuilder) + // size prefix encoding + rb.flatBuilder.Finish(end) + + return rb.flatBuilder.FinishedBytes(), nil +} + +func (rb *RowBuilder) Reset() { + // reset flat builder context + rb.flatBuilder.Reset() + rb.timestamp = 0 + rb.message = rb.message[:0] + + // reset kvs context + rb.rowKVs.Count = 0 + + rb.keys = rb.keys[:0] + rb.values = rb.values[:0] + rb.fields = rb.fields[:0] +} diff --git a/log/row_builder_test.go b/log/row_builder_test.go new file mode 100644 index 0000000..4d633e8 --- /dev/null +++ b/log/row_builder_test.go @@ -0,0 +1,51 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package log + +import ( + "fmt" + "testing" + + flatbuffers "github.com/google/flatbuffers/go" + + "github.com/lindb/common/proto/gen/v1/flatLogV1" +) + +func Test_RowBuilder(t *testing.T) { + rb := CreateRowBuilder() + + rb.AddMessage([]byte("message")). + AddTimestamp(123). + AddField([]byte("key1"), []byte("value1")). + AddField([]byte("key2"), []byte("value2")) + + data, _ := rb.Build() + log := flatLogV1.Log{} + fmt.Println(string(data)) + log.Init(data, flatbuffers.GetUOffsetT(data)) + fmt.Println(string(log.Message())) + fmt.Println(log.Timestamp()) + c := log.FieldsLength() + fmt.Println(c) + var f flatLogV1.Field + for i := range c { + log.Fields(&f, i) + fmt.Println(string(f.Name())) + fmt.Println(string(f.Value())) + } +} diff --git a/series/checker.go b/metric/checker.go similarity index 97% rename from series/checker.go rename to metric/checker.go index 286e024..31aa617 100644 --- a/series/checker.go +++ b/metric/checker.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package series +package metric import ( "bytes" @@ -59,7 +59,7 @@ func ShouldSanitizeFieldName(fieldName []byte) bool { func SanitizeFieldName(fieldName []byte) []byte { switch { case bytes.HasPrefix(fieldName, []byte("Histogram")): - var dst = make([]byte, len(fieldName)+1) + dst := make([]byte, len(fieldName)+1) dst[0] = byte('_') copy(dst[1:], fieldName) return dst diff --git a/series/checker_test.go b/metric/checker_test.go similarity index 98% rename from series/checker_test.go rename to metric/checker_test.go index 69a7e09..2c3dbc5 100644 --- a/series/checker_test.go +++ b/metric/checker_test.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package series +package metric import ( "bytes" @@ -99,7 +99,7 @@ func Benchmark_FlatMetric_Unmarshal10KeyValues(b *testing.B) { func Benchmark_Marshal_Proto(b *testing.B) { m := protoMetricsV1.Metric{Name: "hello", Namespace: "default-ns", Timestamp: fasttime.UnixMilliseconds()} - for i := 0; i < 10; i++ { + for i := range 10 { m.SimpleFields = append(m.SimpleFields, &protoMetricsV1.SimpleField{ Name: "counter" + strconv.Itoa(i), Type: protoMetricsV1.SimpleFieldType_LAST, Value: float64(i), }) @@ -116,7 +116,7 @@ func Benchmark_Marshal_Proto(b *testing.B) { func Benchmark_Unmarshal_Proto_10Fields(b *testing.B) { m := protoMetricsV1.Metric{Name: "hello", Namespace: "default-ns", Timestamp: fasttime.UnixMilliseconds()} - for i := 0; i < 10; i++ { + for i := range 10 { m.SimpleFields = append(m.SimpleFields, &protoMetricsV1.SimpleField{ Name: "counter" + strconv.Itoa(i), Type: protoMetricsV1.SimpleFieldType_LAST, Value: float64(i), }) diff --git a/metric/doc.go b/metric/doc.go new file mode 100644 index 0000000..c7ff090 --- /dev/null +++ b/metric/doc.go @@ -0,0 +1,19 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package metric provides common metric for LindDB. +package metric diff --git a/series/row_builder.go b/metric/row_builder.go similarity index 88% rename from series/row_builder.go rename to metric/row_builder.go index df15bf2..1bfd0c4 100644 --- a/series/row_builder.go +++ b/metric/row_builder.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package series +package metric import ( "bytes" @@ -27,29 +27,11 @@ import ( "github.com/cespare/xxhash/v2" flatbuffers "github.com/google/flatbuffers/go" + "github.com/lindb/common/models" "github.com/lindb/common/pkg/fasttime" "github.com/lindb/common/proto/gen/v1/flatMetricsV1" ) -type rowKV struct { - key []byte - value []byte -} - -// rowKVs sorts key values, then computes the hash -type rowKVs struct { - kvs []rowKV - kvCount int -} - -func (items rowKVs) Len() int { return items.kvCount } - -func (items rowKVs) Swap(i, j int) { items.kvs[i], items.kvs[j] = items.kvs[j], items.kvs[i] } - -func (items rowKVs) Less(i, j int) bool { - return bytes.Compare(items.kvs[i].key, items.kvs[j].key) < 0 -} - type rowExemplar struct { name []byte traceID []byte @@ -70,7 +52,7 @@ type RowBuilder struct { nameSpace []byte timestamp int64 - rowKVs rowKVs + rowKVs models.KVs hashBuf bytes.Buffer // concat sorted kvs simpleFields []rowSimpleField @@ -128,16 +110,16 @@ func (rb *RowBuilder) AddTag(key, value []byte) error { if len(key) == 0 || len(value) == 0 { return fmt.Errorf("tag[%s: %s] is empty", string(key), string(value)) } - rb.rowKVs.kvCount++ + rb.rowKVs.Count++ - if rb.rowKVs.kvCount > len(rb.rowKVs.kvs) { - rb.rowKVs.kvs = append(rb.rowKVs.kvs, rowKV{}) + if rb.rowKVs.Count > len(rb.rowKVs.Values) { + rb.rowKVs.Values = append(rb.rowKVs.Values, models.KV{}) } - kvIdx := rb.rowKVs.kvCount - 1 + kvIdx := rb.rowKVs.Count - 1 // copy key - rb.rowKVs.kvs[kvIdx].key = append(rb.rowKVs.kvs[kvIdx].key[:0], key...) + rb.rowKVs.Values[kvIdx].Key = append(rb.rowKVs.Values[kvIdx].Key[:0], key...) // copy value - rb.rowKVs.kvs[kvIdx].value = append(rb.rowKVs.kvs[kvIdx].value[:0], value...) + rb.rowKVs.Values[kvIdx].Value = append(rb.rowKVs.Values[kvIdx].Value[:0], value...) return nil } @@ -244,14 +226,14 @@ func (rb *RowBuilder) AddCompoundFieldData(values, bounds []float64) error { return nil } -func (rb *RowBuilder) AddCompoundFieldMMSC(min, max, sum, count float64) error { - rb.compoundFieldMin = min - rb.compoundFieldMax = max - rb.compoundFieldSum = sum - rb.compoundFieldCount = count - if !(min >= 0 && max >= 0 && sum >= 0 && count >= 0) { +func (rb *RowBuilder) AddCompoundFieldMMSC(minVal, maxVal, sumVal, countVal float64) error { + rb.compoundFieldMin = minVal + rb.compoundFieldMax = maxVal + rb.compoundFieldSum = sumVal + rb.compoundFieldCount = countVal + if !(minVal >= 0 && maxVal >= 0 && sumVal >= 0 && countVal >= 0) { return fmt.Errorf("min: %f, max: %f, sum: %f, count: %f should >= 0", - min, max, sum, count) + minVal, maxVal, sumVal, countVal) } return nil } @@ -278,7 +260,7 @@ func (rb *RowBuilder) Reset() { rb.timestamp = 0 // reset kvs context - rb.rowKVs.kvCount = 0 + rb.rowKVs.Count = 0 // reset simple fields context rb.simpleFieldCount = 0 @@ -310,17 +292,17 @@ var ( ) func (rb *RowBuilder) _xxHashOfKVs() uint64 { - if rb.rowKVs.kvCount == 0 { + if rb.rowKVs.Count == 0 { return emptyStringHash } rb.hashBuf.Reset() - for idx := 0; idx < rb.rowKVs.kvCount; idx++ { + for idx := 0; idx < rb.rowKVs.Count; idx++ { if idx >= 1 { _ = rb.hashBuf.WriteByte(',') } - _, _ = rb.hashBuf.Write(rb.rowKVs.kvs[idx].key) + _, _ = rb.hashBuf.Write(rb.rowKVs.Values[idx].Key) _ = rb.hashBuf.WriteByte('=') - _, _ = rb.hashBuf.Write(rb.rowKVs.kvs[idx].value) + _, _ = rb.hashBuf.Write(rb.rowKVs.Values[idx].Value) } return xxhash.Sum64(rb.hashBuf.Bytes()) } @@ -337,7 +319,7 @@ func (rb *RowBuilder) _xxHashOfName() uint64 { // dedupTags removes duplicated tags func (rb *RowBuilder) dedupTagsThenXXHash() uint64 { - if rb.rowKVs.kvCount < 2 { + if rb.rowKVs.Count < 2 { return rb._xxHashOfKVs() } if !sort.IsSorted(rb.rowKVs) { @@ -345,8 +327,8 @@ func (rb *RowBuilder) dedupTagsThenXXHash() uint64 { } // fast path shouldDeDup := false - for cursor := 1; cursor < rb.rowKVs.kvCount; cursor++ { - if bytes.Equal(rb.rowKVs.kvs[cursor].key, rb.rowKVs.kvs[cursor-1].key) { + for cursor := 1; cursor < rb.rowKVs.Count; cursor++ { + if bytes.Equal(rb.rowKVs.Values[cursor].Key, rb.rowKVs.Values[cursor-1].Key) { shouldDeDup = true break } @@ -359,14 +341,14 @@ func (rb *RowBuilder) dedupTagsThenXXHash() uint64 { // high index key has higher priority // use 2-pointer algorithm slow := 0 - for high := 1; high < rb.rowKVs.kvCount; high++ { - if !bytes.Equal(rb.rowKVs.kvs[slow].key, rb.rowKVs.kvs[high].key) { + for high := 1; high < rb.rowKVs.Count; high++ { + if !bytes.Equal(rb.rowKVs.Values[slow].Key, rb.rowKVs.Values[high].Key) { slow++ } - rb.rowKVs.kvs[slow].value = append(rb.rowKVs.kvs[slow].value[:0], rb.rowKVs.kvs[high].value...) - rb.rowKVs.kvs[slow].key = append(rb.rowKVs.kvs[slow].key[:0], rb.rowKVs.kvs[high].key...) + rb.rowKVs.Values[slow].Value = append(rb.rowKVs.Values[slow].Value[:0], rb.rowKVs.Values[high].Value...) + rb.rowKVs.Values[slow].Key = append(rb.rowKVs.Values[slow].Key[:0], rb.rowKVs.Values[high].Key...) } - rb.rowKVs.kvCount = slow + 1 + rb.rowKVs.Count = slow + 1 return rb._xxHashOfKVs() } @@ -378,9 +360,9 @@ func (rb *RowBuilder) Build() ([]byte, error) { return nil, fmt.Errorf("simple field and compound field are both empty") } hash := rb.dedupTagsThenXXHash() - for i := 0; i < rb.rowKVs.kvCount; i++ { - rb.keys = append(rb.keys, rb.flatBuilder.CreateByteString(rb.rowKVs.kvs[i].key)) - rb.values = append(rb.values, rb.flatBuilder.CreateByteString(rb.rowKVs.kvs[i].value)) + for i := 0; i < rb.rowKVs.Count; i++ { + rb.keys = append(rb.keys, rb.flatBuilder.CreateByteString(rb.rowKVs.Values[i].Key)) + rb.values = append(rb.values, rb.flatBuilder.CreateByteString(rb.rowKVs.Values[i].Value)) } // building key values vector for i := 0; i < len(rb.keys); i++ { @@ -418,11 +400,11 @@ func (rb *RowBuilder) Build() ([]byte, error) { rb.exemplars = append(rb.exemplars, flatMetricsV1.ExemplarEnd(rb.flatBuilder)) } - flatMetricsV1.MetricStartKeyValuesVector(rb.flatBuilder, rb.rowKVs.kvCount) - for i := rb.rowKVs.kvCount - 1; i >= 0; i-- { + flatMetricsV1.MetricStartKeyValuesVector(rb.flatBuilder, rb.rowKVs.Count) + for i := rb.rowKVs.Count - 1; i >= 0; i-- { rb.flatBuilder.PrependUOffsetT(rb.kvs[i]) } - kvs := rb.flatBuilder.EndVector(rb.rowKVs.kvCount) + kvs := rb.flatBuilder.EndVector(rb.rowKVs.Count) // serialize fields flatMetricsV1.MetricStartSimpleFieldsVector(rb.flatBuilder, rb.simpleFieldCount) for i := rb.simpleFieldCount - 1; i >= 0; i-- { diff --git a/series/row_builder_test.go b/metric/row_builder_test.go similarity index 98% rename from series/row_builder_test.go rename to metric/row_builder_test.go index 51ea28e..be87769 100644 --- a/series/row_builder_test.go +++ b/metric/row_builder_test.go @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -package series +package metric import ( "math" @@ -32,7 +32,7 @@ import ( func Test_NewRowBuilder(t *testing.T) { var lastData []byte - for i := 0; i < 20; i++ { + for i := range 20 { rb, releaseFunc := NewRowBuilder() assert.NoError(t, rb.AddTag([]byte("a"), []byte("b"))) @@ -52,7 +52,7 @@ func Test_NewRowBuilder(t *testing.T) { func Test_RowBuilder(t *testing.T) { rb, releaseFunc := NewRowBuilder() defer releaseFunc(rb) - for i := 0; i < 20; i++ { + for i := range 20 { assert.NoError(t, rb.AddTag([]byte("a"), []byte("b"))) assert.NoError(t, rb.AddSimpleField([]byte("f1"), flatMetricsV1.SimpleFieldTypeDeltaSum, 1)) if i%2 == 0 { @@ -218,7 +218,7 @@ func buildFlatMetric(builder *flatbuffers.Builder) { kvs [10]flatbuffers.UOffsetT fields [10]flatbuffers.UOffsetT ) - for i := 0; i < 10; i++ { + for i := range 10 { keys[i] = builder.CreateString("key" + strconv.Itoa(i)) values[i] = builder.CreateString("value" + strconv.Itoa(i)) fieldNames[i] = builder.CreateString("counter" + strconv.Itoa(i)) @@ -231,7 +231,7 @@ func buildFlatMetric(builder *flatbuffers.Builder) { } // serialize field names - for i := 0; i < 10; i++ { + for i := range 10 { flatMetricsV1.SimpleFieldStart(builder) flatMetricsV1.SimpleFieldAddName(builder, fieldNames[i]) switch i { diff --git a/models/doc.go b/models/doc.go new file mode 100644 index 0000000..3653a08 --- /dev/null +++ b/models/doc.go @@ -0,0 +1,19 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// Package models provides common data model for LindDB. +package models diff --git a/models/kv.go b/models/kv.go new file mode 100644 index 0000000..d2801c3 --- /dev/null +++ b/models/kv.go @@ -0,0 +1,42 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package models + +import ( + "bytes" +) + +// KV represents a key-value. +type KV struct { + Key []byte + Value []byte +} + +// KVs sorts key values, then computes the hash +type KVs struct { + Values []KV + Count int +} + +func (items KVs) Len() int { return items.Count } + +func (items KVs) Swap(i, j int) { items.Values[i], items.Values[j] = items.Values[j], items.Values[i] } + +func (items KVs) Less(i, j int) bool { + return bytes.Compare(items.Values[i].Key, items.Values[j].Key) < 0 +} diff --git a/models/log.go b/models/log.go new file mode 100644 index 0000000..bde93c1 --- /dev/null +++ b/models/log.go @@ -0,0 +1,29 @@ +// Licensed to LinDB under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. LinDB licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package models + +type Log struct { + Timestamp int64 `form:"timestamp" json:"timestamp"` + Message string `form:"message" json:"message"` + Fields map[string]string `form:"fields" json:"fields"` +} + +type LogField struct { + Name string `form:"name" json:"name"` + Value string `form:"value" json:"value"` +} diff --git a/pkg/ltoml/io.go b/pkg/ltoml/io.go index 42f5ef0..f3277b8 100644 --- a/pkg/ltoml/io.go +++ b/pkg/ltoml/io.go @@ -27,7 +27,7 @@ import ( // EncodeToml encodes data into file using toml format, // encode data to tmp file, if success then rename tmp => target file -func EncodeToml(fileName string, v interface{}) error { +func EncodeToml(fileName string, v any) error { tmp := fmt.Sprintf("%s.tmp", fileName) f, _ := os.Create(tmp) w := bufio.NewWriter(f) @@ -66,7 +66,7 @@ func WriteConfig(fileName, content string) error { } // DecodeToml decodes data from file using toml format -func DecodeToml(fileName string, v interface{}) error { +func DecodeToml(fileName string, v any) error { if _, err := toml.DecodeFile(fileName, v); err != nil { return err } diff --git a/proto/gen/v1/flatLogV1/Field.go b/proto/gen/v1/flatLogV1/Field.go new file mode 100644 index 0000000..5736b88 --- /dev/null +++ b/proto/gen/v1/flatLogV1/Field.go @@ -0,0 +1,63 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package flatLogV1 + +import ( + flatbuffers "github.com/google/flatbuffers/go" +) + +type Field struct { + _tab flatbuffers.Table +} + +func GetRootAsField(buf []byte, offset flatbuffers.UOffsetT) *Field { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &Field{} + x.Init(buf, n+offset) + return x +} + +func GetSizePrefixedRootAsField(buf []byte, offset flatbuffers.UOffsetT) *Field { + n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) + x := &Field{} + x.Init(buf, n+offset+flatbuffers.SizeUint32) + return x +} + +func (rcv *Field) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *Field) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *Field) Name() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *Field) Value() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func FieldStart(builder *flatbuffers.Builder) { + builder.StartObject(2) +} +func FieldAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(name), 0) +} +func FieldAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(value), 0) +} +func FieldEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} diff --git a/proto/gen/v1/flatLogV1/Log.go b/proto/gen/v1/flatLogV1/Log.go new file mode 100644 index 0000000..056ad55 --- /dev/null +++ b/proto/gen/v1/flatLogV1/Log.go @@ -0,0 +1,93 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package flatLogV1 + +import ( + flatbuffers "github.com/google/flatbuffers/go" +) + +type Log struct { + _tab flatbuffers.Table +} + +func GetRootAsLog(buf []byte, offset flatbuffers.UOffsetT) *Log { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &Log{} + x.Init(buf, n+offset) + return x +} + +func GetSizePrefixedRootAsLog(buf []byte, offset flatbuffers.UOffsetT) *Log { + n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) + x := &Log{} + x.Init(buf, n+offset+flatbuffers.SizeUint32) + return x +} + +func (rcv *Log) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *Log) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *Log) Timestamp() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *Log) MutateTimestamp(n int64) bool { + return rcv._tab.MutateInt64Slot(4, n) +} + +func (rcv *Log) Message() []byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + return rcv._tab.ByteVector(o + rcv._tab.Pos) + } + return nil +} + +func (rcv *Log) Fields(obj *Field, j int) bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + x := rcv._tab.Vector(o) + x += flatbuffers.UOffsetT(j) * 4 + x = rcv._tab.Indirect(x) + obj.Init(rcv._tab.Bytes, x) + return true + } + return false +} + +func (rcv *Log) FieldsLength() int { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.VectorLen(o) + } + return 0 +} + +func LogStart(builder *flatbuffers.Builder) { + builder.StartObject(3) +} +func LogAddTimestamp(builder *flatbuffers.Builder, timestamp int64) { + builder.PrependInt64Slot(0, timestamp, 0) +} +func LogAddMessage(builder *flatbuffers.Builder, message flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(message), 0) +} +func LogAddFields(builder *flatbuffers.Builder, fields flatbuffers.UOffsetT) { + builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(fields), 0) +} +func LogStartFieldsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { + return builder.StartVector(4, numElems, 4) +} +func LogEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} diff --git a/proto/gen/v1/flatMetricsV1/CompoundField.go b/proto/gen/v1/flatMetricsV1/CompoundField.go index eff6189..cee6696 100644 --- a/proto/gen/v1/flatMetricsV1/CompoundField.go +++ b/proto/gen/v1/flatMetricsV1/CompoundField.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/flatMetricsV1/Exemplar.go b/proto/gen/v1/flatMetricsV1/Exemplar.go index 7e36a8c..466b2fa 100644 --- a/proto/gen/v1/flatMetricsV1/Exemplar.go +++ b/proto/gen/v1/flatMetricsV1/Exemplar.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/flatMetricsV1/KeyValue.go b/proto/gen/v1/flatMetricsV1/KeyValue.go index 8ab889b..0070952 100644 --- a/proto/gen/v1/flatMetricsV1/KeyValue.go +++ b/proto/gen/v1/flatMetricsV1/KeyValue.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/flatMetricsV1/Metric.go b/proto/gen/v1/flatMetricsV1/Metric.go index 7841477..ea82ba6 100644 --- a/proto/gen/v1/flatMetricsV1/Metric.go +++ b/proto/gen/v1/flatMetricsV1/Metric.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/flatMetricsV1/SimpleField.go b/proto/gen/v1/flatMetricsV1/SimpleField.go index 0a5c647..db3b2e5 100644 --- a/proto/gen/v1/flatMetricsV1/SimpleField.go +++ b/proto/gen/v1/flatMetricsV1/SimpleField.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/flatMetricsV1/SimpleFieldType.go b/proto/gen/v1/flatMetricsV1/SimpleFieldType.go index 7223209..09d2e30 100644 --- a/proto/gen/v1/flatMetricsV1/SimpleFieldType.go +++ b/proto/gen/v1/flatMetricsV1/SimpleFieldType.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by the FlatBuffers compiler. DO NOT EDIT. package flatMetricsV1 diff --git a/proto/gen/v1/linlog/linlog.pb.go b/proto/gen/v1/linlog/linlog.pb.go new file mode 100644 index 0000000..ffa5790 --- /dev/null +++ b/proto/gen/v1/linlog/linlog.pb.go @@ -0,0 +1,719 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: linlog.proto + +package protoLogV1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Logs struct { + Logs []*Log `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Logs) Reset() { *m = Logs{} } +func (m *Logs) String() string { return proto.CompactTextString(m) } +func (*Logs) ProtoMessage() {} +func (*Logs) Descriptor() ([]byte, []int) { + return fileDescriptor_a7c0f9ca102e6f53, []int{0} +} +func (m *Logs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Logs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Logs.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Logs) XXX_Merge(src proto.Message) { + xxx_messageInfo_Logs.Merge(m, src) +} +func (m *Logs) XXX_Size() int { + return m.Size() +} +func (m *Logs) XXX_DiscardUnknown() { + xxx_messageInfo_Logs.DiscardUnknown(m) +} + +var xxx_messageInfo_Logs proto.InternalMessageInfo + +func (m *Logs) GetLogs() []*Log { + if m != nil { + return m.Logs + } + return nil +} + +type Log struct { + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Fields map[string]string `protobuf:"bytes,3,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Log) Reset() { *m = Log{} } +func (m *Log) String() string { return proto.CompactTextString(m) } +func (*Log) ProtoMessage() {} +func (*Log) Descriptor() ([]byte, []int) { + return fileDescriptor_a7c0f9ca102e6f53, []int{1} +} +func (m *Log) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Log.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Log) XXX_Merge(src proto.Message) { + xxx_messageInfo_Log.Merge(m, src) +} +func (m *Log) XXX_Size() int { + return m.Size() +} +func (m *Log) XXX_DiscardUnknown() { + xxx_messageInfo_Log.DiscardUnknown(m) +} + +var xxx_messageInfo_Log proto.InternalMessageInfo + +func (m *Log) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +func (m *Log) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *Log) GetFields() map[string]string { + if m != nil { + return m.Fields + } + return nil +} + +func init() { + proto.RegisterType((*Logs)(nil), "protoLogV1.Logs") + proto.RegisterType((*Log)(nil), "protoLogV1.Log") + proto.RegisterMapType((map[string]string)(nil), "protoLogV1.Log.FieldsEntry") +} + +func init() { proto.RegisterFile("linlog.proto", fileDescriptor_a7c0f9ca102e6f53) } + +var fileDescriptor_a7c0f9ca102e6f53 = []byte{ + // 218 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xc9, 0xc9, 0xcc, 0xcb, + 0xc9, 0x4f, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x02, 0x53, 0x3e, 0xf9, 0xe9, 0x61, + 0x86, 0x4a, 0xda, 0x5c, 0x2c, 0x3e, 0xf9, 0xe9, 0xc5, 0x42, 0xca, 0x5c, 0x2c, 0x39, 0xf9, 0xe9, + 0xc5, 0x12, 0x4c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, 0xfc, 0x7a, 0x08, 0x25, 0x7a, 0x3e, 0xf9, 0xe9, + 0x41, 0x60, 0x49, 0xa5, 0xb5, 0x8c, 0x5c, 0xcc, 0x3e, 0xf9, 0xe9, 0x42, 0x32, 0x5c, 0x9c, 0x25, + 0x99, 0xb9, 0xa9, 0xc5, 0x25, 0x89, 0xb9, 0x05, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x08, + 0x01, 0x21, 0x09, 0x2e, 0xf6, 0xdc, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0x54, 0x09, 0x26, 0x05, 0x46, + 0x0d, 0xce, 0x20, 0x18, 0x57, 0xc8, 0x98, 0x8b, 0x2d, 0x2d, 0x33, 0x35, 0x27, 0xa5, 0x58, 0x82, + 0x19, 0x6c, 0x8d, 0x34, 0x9a, 0x35, 0x7a, 0x6e, 0x60, 0x59, 0xd7, 0xbc, 0x92, 0xa2, 0xca, 0x20, + 0xa8, 0x52, 0x29, 0x4b, 0x2e, 0x6e, 0x24, 0x61, 0x21, 0x01, 0x2e, 0xe6, 0xec, 0xd4, 0x4a, 0xb0, + 0xad, 0x9c, 0x41, 0x20, 0xa6, 0x90, 0x08, 0x17, 0x6b, 0x59, 0x62, 0x4e, 0x29, 0xcc, 0x36, 0x08, + 0xc7, 0x8a, 0xc9, 0x82, 0xd1, 0x49, 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x9c, 0xf1, 0x58, 0x8e, 0x21, 0x89, 0x0d, 0x6c, 0xa1, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xd5, 0x45, 0xb8, 0x24, 0x11, 0x01, 0x00, 0x00, +} + +func (m *Logs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Logs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Logs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Logs) > 0 { + for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLinlog(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + return len(dAtA) - i, nil +} + +func (m *Log) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Log) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Fields) > 0 { + for k := range m.Fields { + v := m.Fields[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLinlog(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLinlog(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLinlog(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintLinlog(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + } + if m.Timestamp != 0 { + i = encodeVarintLinlog(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintLinlog(dAtA []byte, offset int, v uint64) int { + offset -= sovLinlog(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Logs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Logs) > 0 { + for _, e := range m.Logs { + l = e.Size() + n += 1 + l + sovLinlog(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Log) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Timestamp != 0 { + n += 1 + sovLinlog(uint64(m.Timestamp)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sovLinlog(uint64(l)) + } + if len(m.Fields) > 0 { + for k, v := range m.Fields { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLinlog(uint64(len(k))) + 1 + len(v) + sovLinlog(uint64(len(v))) + n += mapEntrySize + 1 + sovLinlog(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovLinlog(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLinlog(x uint64) (n int) { + return sovLinlog(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Logs) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Logs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Logs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLinlog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLinlog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Logs = append(m.Logs, &Log{}) + if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLinlog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLinlog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Log) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Log: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Log: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLinlog + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLinlog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fields", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLinlog + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLinlog + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Fields == nil { + m.Fields = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLinlog + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLinlog + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLinlog + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLinlog + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLinlog + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLinlog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLinlog + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Fields[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLinlog(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLinlog + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLinlog(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLinlog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLinlog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLinlog + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLinlog + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLinlog + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLinlog + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLinlog = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLinlog = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLinlog = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/gen/v1/linmetrics/linmetrics.pb.go b/proto/gen/v1/linmetrics/linmetrics.pb.go index d40a626..b34098d 100644 --- a/proto/gen/v1/linmetrics/linmetrics.pb.go +++ b/proto/gen/v1/linmetrics/linmetrics.pb.go @@ -1,20 +1,3 @@ -// Licensed to LinDB under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. LinDB licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: linmetrics.proto diff --git a/proto/gen/v1/lintrace/lintrace.pb.go b/proto/gen/v1/lintrace/lintrace.pb.go new file mode 100644 index 0000000..3a46bd9 --- /dev/null +++ b/proto/gen/v1/lintrace/lintrace.pb.go @@ -0,0 +1,2327 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: lintrace.proto + +package protoTraceV1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type CallStack struct { + Resource *Resource `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + Spans []*Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CallStack) Reset() { *m = CallStack{} } +func (m *CallStack) String() string { return proto.CompactTextString(m) } +func (*CallStack) ProtoMessage() {} +func (*CallStack) Descriptor() ([]byte, []int) { + return fileDescriptor_bbdd0d84e99263af, []int{0} +} +func (m *CallStack) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CallStack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CallStack.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CallStack) XXX_Merge(src proto.Message) { + xxx_messageInfo_CallStack.Merge(m, src) +} +func (m *CallStack) XXX_Size() int { + return m.Size() +} +func (m *CallStack) XXX_DiscardUnknown() { + xxx_messageInfo_CallStack.DiscardUnknown(m) +} + +var xxx_messageInfo_CallStack proto.InternalMessageInfo + +func (m *CallStack) GetResource() *Resource { + if m != nil { + return m.Resource + } + return nil +} + +func (m *CallStack) GetSpans() []*Span { + if m != nil { + return m.Spans + } + return nil +} + +type Resource struct { + Attributes map[string]string `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_bbdd0d84e99263af, []int{1} +} +func (m *Resource) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return m.Size() +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *Resource) GetAttributes() map[string]string { + if m != nil { + return m.Attributes + } + return nil +} + +type Span struct { + TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + SpanId string `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + ParentSpanId string `protobuf:"bytes,3,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Kind string `protobuf:"bytes,5,opt,name=kind,proto3" json:"kind,omitempty"` + StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime int64 `protobuf:"varint,7,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"` + ErrorMessage string `protobuf:"bytes,9,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + Attributes map[string]string `protobuf:"bytes,10,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Events []*Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` + Links []*Link `protobuf:"bytes,12,rep,name=links,proto3" json:"links,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span) Reset() { *m = Span{} } +func (m *Span) String() string { return proto.CompactTextString(m) } +func (*Span) ProtoMessage() {} +func (*Span) Descriptor() ([]byte, []int) { + return fileDescriptor_bbdd0d84e99263af, []int{2} +} +func (m *Span) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Span.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Span) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span.Merge(m, src) +} +func (m *Span) XXX_Size() int { + return m.Size() +} +func (m *Span) XXX_DiscardUnknown() { + xxx_messageInfo_Span.DiscardUnknown(m) +} + +var xxx_messageInfo_Span proto.InternalMessageInfo + +func (m *Span) GetTraceId() string { + if m != nil { + return m.TraceId + } + return "" +} + +func (m *Span) GetSpanId() string { + if m != nil { + return m.SpanId + } + return "" +} + +func (m *Span) GetParentSpanId() string { + if m != nil { + return m.ParentSpanId + } + return "" +} + +func (m *Span) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Span) GetKind() string { + if m != nil { + return m.Kind + } + return "" +} + +func (m *Span) GetStartTime() int64 { + if m != nil { + return m.StartTime + } + return 0 +} + +func (m *Span) GetEndTime() int64 { + if m != nil { + return m.EndTime + } + return 0 +} + +func (m *Span) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func (m *Span) GetErrorMessage() string { + if m != nil { + return m.ErrorMessage + } + return "" +} + +func (m *Span) GetAttributes() map[string]string { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Span) GetEvents() []*Event { + if m != nil { + return m.Events + } + return nil +} + +func (m *Span) GetLinks() []*Link { + if m != nil { + return m.Links + } + return nil +} + +type Event struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Event) Reset() { *m = Event{} } +func (m *Event) String() string { return proto.CompactTextString(m) } +func (*Event) ProtoMessage() {} +func (*Event) Descriptor() ([]byte, []int) { + return fileDescriptor_bbdd0d84e99263af, []int{3} +} +func (m *Event) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Event.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event.Merge(m, src) +} +func (m *Event) XXX_Size() int { + return m.Size() +} +func (m *Event) XXX_DiscardUnknown() { + xxx_messageInfo_Event.DiscardUnknown(m) +} + +var xxx_messageInfo_Event proto.InternalMessageInfo + +func (m *Event) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Event) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +func (m *Event) GetAttributes() map[string]string { + if m != nil { + return m.Attributes + } + return nil +} + +type Link struct { + TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + SpanId string `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Link) Reset() { *m = Link{} } +func (m *Link) String() string { return proto.CompactTextString(m) } +func (*Link) ProtoMessage() {} +func (*Link) Descriptor() ([]byte, []int) { + return fileDescriptor_bbdd0d84e99263af, []int{4} +} +func (m *Link) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Link.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Link.Merge(m, src) +} +func (m *Link) XXX_Size() int { + return m.Size() +} +func (m *Link) XXX_DiscardUnknown() { + xxx_messageInfo_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Link proto.InternalMessageInfo + +func (m *Link) GetTraceId() string { + if m != nil { + return m.TraceId + } + return "" +} + +func (m *Link) GetSpanId() string { + if m != nil { + return m.SpanId + } + return "" +} + +func (m *Link) GetAttributes() map[string]string { + if m != nil { + return m.Attributes + } + return nil +} + +func init() { + proto.RegisterType((*CallStack)(nil), "protoTraceV1.CallStack") + proto.RegisterType((*Resource)(nil), "protoTraceV1.Resource") + proto.RegisterMapType((map[string]string)(nil), "protoTraceV1.Resource.AttributesEntry") + proto.RegisterType((*Span)(nil), "protoTraceV1.Span") + proto.RegisterMapType((map[string]string)(nil), "protoTraceV1.Span.AttributesEntry") + proto.RegisterType((*Event)(nil), "protoTraceV1.Event") + proto.RegisterMapType((map[string]string)(nil), "protoTraceV1.Event.AttributesEntry") + proto.RegisterType((*Link)(nil), "protoTraceV1.Link") + proto.RegisterMapType((map[string]string)(nil), "protoTraceV1.Link.AttributesEntry") +} + +func init() { proto.RegisterFile("lintrace.proto", fileDescriptor_bbdd0d84e99263af) } + +var fileDescriptor_bbdd0d84e99263af = []byte{ + // 478 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x52, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0x77, 0xb2, 0xc9, 0x26, 0xfb, 0x12, 0x6b, 0x19, 0xa5, 0x8e, 0xa2, 0x21, 0x6c, 0x45, 0x02, + 0x42, 0xc0, 0x78, 0x11, 0xc1, 0x83, 0x29, 0x15, 0x0a, 0x7a, 0x99, 0x14, 0xaf, 0x61, 0x9a, 0x1d, + 0x64, 0xd8, 0xdd, 0xc9, 0x32, 0x33, 0x29, 0xf4, 0x63, 0x78, 0xf3, 0xcb, 0xf4, 0xee, 0xd1, 0xab, + 0x37, 0x89, 0x5f, 0x44, 0xe6, 0x4d, 0x1a, 0x13, 0xbb, 0x78, 0xb0, 0xf4, 0xb4, 0x33, 0xbf, 0x3f, + 0x3b, 0xef, 0xbd, 0xdf, 0x83, 0xbd, 0x42, 0x69, 0x67, 0xc4, 0x5c, 0x8e, 0x2a, 0xb3, 0x70, 0x0b, + 0xda, 0xc3, 0xcf, 0xa9, 0x47, 0x3e, 0xbd, 0x4c, 0x15, 0x24, 0x47, 0xa2, 0x28, 0xa6, 0x4e, 0xcc, + 0x73, 0x3a, 0x86, 0x8e, 0x91, 0x76, 0xb1, 0x34, 0x73, 0xc9, 0xc8, 0x80, 0x0c, 0xbb, 0xe3, 0x83, + 0xd1, 0xb6, 0x7a, 0xc4, 0xd7, 0x2c, 0xdf, 0xe8, 0xe8, 0x10, 0x5a, 0xb6, 0x12, 0xda, 0xb2, 0xc6, + 0x20, 0x1a, 0x76, 0xc7, 0x74, 0xd7, 0x30, 0xad, 0x84, 0xe6, 0x41, 0x90, 0x7e, 0x21, 0xd0, 0xb9, + 0xfa, 0x01, 0x7d, 0x0f, 0x20, 0x9c, 0x33, 0xea, 0x6c, 0xe9, 0xa4, 0x65, 0x04, 0xbd, 0xcf, 0xeb, + 0x1f, 0x1b, 0xbd, 0xdb, 0x08, 0x8f, 0xb5, 0x33, 0x17, 0x7c, 0xcb, 0xf9, 0xf8, 0x2d, 0xdc, 0xfb, + 0x8b, 0xa6, 0xfb, 0x10, 0xe5, 0xf2, 0x02, 0x1b, 0x48, 0xb8, 0x3f, 0xd2, 0x07, 0xd0, 0x3a, 0x17, + 0xc5, 0x52, 0xb2, 0x06, 0x62, 0xe1, 0xf2, 0xa6, 0xf1, 0x9a, 0xa4, 0x3f, 0x22, 0x68, 0xfa, 0x1a, + 0xe9, 0x23, 0xe8, 0xe0, 0x90, 0x66, 0x2a, 0x5b, 0x3b, 0xdb, 0x78, 0x3f, 0xc9, 0xe8, 0x43, 0x68, + 0xfb, 0x06, 0x3c, 0x13, 0xfc, 0xb1, 0xbf, 0x9e, 0x64, 0xf4, 0x19, 0xec, 0x55, 0xc2, 0x48, 0xed, + 0x66, 0x57, 0x7c, 0x84, 0x7c, 0x2f, 0xa0, 0xd3, 0xa0, 0xa2, 0xd0, 0xd4, 0xa2, 0x94, 0xac, 0x89, + 0x1c, 0x9e, 0x3d, 0x96, 0x2b, 0x9d, 0xb1, 0x56, 0xc0, 0xfc, 0x99, 0x3e, 0x05, 0xb0, 0x4e, 0x18, + 0x37, 0x73, 0xaa, 0x94, 0x2c, 0x1e, 0x90, 0x61, 0xc4, 0x13, 0x44, 0x4e, 0x55, 0x29, 0x7d, 0x81, + 0x52, 0x67, 0x81, 0x6c, 0x23, 0xd9, 0x96, 0x3a, 0x43, 0xea, 0x00, 0x62, 0xeb, 0x84, 0x5b, 0x5a, + 0xd6, 0x59, 0xd7, 0x87, 0x37, 0x7a, 0x08, 0x77, 0xa5, 0x31, 0x0b, 0x33, 0x2b, 0xa5, 0xb5, 0xe2, + 0xb3, 0x64, 0x49, 0x28, 0x0f, 0xc1, 0x8f, 0x01, 0xa3, 0x93, 0x9d, 0x20, 0x00, 0x83, 0x48, 0xaf, + 0x87, 0xf8, 0xaf, 0x10, 0xe8, 0x0b, 0x88, 0xe5, 0xb9, 0xd4, 0xce, 0xb2, 0x2e, 0xfa, 0xef, 0xef, + 0xfa, 0x8f, 0x3d, 0xc7, 0xd7, 0x12, 0xbf, 0x30, 0x85, 0xd2, 0xb9, 0x65, 0xbd, 0xba, 0x85, 0xf9, + 0xa0, 0x74, 0xce, 0x83, 0xe0, 0xa6, 0xd9, 0x5e, 0x12, 0x68, 0xe1, 0xd3, 0x9b, 0x08, 0xc8, 0x56, + 0x04, 0x4f, 0x20, 0xf1, 0xb3, 0xb4, 0x4e, 0x94, 0x15, 0x7a, 0x23, 0xfe, 0x07, 0xa0, 0x47, 0x3b, + 0x53, 0x89, 0xb0, 0xd2, 0xc3, 0x9a, 0xae, 0x6e, 0x73, 0x37, 0x2f, 0x09, 0x34, 0xfd, 0x38, 0xfe, + 0x6b, 0x37, 0x27, 0x35, 0x0d, 0xa4, 0xd7, 0x47, 0x7d, 0x8b, 0xf5, 0x4f, 0xf6, 0xbf, 0xad, 0xfa, + 0xe4, 0xfb, 0xaa, 0x4f, 0x7e, 0xae, 0xfa, 0xe4, 0xeb, 0xaf, 0xfe, 0x9d, 0xb3, 0x18, 0xdf, 0x7f, + 0xf5, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x3a, 0x69, 0xd9, 0xc5, 0x93, 0x04, 0x00, 0x00, +} + +func (m *CallStack) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CallStack) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CallStack) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Spans) > 0 { + for iNdEx := len(m.Spans) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Spans[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLintrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Resource != nil { + { + size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLintrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Resource) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Resource) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Resource) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLintrace(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLintrace(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLintrace(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Span) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Span) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Span) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Links) > 0 { + for iNdEx := len(m.Links) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Links[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLintrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLintrace(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLintrace(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLintrace(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLintrace(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x52 + } + } + if len(m.ErrorMessage) > 0 { + i -= len(m.ErrorMessage) + copy(dAtA[i:], m.ErrorMessage) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.ErrorMessage))) + i-- + dAtA[i] = 0x4a + } + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x42 + } + if m.EndTime != 0 { + i = encodeVarintLintrace(dAtA, i, uint64(m.EndTime)) + i-- + dAtA[i] = 0x38 + } + if m.StartTime != 0 { + i = encodeVarintLintrace(dAtA, i, uint64(m.StartTime)) + i-- + dAtA[i] = 0x30 + } + if len(m.Kind) > 0 { + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x2a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x22 + } + if len(m.ParentSpanId) > 0 { + i -= len(m.ParentSpanId) + copy(dAtA[i:], m.ParentSpanId) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.ParentSpanId))) + i-- + dAtA[i] = 0x1a + } + if len(m.SpanId) > 0 { + i -= len(m.SpanId) + copy(dAtA[i:], m.SpanId) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.SpanId))) + i-- + dAtA[i] = 0x12 + } + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Event) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Event) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLintrace(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLintrace(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLintrace(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.Timestamp != 0 { + i = encodeVarintLintrace(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x10 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Link) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Link) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Link) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLintrace(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLintrace(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLintrace(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.SpanId) > 0 { + i -= len(m.SpanId) + copy(dAtA[i:], m.SpanId) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.SpanId))) + i-- + dAtA[i] = 0x12 + } + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintLintrace(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintLintrace(dAtA []byte, offset int, v uint64) int { + offset -= sovLintrace(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CallStack) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Resource != nil { + l = m.Resource.Size() + n += 1 + l + sovLintrace(uint64(l)) + } + if len(m.Spans) > 0 { + for _, e := range m.Spans { + l = e.Size() + n += 1 + l + sovLintrace(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Resource) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLintrace(uint64(len(k))) + 1 + len(v) + sovLintrace(uint64(len(v))) + n += mapEntrySize + 1 + sovLintrace(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Span) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TraceId) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.SpanId) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.ParentSpanId) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.Kind) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + if m.StartTime != 0 { + n += 1 + sovLintrace(uint64(m.StartTime)) + } + if m.EndTime != 0 { + n += 1 + sovLintrace(uint64(m.EndTime)) + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.ErrorMessage) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLintrace(uint64(len(k))) + 1 + len(v) + sovLintrace(uint64(len(v))) + n += mapEntrySize + 1 + sovLintrace(uint64(mapEntrySize)) + } + } + if len(m.Events) > 0 { + for _, e := range m.Events { + l = e.Size() + n += 1 + l + sovLintrace(uint64(l)) + } + } + if len(m.Links) > 0 { + for _, e := range m.Links { + l = e.Size() + n += 1 + l + sovLintrace(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Event) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + sovLintrace(uint64(m.Timestamp)) + } + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLintrace(uint64(len(k))) + 1 + len(v) + sovLintrace(uint64(len(v))) + n += mapEntrySize + 1 + sovLintrace(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Link) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TraceId) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + l = len(m.SpanId) + if l > 0 { + n += 1 + l + sovLintrace(uint64(l)) + } + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLintrace(uint64(len(k))) + 1 + len(v) + sovLintrace(uint64(len(v))) + n += mapEntrySize + 1 + sovLintrace(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovLintrace(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLintrace(x uint64) (n int) { + return sovLintrace(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CallStack) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CallStack: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CallStack: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resource == nil { + m.Resource = &Resource{} + } + if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spans", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Spans = append(m.Spans, &Span{}) + if err := m.Spans[len(m.Spans)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Resource) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Resource: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Resource: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Span) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Span: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Span: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TraceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpanId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpanId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentSpanId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParentSpanId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + m.StartTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + m.EndTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndTime |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessage", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ErrorMessage = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Events = append(m.Events, &Event{}) + if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Links", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Links = append(m.Links, &Link{}) + if err := m.Links[len(m.Links)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Event) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Event: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Event: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Link) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Link: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Link: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TraceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpanId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpanId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLintrace + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLintrace + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLintrace + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLintrace + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLintrace + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLintrace(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLintrace + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLintrace(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLintrace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLintrace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLintrace + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLintrace + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLintrace + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLintrace + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLintrace = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLintrace = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLintrace = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/generate.sh b/proto/generate.sh index b792124..47f1d7f 100755 --- a/proto/generate.sh +++ b/proto/generate.sh @@ -28,6 +28,7 @@ function gen() { # brew install flatbuffers flatc --go -o ./proto/gen/v1 ./proto/v1/metrics.fbs +flatc --go -o ./proto/gen/v1 ./proto/v1/log.fbs # for dir in v1 opentelemetry-v1 for dir in v1; do diff --git a/proto/v1/linlog.proto b/proto/v1/linlog.proto new file mode 100644 index 0000000..dc86c41 --- /dev/null +++ b/proto/v1/linlog.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package protoLogV1; + +message Logs { + repeated Log logs = 2; +} + +message Log { + int64 timestamp = 1; + string message = 2; + map fields = 3; +} diff --git a/proto/v1/linmetrics.proto b/proto/v1/linmetrics.proto index 99007c3..cca7935 100644 --- a/proto/v1/linmetrics.proto +++ b/proto/v1/linmetrics.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package protoMetricsV1; message MetricList { - repeated Metric metrics = 2; + repeated Metric metrics = 2; } // Defines a Metric which has one or more time series. The following is a @@ -50,75 +50,75 @@ message MetricList { // +-----+----------+---------+----------+ message Metric { - string namespace = 1; - string name = 2; - int64 timestamp = 3; - repeated KeyValue tags = 4; - // xxhash.Sum64String(tags), broker side generate before write wal - uint64 tags_hash = 5; - repeated SimpleField simple_fields = 6; - CompoundField compound_field = 7; - repeated Exemplar exemplars = 8; + string namespace = 1; + string name = 2; + int64 timestamp = 3; + repeated KeyValue tags = 4; + // xxhash.Sum64String(tags), broker side generate before write wal + uint64 tags_hash = 5; + repeated SimpleField simple_fields = 6; + CompoundField compound_field = 7; + repeated Exemplar exemplars = 8; } enum SimpleFieldType { - SIMPLE_UNSPECIFIED = 0; - LAST = 1; - DELTA_SUM = 2; - Min = 3; - Max = 4; - FIRST = 5; + SIMPLE_UNSPECIFIED = 0; + LAST = 1; + DELTA_SUM = 2; + Min = 3; + Max = 4; + FIRST = 5; } message SimpleField { - string name = 1; - SimpleFieldType type = 2; - double value = 4; + string name = 1; + SimpleFieldType type = 2; + double value = 4; } // CompoundData is compound data used for histogram field. message CompoundField { - double min = 2; - double max = 3; - double sum = 4; - double count = 5; - // same as open-telemetry metrics definition - // explicit_bounds specifies buckets with explicitly defined bounds for values. - // - // The boundaries for bucket at index i are: - // - // (-infinity, explicit_bounds[i]] for i == 0 - // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) - // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) - // - // The values in the explicit_bounds array must be strictly increasing. - // - // Histogram buckets are inclusive of their upper boundary, except the last - // bucket where the boundary is at infinity. This format is intentionally - // compatible with the OpenMetrics histogram definition. - repeated double explicit_bounds = 6; - repeated double values = 7; + double min = 2; + double max = 3; + double sum = 4; + double count = 5; + // same as open-telemetry metrics definition + // explicit_bounds specifies buckets with explicitly defined bounds for values. + // + // The boundaries for bucket at index i are: + // + // (-infinity, explicit_bounds[i]] for i == 0 + // (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) + // (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) + // + // The values in the explicit_bounds array must be strictly increasing. + // + // Histogram buckets are inclusive of their upper boundary, except the last + // bucket where the boundary is at infinity. This format is intentionally + // compatible with the OpenMetrics histogram definition. + repeated double explicit_bounds = 6; + repeated double values = 7; } // KeyValue is a key-value pair that is used to store tag/label attributes message KeyValue { - string key = 1; - string value = 2; + string key = 1; + string value = 2; } // A representation of an exemplar, which is a sample input compound-field. // Exemplars in LindDB wont' hold any information about the environment // it is used to record span and trace ID for a specify series. message Exemplar { - // Exemplar Name - string name = 1; + // Exemplar Name + string name = 1; - // Span ID of the exemplar trace. - string span_id = 2; + // Span ID of the exemplar trace. + string span_id = 2; - // Trace ID of the exemplar trace. - string trace_id = 3; + // Trace ID of the exemplar trace. + string trace_id = 3; - // Duration of the exemplar span. - int64 duration = 4; + // Duration of the exemplar span. + int64 duration = 4; } diff --git a/proto/v1/lintrace.proto b/proto/v1/lintrace.proto new file mode 100644 index 0000000..579b73b --- /dev/null +++ b/proto/v1/lintrace.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package protoTraceV1; + +message CallStack { + Resource resource = 1; + repeated Span spans = 2; +} + +message Resource { + map attributes = 1; +} + +message Span { + string trace_id = 1; + string span_id = 2; + string parent_span_id = 3; + + string name = 4; + + string kind = 5; + + int64 start_time = 6; + int64 end_time = 7; + + string status = 8; + string error_message = 9; + + map attributes = 10; + + repeated Event events = 11; + repeated Link links = 12; +} + +message Event { + string name = 1; + int64 timestamp = 2; + map attributes = 3; +} + +message Link { + string trace_id = 1; + string span_id = 2; + map attributes = 3; +} diff --git a/proto/v1/log.fbs b/proto/v1/log.fbs new file mode 100644 index 0000000..cecf585 --- /dev/null +++ b/proto/v1/log.fbs @@ -0,0 +1,14 @@ +namespace flatLogV1; + +table Field { + name: string; + value: string; +} + +table Log { + timestamp: int64; // in milliseconds + message: string; + fields: [Field]; +} + +root_type Log;