Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

update: add rule tags to metrics#65

Merged
poiana merged 2 commits intofalcosecurity:masterfrom
jasondellaluce:metrics-tags-update
Oct 4, 2021
Merged

update: add rule tags to metrics#65
poiana merged 2 commits intofalcosecurity:masterfrom
jasondellaluce:metrics-tags-update

Conversation

@jasondellaluce
Copy link
Copy Markdown
Contributor

Signed-off-by: Jason Dellaluce jasondellaluce@gmail.com

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area pkg

What this PR does / why we need it:
After the recent merge of falcosecurity/falco#1714, Falco gRPC output service now has a field containing rule tags. This PR follows up to those updates by including rule tags in the exported metrics too, which has been an open issue for a while (see #53).

Which issue(s) this PR fixes:
Fixes #53

Additional notes:
Rule tags are implemented as a label inside the falco_events metric. The label is a simple concatenation of all the tags, separated by a comma (,). This has the benefit of not increasing the metric cardinality, which is a big concern in Prometheus. The tradeoff is that querying by rule tags requires the usage of a regex.

A little optimization has been adopted by adding commas at the beginning and at the end of the concatenated string. In this way, the tags label can be queried with a simpler regex like .*,tag,.* instead of (^|.*,)tag(,.*|$). This pattern is well explained here: https://www.robustperception.io/little-things-matter.

An example of tag-based query is reported below:

falco_events{tags=~".*,filesystem,.*"}

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
@poiana poiana requested review from leodido and leogr September 27, 2021 13:57
@poiana
Copy link
Copy Markdown

poiana commented Sep 27, 2021

Welcome @jasondellaluce! It looks like this is your first PR to falcosecurity/falco-exporter 🎉

@poiana poiana added the size/XS label Sep 27, 2021
@jasondellaluce
Copy link
Copy Markdown
Contributor Author

This is still a WIP until the next release of https://github.com/falcosecurity/client-go, which will presumably happen after Falco's 0.30.0 release. Module dependencies will need to be updated to include the changes introduced in falcosecurity/client-go#55.

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
@poiana poiana added size/XL and removed size/XS labels Sep 30, 2021
@jasondellaluce jasondellaluce changed the title wip: update: add rule tags to metrics update: add rule tags to metrics Sep 30, 2021
@jasondellaluce
Copy link
Copy Markdown
Contributor Author

This PR has been unblocked after the release of client-go@v0.4.0, so it is now ready for a review.

require (
github.com/falcosecurity/client-go v0.3.0
github.com/prometheus/client_golang v1.9.0
github.com/falcosecurity/client-go v0.4.0
Copy link
Copy Markdown
Member

@leogr leogr Sep 30, 2021

Choose a reason for hiding this comment

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

@jasondellaluce @leodido Thank you for making this happen! 🤗

@leogr
Copy link
Copy Markdown
Member

leogr commented Sep 30, 2021

/milestone 0.6.0

Copy link
Copy Markdown
Member

@leogr leogr left a comment

Choose a reason for hiding this comment

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

/approve

@poiana poiana added the lgtm label Oct 4, 2021
@poiana
Copy link
Copy Markdown

poiana commented Oct 4, 2021

LGTM label has been added.

DetailsGit tree hash: b26aba1f37e059b445e8f9f8f02c0dfd7c9d2f36

@poiana
Copy link
Copy Markdown

poiana commented Oct 4, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jasondellaluce, leogr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana added the approved label Oct 4, 2021
@poiana poiana merged commit cd431fa into falcosecurity:master Oct 4, 2021
@leogr leogr added this to the 0.6.0 milestone Oct 4, 2021
@jasondellaluce jasondellaluce deleted the metrics-tags-update branch October 8, 2021 07:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "tags" to metrics

3 participants