Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Improve no timezone db error #289

Merged
merged 3 commits into from
Oct 12, 2021

Conversation

BinaryFissionGames
Copy link
Contributor

Closes #288

This PR wraps the error returned from time.LoadLocation to include that a location was trying to be loaded, and that the timezone database may not be present.

@BinaryFissionGames BinaryFissionGames requested a review from a team October 12, 2021 17:49
@BinaryFissionGames BinaryFissionGames changed the title Improve no time db error Improve no timezone db error Oct 12, 2021
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #289 (80c1437) into main (a54a0a1) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #289     +/-   ##
=======================================
+ Coverage   76.8%   77.0%   +0.1%     
=======================================
  Files         94      94             
  Lines       4410    4410             
=======================================
+ Hits        3391    3397      +6     
+ Misses       700     697      -3     
+ Partials     319     316      -3     
Impacted Files Coverage Δ
operator/builtin/parser/syslog/syslog.go 69.6% <100.0%> (+1.7%) ⬆️
operator/helper/time.go 79.4% <100.0%> (+2.6%) ⬆️

Copy link
Member

@jsirianni jsirianni left a comment

Choose a reason for hiding this comment

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

👍

@@ -75,7 +75,7 @@ func (c SyslogParserConfig) Build(context operator.BuildContext) ([]operator.Ope

location, err := time.LoadLocation(c.Location)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to load location %s (is the timezone database installed?): %w", c.Location, err)
Copy link
Member

Choose a reason for hiding this comment

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

I can appreciate what you're getting at here, but an error message that asks a question is unusual. More importantly, I suspect this will be a red herring in the majority of cases, since the most common cause of this error will be users specifying an invalid location.

Copy link
Member

Choose a reason for hiding this comment

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

For context, on Windows, the timezone database is generally not present. While on Linux it is common to have the tzdata package installed by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I was kinda iffy on about putting that in there, too. I'll take the question out. Knowing that it failed to load the location should probably be enough to debug.

@djaglowski djaglowski merged commit a5830d6 into open-telemetry:main Oct 12, 2021
@djaglowski djaglowski deleted the improve-no-time-db-error branch October 12, 2021 19:57
djaglowski added a commit to djaglowski/opentelemetry-log-collection that referenced this pull request Nov 30, 2021
- `combine_with` setting to `recombine` operator, to allow for joining on custom delimiter ([PR315](open-telemetry#315))
- Issue where `force_flush_period` could cause line splitting to be skipped ([PR303](open-telemetry#303))
- Issue where `tcp_input` and `udp_input` could panic when stopping ([PR273](open-telemetry#273))
- Syslog severity mapping is now aligned with log specification ([PR300](open-telemetry#300))

- Improve error message when timezone database is not found ([PR289](open-telemetry#289))
djaglowski added a commit that referenced this pull request Nov 30, 2021
- `combine_with` setting to `recombine` operator, to allow for joining on custom delimiter ([PR315](#315))
- Issue where `force_flush_period` could cause line splitting to be skipped ([PR303](#303))
- Issue where `tcp_input` and `udp_input` could panic when stopping ([PR273](#273))
- Syslog severity mapping is now aligned with log specification ([PR300](#300))

- Improve error message when timezone database is not found ([PR289](#289))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve error message when time.LoadLocation fails
3 participants