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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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).

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
@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 84.57711% with 31 lines in your changes missing coverage. Please review.

Project coverage is 66.01%. Comparing base (8875dfe) to head (867ad8c).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/pipeline/encode/metrics_common.go 78.78% 15 Missing and 6 partials ⚠️
pkg/pipeline/encode/metrics/flattening.go 92.30% 4 Missing ⚠️
pkg/pipeline/encode/metrics/preprocess.go 86.36% 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   65.41%   66.01%   +0.59%     
==========================================
  Files         108      110       +2     
  Lines        7026     7138     +112     
==========================================
+ Hits         4596     4712     +116     
+ Misses       2110     2108       -2     
+ Partials      320      318       -2     
Flag Coverage Δ
unittests 66.01% <84.57%> (+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.38% <100.00%> (ø)
pkg/pipeline/extract/aggregate/aggregate.go 92.43% <100.00%> (ø)
pkg/pipeline/write/write_loki.go 71.42% <100.00%> (ø)
pkg/pipeline/ingest/ingest_grpc.go 75.86% <50.00%> (ø)
pkg/pipeline/encode/encode_prom.go 51.30% <71.42%> (ø)
pkg/pipeline/encode/metrics/preprocess.go 86.02% <86.36%> (ø)
pkg/pipeline/encode/metrics/flattening.go 92.30% <92.30%> (ø)
pkg/pipeline/encode/metrics_common.go 84.21% <78.78%> (+3.63%) ⬆️

... and 1 file with indirect coverage changes

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.

2 participants