mirror of
https://github.com/openobserve/goflow2.git
synced 2025-10-25 00:53:58 +00:00
Fix protobuf
* Rebuiild with protoc v3.17.2 and protoc-gen-go v1.26.0 * Add misisng go_package flag * Add protobuf documentation
This commit is contained in:
4
Makefile
4
Makefile
@@ -25,8 +25,8 @@ OUTPUT := $(DIST_DIR)goflow2-$(VERSION_PKG)-$(GOOS)-$(ARCH)$(EXTENSION)
|
|||||||
.PHONY: proto
|
.PHONY: proto
|
||||||
proto:
|
proto:
|
||||||
@echo generating protobuf
|
@echo generating protobuf
|
||||||
protoc --go_out=. pb/*.proto
|
protoc --go_opt=paths=source_relative --go_out=. pb/*.proto
|
||||||
protoc --go_out=. cmd/enricher/pb/*.proto
|
protoc --go_opt=paths=source_relative --go_out=. cmd/enricher/pb/*.proto
|
||||||
|
|
||||||
.PHONY: vet
|
.PHONY: vet
|
||||||
vet:
|
vet:
|
||||||
|
|||||||
@@ -167,12 +167,7 @@ It can also be extended wtih enrichment as long as the user keep the same IDs.
|
|||||||
If you want to develop applications, build `pb/flow.proto` into the language you want:
|
If you want to develop applications, build `pb/flow.proto` into the language you want:
|
||||||
When adding custom fields, picking a field ID ≥ 1000 is suggested.
|
When adding custom fields, picking a field ID ≥ 1000 is suggested.
|
||||||
|
|
||||||
You can compile the protobuf using the Makefile for Go.
|
Check the docs for more information about [compiling protobuf](/docs/protobuf.md).
|
||||||
```
|
|
||||||
make proto
|
|
||||||
```
|
|
||||||
|
|
||||||
For compiling the protobuf for other languages, refer to the [official guide](https://developers.google.com/protocol-buffers).
|
|
||||||
|
|
||||||
## Flow Pipeline
|
## Flow Pipeline
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.15.0
|
// protoc v3.17.2
|
||||||
// source: cmd/enricher/pb/flowext.proto
|
// source: cmd/enricher/pb/flowext.proto
|
||||||
|
|
||||||
package flowpb
|
package flowpb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -21,10 +20,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
type FlowMessageExt_FlowType int32
|
type FlowMessageExt_FlowType int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -671,7 +666,11 @@ var file_cmd_enricher_pb_flowext_proto_rawDesc = []byte{
|
|||||||
0x4c, 0x4f, 0x57, 0x5f, 0x35, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c,
|
0x4c, 0x4f, 0x57, 0x5f, 0x35, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c,
|
||||||
0x4f, 0x57, 0x5f, 0x56, 0x35, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c,
|
0x4f, 0x57, 0x5f, 0x56, 0x35, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c,
|
||||||
0x4f, 0x57, 0x5f, 0x56, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x50, 0x46, 0x49, 0x58,
|
0x4f, 0x57, 0x5f, 0x56, 0x39, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x50, 0x46, 0x49, 0x58,
|
||||||
0x10, 0x04, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x10, 0x04, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||||
|
0x2f, 0x6e, 0x65, 0x74, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x2f, 0x67, 0x6f, 0x66, 0x6c,
|
||||||
|
0x6f, 0x77, 0x32, 0x2f, 0x63, 0x6d, 0x64, 0x2f, 0x65, 0x6e, 0x72, 0x69, 0x63, 0x68, 0x65, 0x72,
|
||||||
|
0x2f, 0x70, 0x62, 0x3b, 0x66, 0x6c, 0x6f, 0x77, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package flowpb;
|
package flowpb;
|
||||||
|
option go_package = "github.com/netsampler/goflow2/cmd/enricher/pb;flowpb";
|
||||||
|
|
||||||
message FlowMessageExt {
|
message FlowMessageExt {
|
||||||
|
|
||||||
|
|||||||
34
docs/protobuf.md
Normal file
34
docs/protobuf.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# Protobuf
|
||||||
|
|
||||||
|
The `.proto` files contains a list of fields that are populated by GoFlow2.
|
||||||
|
|
||||||
|
If the fields are changed, the schema needs to be recompiled
|
||||||
|
in order to use it.
|
||||||
|
|
||||||
|
The compilation is dependent on the language.
|
||||||
|
Keep in mind the protobuf source code and libraries changes often and this page may be outdated.
|
||||||
|
|
||||||
|
For other languages, refer to the [official guide](https://developers.google.com/protocol-buffers).
|
||||||
|
|
||||||
|
## Compile for Golang
|
||||||
|
|
||||||
|
The following two tools are required:
|
||||||
|
* [protoc](https://github.com/protocolbuffers/protobuf), a protobuf compiler, written in C
|
||||||
|
* [protoc-gen-go](https://github.com/protocolbuffers/protobuf-go), a Go plugin for protoc that can compile protobuf for Golang
|
||||||
|
|
||||||
|
The release page in the respective GitHub repositories should provide binaries distributions. Unzip/Untar if necessary.
|
||||||
|
Make sure that the two binaries are in your ``$PATH``. On Mac OS you can add the files to `/usr/local/bin` for instance.
|
||||||
|
|
||||||
|
From the root of the repository, run the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ protoc --go_opt=paths=source_relative --go_out=. pb/*.proto
|
||||||
|
```
|
||||||
|
|
||||||
|
This will compile the main protobuf schema into the `pb` directory.
|
||||||
|
|
||||||
|
You can also run the command which will also compile the protobuf for the sample enricher.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ make proto
|
||||||
|
```
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.26.0
|
||||||
// protoc v3.15.0
|
// protoc v3.17.2
|
||||||
// source: pb/flow.proto
|
// source: pb/flow.proto
|
||||||
|
|
||||||
package flowpb
|
package flowpb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@@ -21,10 +20,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
type FlowMessage_FlowType int32
|
type FlowMessage_FlowType int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -649,8 +644,10 @@ var file_pb_flow_proto_rawDesc = []byte{
|
|||||||
0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x35, 0x10, 0x01, 0x12,
|
0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x35, 0x10, 0x01, 0x12,
|
||||||
0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x35, 0x10, 0x02, 0x12,
|
0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x35, 0x10, 0x02, 0x12,
|
||||||
0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x39, 0x10, 0x03, 0x12,
|
0x0e, 0x0a, 0x0a, 0x4e, 0x45, 0x54, 0x46, 0x4c, 0x4f, 0x57, 0x5f, 0x56, 0x39, 0x10, 0x03, 0x12,
|
||||||
0x09, 0x0a, 0x05, 0x49, 0x50, 0x46, 0x49, 0x58, 0x10, 0x04, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
0x09, 0x0a, 0x05, 0x49, 0x50, 0x46, 0x49, 0x58, 0x10, 0x04, 0x42, 0x29, 0x5a, 0x27, 0x67, 0x69,
|
||||||
0x6f, 0x33,
|
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x65, 0x74, 0x73, 0x61, 0x6d, 0x70,
|
||||||
|
0x6c, 0x65, 0x72, 0x2f, 0x67, 0x6f, 0x66, 0x6c, 0x6f, 0x77, 0x32, 0x2f, 0x70, 0x62, 0x3b, 0x66,
|
||||||
|
0x6c, 0x6f, 0x77, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package flowpb;
|
package flowpb;
|
||||||
|
option go_package = "github.com/netsampler/goflow2/pb;flowpb";
|
||||||
|
|
||||||
message FlowMessage {
|
message FlowMessage {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user