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

NETOBSERV-1935: enable metrics from list/nested fields #739

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

jotak
Copy link
Member

@jotak jotak commented Oct 14, 2024

This makes it possible to generate metrics with labels/filters set on list fields (e.g. interfaces) and nested fields (e.g. soon-coming structured network events)

In metrics API, user needs to configure explicitly which list field needs to be "flattened", in order to be consumable as filters/labels.

Nested fields can be consumed as filters/labels with the ">" character;

E.g: flatten: [networkEvents], filters: [{key: "networkEvents>type", value: "acl"}], labels: [networkEvents>name] This is a sample config to filter a metric for ACL events and label it by name

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Oct 14, 2024

@jotak: This pull request references NETOBSERV-1935 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

This makes it possible to generate metrics with labels/filters set on list fields (e.g. interfaces) and nested fields (e.g. soon-coming structured network events)

In metrics API, user needs to configure explicitly which list field needs to be "flattened", in order to be consumable as filters/labels.

Nested fields can be consumed as filters/labels with the ">" character;

E.g: flatten: [networkEvents], filters: [{key: "networkEvents>type", value: "acl"}], labels: [networkEvents>name] This is a sample config to filter a metric for ACL events and label it by name

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

openshift-ci bot commented Oct 14, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jotak. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 33 lines in your changes missing coverage. Please review.

Project coverage is 64.95%. Comparing base (5bb2146) to head (68583d8).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/pipeline/encode/metrics_common.go 79.81% 16 Missing and 6 partials ⚠️
pkg/pipeline/encode/metrics/flattening.go 92.42% 5 Missing ⚠️
pkg/pipeline/encode/metrics/preprocess.go 88.00% 3 Missing ⚠️
pkg/pipeline/encode/encode_prom.go 71.42% 2 Missing ⚠️
pkg/pipeline/ingest/ingest_grpc.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #739      +/-   ##
==========================================
+ Coverage   64.36%   64.95%   +0.59%     
==========================================
  Files         108      110       +2     
  Lines        8301     8436     +135     
==========================================
+ Hits         5343     5480     +137     
+ Misses       2639     2638       -1     
+ Partials      319      318       -1     
Flag Coverage Δ
unittests 64.95% <85.71%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/pipeline/encode/metrics/filtering.go 100.00% <100.00%> (ø)
...ipeline/encode/opentelemetry/encode_otlpmetrics.go 40.94% <100.00%> (ø)
pkg/pipeline/extract/aggregate/aggregate.go 93.10% <100.00%> (ø)
pkg/pipeline/write/write_loki.go 70.34% <100.00%> (ø)
pkg/pipeline/ingest/ingest_grpc.go 73.97% <50.00%> (ø)
pkg/pipeline/encode/encode_prom.go 49.54% <71.42%> (ø)
pkg/pipeline/encode/metrics/preprocess.go 87.03% <88.00%> (ø)
pkg/pipeline/encode/metrics/flattening.go 92.42% <92.42%> (ø)
pkg/pipeline/encode/metrics_common.go 84.45% <79.81%> (+3.56%) ⬆️

... and 1 file with indirect coverage changes

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Oct 17, 2024

@jotak: This pull request references NETOBSERV-1935 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

This makes it possible to generate metrics with labels/filters set on list fields (e.g. interfaces) and nested fields (e.g. soon-coming structured network events)

In metrics API, user needs to configure explicitly which list field needs to be "flattened", in order to be consumable as filters/labels.

Nested fields can be consumed as filters/labels with the ">" character;

E.g: flatten: [networkEvents], filters: [{key: "networkEvents>type", value: "acl"}], labels: [networkEvents>name] This is a sample config to filter a metric for ACL events and label it by name

Description

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

@OlivierCazade OlivierCazade left a comment

Choose a reason for hiding this comment

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

LGTM

This makes it possible to generate metrics with labels/filters set on
list fields (e.g. interfaces) and nested fields (e.g. soon-coming
structured network events)

In metrics API, user needs to configure explicitly which list field needs to
be "flattened", in order to be consumable as filters/labels.

Nested fields can be consumed as filters/labels with the ">" character;

E.g: `flatten: [networkEvents], filters: [{key: "networkEvents>type", value: "acl"}], labels: [networkEvents>name]`
This is a sample config to filter a metric for ACL events and label it by name
Copy link

openshift-ci bot commented Nov 13, 2024

New changes are detected. LGTM label has been removed.

@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Nov 13, 2024
Copy link

New image:
quay.io/netobserv/flowlogs-pipeline:61d8809

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=61d8809 make set-flp-image

@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Nov 13, 2024
@jotak
Copy link
Member Author

jotak commented Nov 14, 2024

I'm merging this one as it's not enabled / visible without the operator PR. netobserv/network-observability-operator#863 will make the feature visible.

@jotak jotak merged commit 5fba26a into netobserv:main Nov 14, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants