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

fix(loki): fix the deadlock in Loki integration #647

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

bsod90
Copy link
Contributor

@bsod90 bsod90 commented Sep 25, 2023

I believe this should be the fix for #646, but I'm still figuring out a way to test it locally.

@poiana
Copy link

poiana commented Sep 25, 2023

There is not a label identifying the kind of this PR.
Please specify it either using /kind <group> or manually from the side menu.

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/test-infra repository.

@poiana
Copy link

poiana commented Sep 25, 2023

Welcome @bsod90! It looks like this is your first PR to falcosecurity/falcosidekick 🎉

@poiana poiana added the size/S label Sep 25, 2023
Copy link
Member

@Issif Issif left a comment

Choose a reason for hiding this comment

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

As you confirmed it works, I'm approving.

FYI, I would have used anonymous functions.

Something like:

func (c *Client) LokiPost(falcopayload types.FalcoPayload) {
	c.Stats.Loki.Add(Total, 1)
	c.ContentType = LokiContentType

	if c.Config.Loki.User != "" && c.Config.Loki.APIKey != "" {
		func() {
				c.httpClientLock.Lock()
				defer c.httpClientLock.Unlock()
				c.BasicAuth(c.Config.Loki.User, c.Config.Loki.APIKey)
		}()
	}

@poiana
Copy link

poiana commented Sep 26, 2023

LGTM label has been added.

Git tree hash: cc3d9117460b639b38ae42541b004e150ee09662

@Issif Issif added this to the 2.29.0 milestone Sep 26, 2023
@Issif
Copy link
Member

Issif commented Sep 26, 2023

can you sign-off your commit please

@bsod90
Copy link
Contributor Author

bsod90 commented Sep 26, 2023

Thank you so much, @Issif !
Just added the sign-off
Also, didn't know about anonymous functions, Go isn't my first language :) Thanks!

Copy link
Member

@Issif Issif left a comment

Choose a reason for hiding this comment

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

All good, for the anonymous functions I thought it was interesting for you to mention them 😉

@poiana
Copy link

poiana commented Sep 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bsod90, Issif

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 merged commit 76871b4 into falcosecurity:master Sep 26, 2023
5 checks passed
@bsod90 bsod90 deleted the fix_loki_deadlock branch September 27, 2023 01:50
@bsod90
Copy link
Contributor Author

bsod90 commented Sep 27, 2023

A quick follow-up question: when do you expect the next minor release to be cut? I'm asking because I'm trying to use Loki integration in our infra and it would be easier to just use the official image instead of forking, custom-building, etc.
Thanks! @Issif

@Issif
Copy link
Member

Issif commented Sep 28, 2023

@bsod90
Copy link
Contributor Author

bsod90 commented Sep 28, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants