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

feat: Gracefully handle panics, add --log flag #8

Merged
merged 2 commits into from
Nov 13, 2022

Conversation

irvinlim
Copy link
Owner

@irvinlim irvinlim commented Nov 13, 2022

  • Add --log flag to change default log verbosity
  • Recover from panics in backend goroutines
  • Mark most backend ingestion errors as non-retryable, except from InfluxDB client

@codecov-commenter
Copy link

Codecov Report

Base: 73.00% // Head: 71.69% // Decreases project coverage by -1.31% ⚠️

Coverage data is based on head (c65cf50) compared to base (43d44ac).
Patch coverage: 50.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
- Coverage   73.00%   71.69%   -1.32%     
==========================================
  Files           7        7              
  Lines         515      537      +22     
==========================================
+ Hits          376      385       +9     
- Misses        109      121      +12     
- Partials       30       31       +1     
Impacted Files Coverage Δ
pkg/backends/influxdb/client.go 56.00% <0.00%> (-7.64%) ⬇️
pkg/backends/influxdb/backend.go 80.95% <12.50%> (-2.80%) ⬇️
pkg/ingester/ingester.go 84.25% <100.00%> (+1.43%) ⬆️

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.

@irvinlim irvinlim merged commit 3fba4b7 into main Nov 13, 2022
@irvinlim irvinlim deleted the irvinlim/feat/log-level branch November 13, 2022 19:55
@tedpearson
Copy link
Collaborator

That's quite a bit of work to handle issues with Influx I guess? Are you having issues with database availability?

@irvinlim
Copy link
Owner Author

That's quite a bit of work to handle issues with Influx I guess? Are you having issues with database availability?

Not really, I just found out that panics weren't handled in a separate goroutine from sending a bad payload, which may cause the server to crash. This fix will capture the panic as non-retryable errors (hence the need to mark only InfluxDB client errors as retryable).

@@ -13,6 +14,7 @@ var (

func init() {
pflag.StringVar(&listenAddr, "http.listenAddr", ":8080", "Address to listen on.")
pflag.Uint32Var(&logLevel, "log", 0, "Log level to use, defaults to 4 (INFO).")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like it defaults to 0 (PANIC) to me.... :trollface:
Also, maybe document the log levels or link to logrus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants