Skip to content

Pgn/stat metrics#101

Closed
pinoOgni wants to merge 36 commits into
mainfrom
pgn/stat-metrics
Closed

Pgn/stat metrics#101
pinoOgni wants to merge 36 commits into
mainfrom
pgn/stat-metrics

Conversation

@pinoOgni

@pinoOgni pinoOgni commented Mar 4, 2026

Copy link
Copy Markdown
  • implement various TODOs
  • implement wakeup in ringbuf
  • add k8s env metric in devdocs
  • add unit tests in prometheus and otel exporters

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread bpf/statsolly/k_tcp.c Outdated
Comment thread bpf/statsolly/k_tcp.c Outdated
typedef struct tcp_rtt {
u8 flags; // Must be first, we use it to tell what kind of event we have on the ring buffer
u8 _pad[3];
u32 srtt;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change the name of this var to also contain the measure type used? eg. srtt_us or srtt_ms

@pinoOgni pinoOgni Mar 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right! I think srtt_ms is good, I changed also the go struct field to SrttMs even if at the end is exported as seconds.. maybe we can decide the best option
Ok I think it's better to use srtt_us for the entire path and then at the end export it in second.

Comment thread bpf/statsolly/k_tcp.c Outdated
Comment thread bpf/statsolly/stats.c Outdated
Comment thread internal/test/integration/docker-compose-go-stat-metrics.yml

func log() *slog.Logger { return slog.With("component", "k8s.MetadataDecorator") }

func MetadataDecoratorProvider(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now why this code is here, I think se should define the types first, and refactor all these enrichers to be generic, maybe in a different PR

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to write this in the previous comment.. it seems too much to modify it in this PR but yes, this and other decorators could be common!

Comment thread pkg/obi/stats_cfg.go Outdated
Comment thread pkg/obi/stats_cfg.go
// TODO pinoOgni: right now it is a copy and paste of more or less netolly config
type StatsConfig struct {
// AgentIP allows overriding the reported Agent IP address on each stat.
AgentIP string `yaml:"agent_ip" env:"OTEL_EBPF_STATS_AGENT_IP" validate:"omitempty,ip" jsonschema:"type=string,format=ip"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be refactored to inherit from some struct in common with netolly?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking something similar but in that case we will have issues with the env variables

Comment thread pkg/obi/stats_cfg.go Outdated

GeoIP stats.GeoIP `yaml:"geo_ip"`

// TODO pinoOgni add more granular configuration

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover?

@pinoOgni pinoOgni Mar 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to add a more granular configuration, not now but in future PRs so the user can select which metric calculate. Right now the idea is to "calculate everything and then the user can filter using attributes or the collector"
WDYT?
Update: I removed the comment, maybe I can do it in another PR

Comment thread pkg/pipe/global/context.go
pinoOgni added 28 commits March 5, 2026 17:03
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
exported with prom and otel

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
add iters in the appnetworktracer

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Pin listening_ports map.

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
probes to calculate metric if the hook point is equal

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
as stats metrics

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
- Define statsolly
- Define statsolly pipeline
- Add sample tcp rtt ebpf probe
- Update configuration to use statsolly

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
pinoOgni added 7 commits March 5, 2026 17:03
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
…olly

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
…ostInfo

Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
Signed-off-by: Giuseppe Ognibene <giuseppe.ognibene@coralogix.com>
@mmat11

mmat11 commented Mar 7, 2026

Copy link
Copy Markdown

I think we should split the PR in multiple smaller ones, something like:

  • Initial statsolly types definitions
  • Decorators and common parts refactor into generic ones
  • Implementation with the previously added generic decorators and so on

I think it would be a bit too much to review all three in a single PR upstream

@pinoOgni pinoOgni closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants