Skip to content

Conversation

leandroberetta
Copy link

Description

Support for writing logs to Loki (distributor) using gRPC

Ref: https://issues.redhat.com/browse/NETOBSERV-584

Dependencies

netobserv/loki-client-go#3

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

To run a perfscale test, comment with: /test flp-node-density-heavy-25nodes

Copy link

codecov bot commented Sep 11, 2025

Codecov Report

❌ Patch coverage is 77.62238% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.97%. Comparing base (838c22c) to head (be97be3).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
pkg/pipeline/write/write_loki.go 68.81% 20 Missing and 9 partials ⚠️
pkg/api/write_loki.go 94.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1086      +/-   ##
==========================================
+ Coverage   65.67%   65.97%   +0.30%     
==========================================
  Files         121      121              
  Lines        8934     9065     +131     
==========================================
+ Hits         5867     5981     +114     
- Misses       2735     2747      +12     
- Partials      332      337       +5     
Flag Coverage Δ
unittests 65.97% <77.62%> (+0.30%) ⬆️

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

Files with missing lines Coverage Δ
pkg/api/write_loki.go 89.88% <94.00%> (+18.45%) ⬆️
pkg/pipeline/write/write_loki.go 74.50% <68.81%> (+0.82%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leandroberetta leandroberetta added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Sep 11, 2025
Copy link

New image:
quay.io/netobserv/flowlogs-pipeline:232d236

It will expire after two weeks.

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

USER=netobserv VERSION=232d236 make set-flp-image

@leandroberetta leandroberetta marked this pull request as ready for review September 15, 2025 11:45
@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 Sep 23, 2025
@leandroberetta leandroberetta changed the title Support for writing logs to Loki (distributor) using gRPC NETOBSERV-584: Support for writing logs to Loki (distributor) using gRPC Sep 23, 2025
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Sep 23, 2025

@leandroberetta: This pull request references NETOBSERV-584 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.21.0" version, but no target version was set.

In response to this:

Description

Support for writing logs to Loki (distributor) using gRPC

Ref: https://issues.redhat.com/browse/NETOBSERV-584

Dependencies

netobserv/loki-client-go#3

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

To run a perfscale test, comment with: /test flp-node-density-heavy-25nodes

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.

@leandroberetta leandroberetta added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Sep 23, 2025
Copy link

New image:
quay.io/netobserv/flowlogs-pipeline:fecd9f7

It will expire after two weeks.

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

USER=netobserv VERSION=fecd9f7 make set-flp-image

MaxSendMsgSize int `yaml:"maxSendMsgSize,omitempty" json:"maxSendMsgSize,omitempty" doc:"maximum message size the client can send"`
KeepAlive string `yaml:"keepAlive,omitempty" json:"keepAlive,omitempty" doc:"keep alive interval"`
KeepAliveTimeout string `yaml:"keepAliveTimeout,omitempty" json:"keepAliveTimeout,omitempty" doc:"keep alive timeout"`
TLS *GRPCTLSConfig `yaml:"tls,omitempty" json:"tls,omitempty" doc:"TLS configuration"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, we may reuse ClientConfig that contains TLSConfig ?
https://github.com/prometheus/common/blob/v0.66.1/config/http_config.go#L1113

Copy link
Member

Choose a reason for hiding this comment

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

Just checked that, surely that's doable, but prom's TLS config contains more advanced settings (e.g. min / max versions) which we would need to support in our implementation in the loki-client, if we want to be consistent with the proposed settings. Or we would need to reuse prom's implementation but I'm not sure they have grpc in the go-client. So perhaps having our own struct is good enough for now, after all.

Copy link
Member

Choose a reason for hiding this comment

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

wait, actually, we do also have another TLS struct of our own: api.ClientTLS
That one could be reused easily, no ?
/hold

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I've just seen this comment, actually, I did the work to reuse the prom's tls config. Also, I've made the necessary changes in the loki-client-go at netobserv/loki-client-go#4

@jotak the one you mentioned is used for Kafka and it seemed to be more simple than the prom one, for example, for now, communicating with the distributor in grpc mode, I need to configure mTLS which I don't see that is possible with the kafka one.

Copy link
Member

Choose a reason for hiding this comment

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

oh, cool, that should be even better

@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 Sep 24, 2025
go.mod Outdated

replace github.com/vmware/go-ipfix => github.com/jotak/go-ipfix v0.0.0-20250708115123-407c539ea101

replace github.com/netobserv/loki-client-go => github.com/leandroberetta/loki-client-go v0.0.0-20250924145641-591b5499691d
Copy link
Member

Choose a reason for hiding this comment

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

you can now remove that as this was merged

Copy link
Member

@jotak jotak left a comment

Choose a reason for hiding this comment

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

/lgtm
thanks @leandroberetta !

[edit] actually, last-minute comment: #1086 (comment)

Copy link

openshift-ci bot commented Oct 9, 2025

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

openshift-ci bot commented Oct 9, 2025

@leandroberetta: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/qe-e2e-tests d01e386 link false /test qe-e2e-tests

Full PR test history. Your PR dashboard.

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

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.

5 participants