24 Commits

Author SHA1 Message Date
Vincent Bernat
b1d6382585 common/embed: replace all go:embed use by an embedded archive
Some of the files were quite big:

- asns.csv ~ 3 MB
- index.js ~ 1.5 MB
- *.svg ~ 2 MB

Use a ZIP archive to put them all and embed it. This reduce the binary
size from 89 MB to 82 MB. 🤯

This also pulls some code modernization (use of http.ServeFileFS).
2025-09-03 00:00:05 +02:00
Vincent Bernat
ac68c5970e inlet: split inlet into new inlet and outlet
This change split the inlet component into a simpler inlet and a new
outlet component. The new inlet component receive flows and put them in
Kafka, unparsed. The outlet component takes them from Kafka and resume
the processing from here (flow parsing, enrichment) and puts them in
ClickHouse.

The main goal is to ensure the inlet does a minimal work to not be late
when processing packets (and restart faster). It also brings some
simplification as the number of knobs to tune everything is reduced: for
inlet, we only need to tune the queue size for UDP, the number of
workers and a few Kafka parameters; for outlet, we need to tune a few
Kafka parameters, the number of workers and a few ClickHouse parameters.

The outlet component features a simple Kafka input component. The core
component becomes just a callback function. There is also a new
ClickHouse component to push data to ClickHouse using the low-level
ch-go library with batch inserts.

This processing has an impact on the internal representation of a
FlowMessage. Previously, it was tailored to dynamically build the
protobuf message to be put in Kafka. Now, it builds the batch request to
be sent to ClickHouse. This makes the FlowMessage structure hides the
content of the next batch request and therefore, it should be reused.
This also changes the way we decode flows as they don't output
FlowMessage anymore, they reuse one that is provided to each worker.

The ClickHouse tables are slightly updated. Instead of using Kafka
engine, the Null engine is used instead.

Fix #1122
2025-07-27 21:44:28 +02:00
Vincent Bernat
648ad11868 inlet/core: use enumer for methods for NetProvider and ASNProvider 2024-11-23 23:48:02 +01:00
Vincent Bernat
7ec09aa6f3 build: don't ship tcp.csv and udp.csv
Fetch them when building. Keep them up-to-date for Nix like NPM/Go
modules.
2024-06-16 10:57:53 +02:00
Vincent Bernat
a6139b4e59 build: move update scripts to passthru, use files to put hashes 2023-05-19 20:08:06 +02:00
Vincent Bernat
c5aa1e7bfa common/schema: generate bimap for column names 2023-01-18 16:36:11 +01:00
Vincent Bernat
e352202631 inlet: make use of schema for inlet
This is a huge change to make the various subcomponents of the inlet use
the schema to generate the protobuf. For it to make sense, we also
modify the way we parse flows to directly serialize non-essential fields
to Protobuf.

The performance is mostly on par with the previous commit. We are a bit
less efficient because we don't have a fixed structure, but we avoid
loosing too much performance by not relying on reflection and keeping
the production of messages as code. We use less of Goflow2: raw flow
parsing is still done by Goflow2, but we don't use the producer part
anymore. This helps a bit with the performance as we parse less.
Overall, we are 20% than the previous commit and twice faster than the
1.6.4!

```
goos: linux
goarch: amd64
pkg: akvorado/inlet/flow
cpu: AMD Ryzen 5 5600X 6-Core Processor
BenchmarkDecodeEncodeNetflow
BenchmarkDecodeEncodeNetflow/with_encoding
BenchmarkDecodeEncodeNetflow/with_encoding-12             151484              7789 ns/op            8272 B/op        143 allocs/op
BenchmarkDecodeEncodeNetflow/without_encoding
BenchmarkDecodeEncodeNetflow/without_encoding-12          162550              7133 ns/op            8272 B/op        143 allocs/op
BenchmarkDecodeEncodeSflow
BenchmarkDecodeEncodeSflow/with_encoding
BenchmarkDecodeEncodeSflow/with_encoding-12                94844             13193 ns/op            9816 B/op        295 allocs/op
BenchmarkDecodeEncodeSflow/without_encoding
BenchmarkDecodeEncodeSflow/without_encoding-12             92569             12456 ns/op            9816 B/op        295 allocs/op
```

There was a tentative to parse sFlow packets with gopackets, but the
adhoc parser used here is more performant.
2023-01-17 20:53:00 +01:00
Vincent Bernat
a30024cfa1 console: use common/schema for dimensions
This is a bit less type-safe. We could keep type safety by redefining
all the consts in `query_consts.go` in `common/schema`, but this is
pointless as the goal is to have arbitrary dimensions at some point.
2023-01-03 18:40:19 +01:00
Vincent Bernat
0d9fda0126 common/clickhousedb: ensure the mocks package always exist
It should help Dependabot. See:
 https://github.com/vincentbernat/akvorado/network/updates/419982169
2022-07-22 20:50:07 +02:00
Vincent Bernat
2eee9bd6cd build: switch to npm
We have little reason to use Yarn now. Moreover, Yarn requires to
embed itself into the repository and that's something I'd like to
avoid.

Fix #2
2022-07-14 16:03:36 +02:00
Vincent Bernat
c23e5c1687 console/frontend: use static generated content for fields
This is more reliable and efficient but it also remove a bug with
equality comparison failing and thus inability to remove entries.
Also, sorted exactly as we want.
2022-05-18 08:49:03 +02:00
Vincent Bernat
44ab2c380c console: use a parser to parse filter
An AST is not that useful for us. We just need to validate and
transform to proper SQL a filter string. Since it is SQL-like, this is
not hard to do.
2022-05-16 18:29:46 +02:00
Vincent Bernat
f73b6f3b73 build: delegate to asn2org for ASN list 2022-05-10 09:30:33 +02:00
Vincent Bernat
b44836aa97 common/clickhousedb: turn into a complete component
This enables us to mock it.
2022-04-12 23:33:22 +02:00
Vincent Bernat
caf654a171 build: skip cache directories when checking for files
Also, skip temporary files.
2022-04-11 18:11:45 +02:00
Vincent Bernat
ce7fce32ba console: switch to Vue.JS + Tailwind CSS + Headless UI for the frontend 2022-04-06 21:03:19 +02:00
Vincent Bernat
1dc253764d global: split Akvorado into 3 services 2022-04-01 20:21:53 +02:00
Vincent Bernat
a336370c05 web: frontend using Bootstrap 2022-03-31 20:56:14 +02:00
Vincent Bernat
537065db52 flow: make flow decoding modular
This is a preparation step to support multiple inputs and decoders.
2022-03-24 22:23:00 +01:00
Vincent Bernat
41131fca96 flow: introduce versioned flows
We need to version flow schemas. Otherwise, this won't be manageable.
Confluent is pushing for a registry, but it seems the ecosystem is
still too young. Let's version on our side with a topic for each
version.
2022-03-20 22:01:31 +01:00
Vincent Bernat
91e3d7661f docs: add documentation served directly by a dedicated component 2022-03-17 22:16:05 +01:00
Vincent Bernat
9c7747767b build: update gitignore 2022-03-08 23:30:10 +01:00
Vincent Bernat
88603f759d flow: use our own format 2022-03-08 17:23:31 +01:00
Vincent Bernat
5201088b69 Initial boilerplate 2022-03-08 07:51:10 +01:00