Commit Graph

299 Commits

Author SHA1 Message Date
Vincent Bernat
0239cd0a9f common: remove MarshalJSON helpers for mapstructure
They are not needed anymore since we don't exchange configuration files
using JSON, since baac495b9c.
2024-07-20 14:51:40 +02:00
Vincent Bernat
3812ca7882 tests: more helpers.Pos/helpers.Mark
This is related to de65ee6072.
2024-07-20 12:00:14 +02:00
Vincent Bernat
de65ee6072 tests: introduce helpers.Pos/helpers.Mark
This helps locating the position of a test.
2024-07-01 07:42:36 +02:00
Paul Galceran
43c169677a Resolve L4 ports protocol names (#1257)
* fix: generation of protocols.csv file

* feat: generation of ports-tcp.csv and ports-udp.csv files

* build: add rules for creating udp and tcp csv files

* feat: create dictionary tcp and udp

* refactor: add replaceRegexpOne

* test: transform src port and dest port columns in SQL

* test: add TCP and UDP dictionaries for migration testing
2024-06-14 21:52:56 +02:00
Vincent Bernat
297e04b95c common: clickHouse → clickhouse
Let's say that we use "ClickHouse" and "clickhouse".
2024-06-09 14:59:09 +02:00
Vincent Bernat
3af8b942d2 build: move version to a single place
Instead of trying to copy Akvorado version around, move it to a single
place, which can be imported by everything else.
2024-06-02 14:04:54 +02:00
Vincent Bernat
c6bff791a0 inlet/routing: do not rely on custom RWMutex
It was done to add the ability to downgrade the lock. However, the
number of times the RW lock is taken has been greatly reduced and it
does not make sense to maintain another implementation just for that.
2024-05-25 18:35:36 +02:00
Vincent Bernat
0c3529bb5c common/clickhousedb: run gofmt 2024-05-24 08:30:21 +02:00
guangwu
98a9303ff9 fix: close cache file 2024-05-23 05:51:21 +02:00
netixx
9c61a2cb2b Enable load-balancing for clickhouse
By defaut, the clickhouse-client does only failover (ConnOpenInOrder)
the first instance that replies is used.

This enabled round-robin so that servers can all be used
in parallel.
2024-05-22 17:30:07 +02:00
Vincent Bernat
889f82eb85 common/clickhousedb: disable experimental analyzer, only when using FILL 2024-04-19 19:51:44 +02:00
Vincent Bernat
12967c8ab6 common/clickhousedb: disable experimental analyzer in ClickHouse
See https://github.com/ClickHouse/ClickHouse/issues/62464
and https://github.com/akvorado/akvorado/discussions/1165

This setting was introduced in 22.3.16.1190-lts. See e6bfff3de2
2024-04-19 19:47:33 +02:00
Vincent Bernat
2467a3c136 inlet/metadata: fix versioning of metadata cache
Gob decoding is quite liberal and accepts anything that is not
conflicting as long as there is at least one field matching. That's not
what we want. To check we are decoding the right things, use a string
representation of zero values.
2024-04-12 22:44:50 +02:00
Vincent Bernat
74c150ba52 orchestrator/clickhouse: change primary key for the flows table
To be more space-efficient and faster, change the primary key to replace
TimeReceived by toStartOfFiveMinutes(TimeReceived). This is only
effective for new installations.

Fix #475
2024-04-04 22:03:12 +02:00
Vincent Bernat
28783ff4f3 orchestrator/clickhouse: add support for distributed/replicated tables
Fix #605

All MergeTree tables are now replicated.

For some tables, a `_local` variant is added and the non-`_local`
variant is now distributed. The distributed tables are the `flows`
table, the `flows_DDDD` tables (where `DDDD` is a duration), as well as
the `flows_raw_errors` table. The `exporters` table is not distributed
and stays local.

The data is following this schema:

- data is coming from `flows_HHHH_raw` table, using the Kafka engine

- the `flows_HHHH_raw_consumer` reads data from `flows_HHHH_raw` (local)
  and sends it to `flows` (distributed) when there is no error

- the `flows_raw_errors_consumer` reads data from
  `flows_HHHH_raw` (local) and sends it to
  `flows_raw_errors` (distributed)

- the `flows_DDDD_consumer` reads fata from `flows_local` (local) and
  sends it to `flow_DDDD_local` (local)

- the `exporters_consumer` reads data from `flows` (distributed) and
  sends it to `exporters` (local)

The reason for `flows_HHHH_raw_consumer` to send data to the distributed
`flows` table, and not the local one is to ensure flows are
balanced (for example, if there is not enough Kafka partitions). But
sending it to `flows_local` would have been possible.

On the other hand, it is important for `flows_DDDD_consumer` to read
from local to avoid duplication. It could have sent to distributed, but
the data is now balanced correctly and we just send it to local instead
for better performance.

The `exporters_consumer` is allowed to read from the distributed `flows`
table because it writes the result to the local `exporters` table.
2024-04-04 22:03:12 +02:00
Vincent Bernat
fff01464d9 common/reporter: update Go metric collection method 2024-03-26 07:10:18 +01:00
Vincent Bernat
bce99136b0 orchestrator/clickhouse: drop complete database during tests
Instead of dropping individual tables. This is faster!
2024-03-24 21:52:55 +01:00
Vincent Bernat
dcdbf208d1 orchestrator/clickhouse: optimize dictionary lookup for networks 2024-03-13 20:32:20 +01:00
Francois Espinet
87a57bf82e Do geoip enrich in clickhouse instead of inlet
One solution to https://github.com/akvorado/akvorado/issues/62
2024-03-11 15:29:09 +01:00
Vincent Bernat
e3c8f13562 build: enable loopvar experiment
This is enabled by default once we switch to Go 1.22 (in go.mod). See
https://tip.golang.org/wiki/LoopvarExperiment
2024-02-18 09:46:49 +01:00
Vincent Bernat
b3a9f6ab2e chore: remove unused parameters
They were not detected by revive in function literals.
2024-02-08 08:30:33 +01:00
Vincent Bernat
8ad3492579 commmon/helpers: fix decoding of SubnetMap that are already SubnetMap
Fix #1067
2024-02-01 23:22:14 +01:00
Vincent Bernat
194019535c chore: add missing SPDX header to some source files 2024-02-01 00:17:32 +01:00
Vincent Bernat
2418680c09 common/remotedatafetcher: exclude tests.go from release build 2024-02-01 00:14:31 +01:00
Vincent Bernat
55f685fbf8 common/helpers: remove unused function semacquire 2024-02-01 00:14:18 +01:00
Vincent Bernat
f321e8fa64 common/helpers: add a way to test Marshal/Unmarshal for bimaps 2024-01-22 21:53:26 +01:00
netixx
374a1fce55 Refactor to use common structs where possible 2024-01-22 20:50:13 +01:00
netixx
3188be5d23 Support providing exporter and iface metadata through metadata instead of classifiers
Sometime exporter name and interface description do not carry
all the required information for classification and metadata extraction,
supporting a way to provide the data through metadata compoenent (only static seems to make
sense at this points) enables more use-cases.
2024-01-22 20:50:13 +01:00
Vincent Bernat
cec8661387 chore: capitalize comments 2024-01-22 20:34:08 +01:00
Vincent Bernat
39882fd98e common: handle per-candidate ports for external service checks 2024-01-20 09:25:31 +01:00
Vincent Bernat
621fff521d common/remotedatasourcefetcher: fmt 2024-01-20 09:25:31 +01:00
Vincent Bernat
b49abde028 common: use 127.0.0.1 instead of localhost for external test services 2024-01-20 08:29:32 +01:00
netixx
e2dc6e4f53 Add TLS support for ClickhouseDB 2024-01-17 11:25:15 +01:00
Itah
705e56cac4 inlet/metadata/static: allow exporters configuration refresh from http data source using common/remotedatasourcefetcher, refactored with orchestrator/clickhouse network-sources. 2024-01-17 11:11:34 +01:00
Vincent Bernat
0792290316 build: switch mockgen to Uber fork 2024-01-14 10:41:50 +01:00
Vincent Bernat
19eaaddea3 common/reporter: use t.Fatalf when not able to create new mock 2023-12-02 14:25:41 +01:00
Vincent Bernat
0fedcf831e inlet/core: add back protobuf export of flows 2023-11-28 21:16:42 +01:00
Vincent Bernat
4a7a779237 common/schema: add MPLS4thLabel
MPLS labels often go by pair. It makes sense to access the 4th one easily.
2023-11-28 19:47:03 +01:00
Vincent Bernat
8ecc6b9570 inlet: add some test coverage around MPLS parsing 2023-11-25 20:34:45 +01:00
Vincent Bernat
82051b552f inlet: decode MPLS labels
They are stored in an array and there are some aliases to get 1st, 2nd
and third label. Support for sFlow would need a test to ensure it works
as expected.

Fix #960
2023-11-25 20:34:45 +01:00
Vincent Bernat
9db516e424 build: don't use ioutil
This is deprecated.
2023-11-12 22:58:41 +01:00
Vincent Bernat
e9d1431a2c common/schema: remove ability to use IPv4 in custom dict
People should use IPv6. All the existing code is handling IPv6.
2023-09-23 19:11:20 +02:00
Vincent Bernat
5a5820a51a common/kafka: don't try to fiddle with brokers
Assume that if we can refresh metadata we are OK.
2023-09-17 08:56:49 +02:00
Vincent Bernat
4fa05560b8 common/kafka: pace Kafka broker setup tentatives 2023-09-17 08:20:41 +02:00
Vincent Bernat
6dc0b512c6 console/filter: add filtering support for custom columns
Some of the code is based on #870.
2023-09-16 17:19:12 +02:00
Marvin Gaube
5efa368e79 feat: add option for materialized types & improve filter performance for materialized Prefixes 2023-09-08 20:54:27 +02:00
Vincent Bernat
d01cdde571 common/helpers: also validate when testing decoder 2023-09-05 23:31:45 +02:00
Vincent Bernat
e842202b82 common/helpers: test validation of SubnetMap with a complex type 2023-09-05 23:06:12 +02:00
Vincent Bernat
2ba10b0195 common/helpers: add more pretty formatter for SubnetMap
This is annoying to have to do that for each of them...
2023-09-05 23:06:08 +02:00
Vincent Bernat
d1cef41849 common/schema: don't store number of dynamic columns as state
Instead, we compute the maximum value for `Key` among the current set of columns.
2023-08-25 22:20:52 +02:00