-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/loki] Add logic implementation #19217
Conversation
Foresight Summary
View More Details⭕ build-and-test-windows workflow has finished in 13 seconds (31 minutes 27 seconds less than
|
Job | Failed Steps | Tests | |
---|---|---|---|
windows-unittest-matrix | - 🔗 | N/A | See Details |
windows-unittest | - 🔗 | N/A | See Details |
✅ check-links workflow has finished in 48 seconds and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
changed files | - 🔗 | N/A | See Details |
check-links | - 🔗 | N/A | See Details |
✅ telemetrygen workflow has finished in 1 minute 7 seconds and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
build-dev | - 🔗 | N/A | See Details |
publish-latest | - 🔗 | N/A | See Details |
publish-stable | - 🔗 | N/A | See Details |
✅ changelog workflow has finished in 3 minutes 6 seconds (⚠️ 51 seconds more than main
branch avg.) and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
changelog | - 🔗 | N/A | See Details |
✅ build-and-test workflow has finished in 42 minutes 43 seconds and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
unittest-matrix (1.19, connector) | - 🔗 | ✅ 126 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, connector) | - 🔗 | ✅ 126 ❌ 0 ⏭ 0 🔗 | See Details |
correctness-metrics | - 🔗 | ✅ 2 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, internal) | - 🔗 | ✅ 583 ❌ 0 ⏭ 0 🔗 | See Details |
correctness-traces | - 🔗 | ✅ 17 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, internal) | - 🔗 | ✅ 583 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, extension) | - 🔗 | ✅ 544 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, processor) | - 🔗 | ✅ 1557 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, extension) | - 🔗 | ✅ 544 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, processor) | - 🔗 | ✅ 1557 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, receiver-0) | - 🔗 | ✅ 2616 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, receiver-0) | - 🔗 | ✅ 2616 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, receiver-1) | - 🔗 | ✅ 1969 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, exporter) | - 🔗 | ✅ 2510 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, exporter) | - 🔗 | ✅ 2510 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, receiver-1) | - 🔗 | ✅ 1969 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.20, other) | - 🔗 | ✅ 4765 ❌ 0 ⏭ 0 🔗 | See Details |
integration-tests | - 🔗 | ✅ 56 ❌ 0 ⏭ 0 🔗 | See Details |
unittest-matrix (1.19, other) | - 🔗 | ✅ 4765 ❌ 0 ⏭ 0 🔗 | See Details |
setup-environment | - 🔗 | N/A | See Details |
check-codeowners | - 🔗 | N/A | See Details |
build-examples | - 🔗 | N/A | See Details |
checks | - 🔗 | N/A | See Details |
check-collector-module-version | - 🔗 | N/A | See Details |
lint-matrix (receiver-0) | - 🔗 | N/A | See Details |
lint-matrix (receiver-1) | - 🔗 | N/A | See Details |
lint-matrix (processor) | - 🔗 | N/A | See Details |
lint-matrix (extension) | - 🔗 | N/A | See Details |
lint-matrix (exporter) | - 🔗 | N/A | See Details |
lint-matrix (connector) | - 🔗 | N/A | See Details |
lint-matrix (internal) | - 🔗 | N/A | See Details |
lint-matrix (other) | - 🔗 | N/A | See Details |
lint | - 🔗 | N/A | See Details |
unittest (1.20) | - 🔗 | N/A | See Details |
unittest (1.19) | - 🔗 | N/A | See Details |
cross-compile (darwin, amd64) | - 🔗 | N/A | See Details |
cross-compile (darwin, arm64) | - 🔗 | N/A | See Details |
cross-compile (linux, 386) | - 🔗 | N/A | See Details |
cross-compile (linux, amd64) | - 🔗 | N/A | See Details |
cross-compile (linux, arm) | - 🔗 | N/A | See Details |
cross-compile (linux, arm64) | - 🔗 | N/A | See Details |
cross-compile (linux, ppc64le) | - 🔗 | N/A | See Details |
cross-compile (windows, 386) | - 🔗 | N/A | See Details |
cross-compile (windows, amd64) | - 🔗 | N/A | See Details |
build-package (rpm) | - 🔗 | N/A | See Details |
build-package (deb) | - 🔗 | N/A | See Details |
windows-msi | - 🔗 | N/A | See Details |
publish-check | - 🔗 | N/A | See Details |
publish-stable | - 🔗 | N/A | See Details |
publish-dev | - 🔗 | N/A | See Details |
rotate-milestone | - 🔗 | N/A | See Details |
✅ prometheus-compliance-tests workflow has finished in 10 minutes 32 seconds (⚠️ 4 minutes 12 seconds more than main
branch avg.) and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
prometheus-compliance-tests | - 🔗 | ✅ 21 ❌ 0 ⏭ 0 🔗 | See Details |
✅ load-tests workflow has finished in 15 minutes 42 seconds (⚠️ 5 minutes 23 seconds more than main
branch avg.) and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
loadtest (TestTraceAttributesProcessor) | - 🔗 | ✅ 3 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestIdleMode) | - 🔗 | ✅ 1 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestMetric10kDPS|TestMetricsFromFile) | - 🔗 | ✅ 6 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestTraceNoBackend10kSPS|TestTrace1kSPSWithAttrs) | - 🔗 | ✅ 8 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestMetricResourceProcessor|TestTrace10kSPS) | - 🔗 | ✅ 12 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestTraceBallast1kSPSWithAttrs|TestTraceBallast1kSPSAddAttrs) | - 🔗 | ✅ 10 ❌ 0 ⏭ 0 🔗 | See Details |
loadtest (TestBallastMemory|TestLog10kDPS) | - 🔗 | ✅ 18 ❌ 0 ⏭ 0 🔗 | See Details |
setup-environment | - 🔗 | N/A | See Details |
✅ e2e-tests workflow has finished in 17 minutes 47 seconds (⚠️ 3 minutes 42 seconds more than main
branch avg.) and finished at 5th Apr, 2023.
Job | Failed Steps | Tests | |
---|---|---|---|
kubernetes-test (v1.26.0) | - 🔗 | N/A | See Details |
kubernetes-test (v1.25.3) | - 🔗 | N/A | See Details |
kubernetes-test (v1.24.7) | - 🔗 | N/A | See Details |
kubernetes-test (v1.23.13) | - 🔗 | N/A | See Details |
*You can configure Foresight comments in your organization settings page.
4c24100
to
a8b5649
Compare
db10104
to
0f79045
Compare
@kovrus this PR is ready for review |
if len(buffer.Bytes()) > maxSize { | ||
return nil, fmt.Errorf(messageSizeLargerErrFmt, len(buffer.Bytes()), maxSize) | ||
} | ||
switch compression { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the only code path leading here already within a similar switch statement? Perhaps just have the logic from RawSnappy here directly, and perhaps even remove the compression type if snappy is the only supported compression mechanism at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored methods, removed compressionType argument, because currently only Snappy is supported
return r, err | ||
if conf.HTTP != nil { | ||
r.httpMux = http.NewServeMux() | ||
r.httpMux.HandleFunc("/loki/api/v1/push", func(resp http.ResponseWriter, req *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we are missing on the OTLP receiver is the ability to let users specify a path prefix, making it easier to place this code behind a reverse proxy. What do you think about doing the same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean we can add prefix as field in the config?
receivers:
loki:
protocols:
http:
prefix: "/proxy"
and use it in handler:
r.httpMux.HandleFunc(fmt.Sprintf("%s/loki/api/v1/push", r.conf.prefix),...
like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Perhaps "pathPrefix" would be a better name? Or perhaps even something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done afterward. I think we can merge this as is.
receiver/lokireceiver/loki.go
Outdated
} | ||
|
||
if r.conf.GRPC != nil { | ||
r.settings.Logger.Info("Creating GRPC server") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a similar entry already in startGRPCServer
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed this line, thank you!
func (r *lokiReceiver) Push(ctx context.Context, pushRequest *push.PushRequest) (*push.PushResponse, error) { | ||
logs, err := loki.PushRequestToLogs(pushRequest, r.conf.KeepTimestamp) | ||
if err != nil { | ||
r.settings.Logger.Warn(ErrAtLeastOneEntryFailedToProcess, zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a bad payload, I think it would be better to perhaps count the number of errors instead of logging a warning on every such error. Perhaps add this to debug level instead, so that people can see what's wrong in non-prod environments, or temporarily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the number of errors as well.
This error is logged once per push request, which shouldn't be much.
I think it is good to have this warning in production so users can identify what requests contain incorrect labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I still think that this has the potential to flood the logs, as a bad payload is typically a sign of a wrongly configured client, I trust your judgment here.
7b04776
to
b635c45
Compare
return r, err | ||
if conf.HTTP != nil { | ||
r.httpMux = http.NewServeMux() | ||
r.httpMux.HandleFunc("/loki/api/v1/push", func(resp http.ResponseWriter, req *http.Request) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done afterward. I think we can merge this as is.
func (r *lokiReceiver) Push(ctx context.Context, pushRequest *push.PushRequest) (*push.PushResponse, error) { | ||
logs, err := loki.PushRequestToLogs(pushRequest, r.conf.KeepTimestamp) | ||
if err != nil { | ||
r.settings.Logger.Warn(ErrAtLeastOneEntryFailedToProcess, zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I still think that this has the potential to flood the logs, as a bad payload is typically a sign of a wrongly configured client, I trust your judgment here.
@jpkrohling can we merge this? or shall I wait for more approves? |
Description:
The first PR with the skeleton is here #19399
This PR is the second one, with the concrete implementation of the component
Link to tracking Issue:
18635
Testing: Added unit tests