Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: add rule tags to metrics #65

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

jasondellaluce
Copy link
Contributor

Signed-off-by: Jason Dellaluce [email protected]

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 <[email protected]>
@poiana poiana requested review from leodido and leogr September 27, 2021 13:57
@poiana
Copy link

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
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 <[email protected]>
@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
Contributor Author

This PR has been unblocked after the release of [email protected], so it is now ready for a review.

@@ -3,8 +3,8 @@ module github.com/falcosecurity/falco-exporter
go 1.14

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
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
Member

leogr commented Sep 30, 2021

/milestone 0.6.0

Copy link
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

poiana commented Oct 4, 2021

LGTM label has been added.

Git tree hash: b26aba1f37e059b445e8f9f8f02c0dfd7c9d2f36

@poiana
Copy link

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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "tags" to metrics
3 participants