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-1382 - Custom metrics from config #431

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Nov 13, 2023

Description

I took the opportunity of NETOBSERV-1382 to allow custom metrics definition in console plugin config from a simple list of ids such as:

 panels: 
    # Protocol
    - Proto_Bytes
    - sum_Proto_Bytes
    - avg_Proto_Bytes
    - Proto_Packets
    - sum_Proto_Packets
    - avg_Proto_Packets
    - Proto_Flows
    # DSCP
    - Dscp_Bytes
    - Dscp_Packets
    - min_Dscp_TimeFlowRttNs
    - max_Dscp_TimeFlowRttNs
    - avg_Dscp_TimeFlowRttNs
    - p90_Dscp_TimeFlowRttNs
    - p99_Dscp_TimeFlowRttNs
    - min_Dscp_DnsLatencyMs
    - max_Dscp_DnsLatencyMs
    - avg_Dscp_DnsLatencyMs
    - p90_Dscp_DnsLatencyMs
    - p99_Dscp_DnsLatencyMs
    - Dscp_Flows
    # Port numbers
    - SrcPort_Bytes
    - sum_SrcPort_Bytes
    - SrcPort_Packets
    - sum_SrcPort_Packets
    - SrcPort_TimeFlowRttNs
    - min_SrcPort_TimeFlowRttNs
    - max_SrcPort_TimeFlowRttNs
    - avg_SrcPort_TimeFlowRttNs
    - p90_SrcPort_TimeFlowRttNs
    - p99_SrcPort_TimeFlowRttNs
    - DstPort_Bytes
    - sum_DstPort_Bytes
    - DstPort_Packets
    - sum_DstPort_Packets
    - min_DstPort_TimeFlowRttNs
    - max_DstPort_TimeFlowRttNs
    - avg_DstPort_TimeFlowRttNs
    - p90_DstPort_TimeFlowRttNs
    - p99_DstPort_TimeFlowRttNs
    # Directions
    - FlowDirection_Bytes
    - FlowDirection_Packets
    - FlowDirection_Flows
    - IfDirection_Bytes
    - IfDirection_Packets
    - IfDirection_Flows
    # Interface names
    - Interface_Bytes
    - sum_Interface_Bytes
    - avg_Interface_Bytes
    - Interface_Packets
    - sum_Interface_Packets
    - avg_Interface_Packets
    - Interface_Flows
    # DNS capture errors
    - DnsErrno_Flows
    # Connection tracking flow count
    - numFlowLogs_Flows
    # Bytes / Packets rates on current scope
    - Bytes
    - Packets
    # flow on current scope
    - Flows
    - DnsFlows

The ids are parsed as:

  • MetricFunction (optionnal)
  • AggregateBy (optionnal)
  • MetricType

Custom metrics results are saved in a Map<string, TopologyMetrics[] | GenericMetric[]>
Their total are in a similar Map<string, TopologyMetrics | GenericMetric>
Overview panel allow a donut or graph for each of these.

image
image
image
image
image

See 25faa35 for change list

Dependencies

Based on #412

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.

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

@jpinsonneau jpinsonneau marked this pull request as draft November 13, 2023 12:29
@jpinsonneau jpinsonneau changed the title Custom_metrics Custom metrics from config Nov 13, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: Patch coverage is 52.39726% with 139 lines in your changes are missing coverage. Please review.

Project coverage is 57.40%. Comparing base (d57cf70) to head (472facc).

Files Patch % Lines
...c/components/netflow-overview/netflow-overview.tsx 30.50% 40 Missing and 1 partial ⚠️
web/src/components/netflow-traffic.tsx 55.73% 27 Missing ⚠️
web/src/utils/overview-panels.ts 46.15% 11 Missing and 10 partials ⚠️
pkg/loki/topology_query.go 65.00% 10 Missing and 4 partials ⚠️
pkg/loki/flow_query.go 0.00% 6 Missing ⚠️
...components/query-summary/metrics-query-summary.tsx 16.66% 3 Missing and 2 partials ⚠️
web/src/utils/metrics.ts 58.33% 4 Missing and 1 partial ⚠️
web/src/model/topology.ts 0.00% 4 Missing ⚠️
pkg/handler/topology.go 57.14% 2 Missing and 1 partial ⚠️
pkg/handler/validation.go 80.00% 2 Missing and 1 partial ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #431      +/-   ##
==========================================
- Coverage   57.49%   57.40%   -0.09%     
==========================================
  Files         167      167              
  Lines        8750     8842      +92     
  Branches     1131     1160      +29     
==========================================
+ Hits         5031     5076      +45     
- Misses       3397     3439      +42     
- Partials      322      327       +5     
Flag Coverage Δ
uitests 57.92% <49.32%> (-0.39%) ⬇️
unittests 55.88% <62.31%> (+0.70%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jpinsonneau
Copy link
Contributor Author

/hold

Following netobserv/network-observability-operator#550, this PR will need to be revisited to include FieldConfig

Copy link

New image:
quay.io/netobserv/network-observability-console-plugin:7df6957

It will expire after two weeks.

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

USER=netobserv VERSION=7df6957 make set-plugin-image

@jotak
Copy link
Member

jotak commented Mar 20, 2024

@jpinsonneau do you think this refactoring will work well when we'll add prometheus as a metrics backend (as per https://issues.redhat.com/browse/NETOBSERV-739) ?
I'm not sure to see a problem but what's your thoughts on that?

@jpinsonneau
Copy link
Contributor Author

@jpinsonneau do you think this refactoring will work well when we'll add prometheus as a metrics backend (as per https://issues.redhat.com/browse/NETOBSERV-739) ? I'm not sure to see a problem but what's your thoughts on that?

That should work fine and unlock custom metrics based on available labels in prom

Copy link

openshift-ci bot commented Mar 22, 2024

New changes are detected. LGTM label has been removed.

@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 Mar 22, 2024
@jpinsonneau
Copy link
Contributor Author

Rebased without code changes

Comment on lines +115 to +127
# TODO: implement a way to manage plurals for interfaces
# Interfaces Directions
#- IfDirections_Bytes
#- IfDirections_Packets
#- IfDirections_Flows
# Interfaces names
#- Interfaces_Bytes
#- sum_Interfaces_Bytes
#- avg_Interfaces_Bytes
#- Interfaces_Packets
#- sum_Interfaces_Packets
#- avg_Interfaces_Packets
#- Interfaces_Flows
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since these fields went plural, this is not working anymore

Loki is supposed to be able to unwarp arrays but it will need some improvments on query side
grafana/loki#4488 (comment)

@jpinsonneau jpinsonneau added ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. and removed do-not-merge/hold labels Mar 25, 2024
Copy link

New image:
quay.io/netobserv/network-observability-console-plugin:6176604

It will expire after two weeks.

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

USER=netobserv VERSION=6176604 make set-plugin-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 Mar 29, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 52.39726% with 139 lines in your changes are missing coverage. Please review.

Project coverage is 57.40%. Comparing base (d57cf70) to head (b139478).
Report is 2 commits behind head on main.

Files Patch % Lines
...c/components/netflow-overview/netflow-overview.tsx 30.50% 40 Missing and 1 partial ⚠️
web/src/components/netflow-traffic.tsx 55.73% 27 Missing ⚠️
web/src/utils/overview-panels.ts 46.15% 11 Missing and 10 partials ⚠️
pkg/loki/topology_query.go 65.00% 10 Missing and 4 partials ⚠️
pkg/loki/flow_query.go 0.00% 6 Missing ⚠️
...components/query-summary/metrics-query-summary.tsx 16.66% 3 Missing and 2 partials ⚠️
web/src/utils/metrics.ts 58.33% 4 Missing and 1 partial ⚠️
web/src/model/topology.ts 0.00% 4 Missing ⚠️
pkg/handler/topology.go 57.14% 2 Missing and 1 partial ⚠️
pkg/handler/validation.go 80.00% 2 Missing and 1 partial ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #431      +/-   ##
==========================================
- Coverage   57.49%   57.40%   -0.09%     
==========================================
  Files         167      167              
  Lines        8750     8842      +92     
  Branches     1131     1160      +29     
==========================================
+ Hits         5031     5076      +45     
- Misses       3397     3439      +42     
- Partials      322      327       +5     
Flag Coverage Δ
uitests 57.92% <49.32%> (-0.39%) ⬇️
unittests 55.88% <62.31%> (+0.70%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 29, 2024

/ok-to-test

@openshift-ci openshift-ci bot added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Mar 29, 2024
Copy link

New image:
quay.io/netobserv/network-observability-console-plugin:2d062c4

It will expire after two weeks.

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

USER=netobserv VERSION=2d062c4 make set-plugin-image

@Amoghrd
Copy link
Contributor

Amoghrd commented Mar 29, 2024

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved QE has approved this pull request label Mar 29, 2024
Copy link

openshift-ci bot commented Mar 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

@openshift-merge-bot openshift-merge-bot bot merged commit 152ca7a into netobserv:main Mar 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. qe-approved QE has approved this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants