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

app/log: add loki client #1337

Merged
merged 7 commits into from
Nov 11, 2022
Merged

app/log: add loki client #1337

merged 7 commits into from
Nov 11, 2022

Conversation

corverroos
Copy link
Contributor

@corverroos corverroos commented Oct 21, 2022

Add simple loki client to directly sending logs to loki instead of jumping through docker-compose hoops. Still needs to be integrated.

category: feature
ticket: #1406

@corverroos corverroos added documentation Improvements or additions to documentation do not merge Indicate to bulldozer bot that this PR should not be merged and removed documentation Improvements or additions to documentation labels Oct 21, 2022
@codecov
Copy link

codecov bot commented Oct 21, 2022

Codecov Report

Base: 53.37% // Head: 53.44% // Increases project coverage by +0.07% 🎉

Coverage data is based on head (5625de8) compared to base (a485cb2).
Patch coverage: 66.66% of modified lines in pull request are covered.

❗ Current head 5625de8 differs from pull request most recent head e9e2b00. Consider uploading reports for the commit e9e2b00 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1337      +/-   ##
==========================================
+ Coverage   53.37%   53.44%   +0.07%     
==========================================
  Files         145      147       +2     
  Lines       18193    18316     +123     
==========================================
+ Hits         9710     9789      +79     
- Misses       7145     7178      +33     
- Partials     1338     1349      +11     
Impacted Files Coverage Δ
app/log/loki/client.go 63.15% <63.15%> (ø)
app/log/loki/batch.go 78.57% <78.57%> (ø)
dkg/transport.go 53.70% <0.00%> (-12.97%) ⬇️
core/qbft/qbft.go 80.88% <0.00%> (-1.48%) ⬇️
core/dutydb/memory.go 69.28% <0.00%> (+0.69%) ⬆️
core/leadercast/transport.go 76.33% <0.00%> (+1.18%) ⬆️
app/vmock.go 77.12% <0.00%> (+3.19%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@corverroos corverroos removed the do not merge Indicate to bulldozer bot that this PR should not be merged label Nov 10, 2022
@corverroos corverroos changed the title app/log: add PoC loki client app/log: add loki client Nov 10, 2022
Line: line,
})
if batch.Size() > c.batchMax {
batch = newBatch(c.service) // Just silently drop, there should have been multiple error logs below.
Copy link
Contributor

Choose a reason for hiding this comment

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

why dropping complete batch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for simplicity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per package godoc:

// It is best-effort, meaning it doesn't provide delivery guarantees, it will drop logs if
// loki isn't accessible. It is meant to be used in local dev environments or where log
// delivery isn't critical.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you need guarantees, then use proper 12factor app patterns and official tools.

case <-ticker.C:
// Do not send if the batch is too young
if batch.Age() < c.batchWait {
break
Copy link
Contributor

Choose a reason for hiding this comment

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

it should be continue rather than break?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@corverroos corverroos added the merge when ready Indicates bulldozer bot may merge when all checks pass label Nov 10, 2022
@obol-bulldozer obol-bulldozer bot merged commit 29e2cf1 into main Nov 11, 2022
@obol-bulldozer obol-bulldozer bot deleted the corver/promtail branch November 11, 2022 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants