Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Don't exit on errors #36

Closed
Crevil opened this issue Oct 7, 2019 · 1 comment · Fixed by #37
Closed

Don't exit on errors #36

Crevil opened this issue Oct 7, 2019 · 1 comment · Fixed by #37

Comments

@Crevil
Copy link
Contributor

Crevil commented Oct 7, 2019

Describe the bug
We see that the exporter exits regularly due to some intermediate errors or issues at the Snyk APIs. This is generally an odd behaviour and should instead just be logged, as the exporter is not failing in its operation.

Here is a common error we see due to connection closing:

Get https://snyk.io/api/v1/org/UUID/projects: read tcp IP:36810-\u003eIP:443: read: connection reset by peer

To Reproduce

Add a test case for above error to TestPoll.

{
	name: "tcp connection reset by peer",
	collectorErr: &url.Error{
		Op:  "GET",
		URL: "/url",
		Err: &net.OpError{
			Op:  "read",
			Net: "tcp",
			Addr: &net.IPAddr{
				IP: net.IPv4zero,
			},
			Err: &net.OpError{
				Op:  "read",
				Err: syscall.ECONNRESET,
			},
		},
	},
	output: nil,
},

Expected behavior
The error should just be logged as above but the application should keep on running.

Application (please complete the following information):

  • Distribution: Docker image
  • Version 1.4.0

Log output (if applicable):

{"level":"error","msg":"Snyk exporter exited due to error: organization NAME (UUID): Get https://snyk.io/api/v1/org/UUID/projects: read tcp IP:36810-\u003eIP:443: read: connection reset by peer","source":"main.go:121","time":"2019-10-04T10:08:23Z"}
@Crevil
Copy link
Contributor Author

Crevil commented Oct 7, 2019

Related to #13 and #14

By implementing above mentioned functionality we can get rid of all the special handling of errors.

Crevil pushed a commit that referenced this issue Oct 7, 2019
This change removes special handling of collection errors and thus
eliminating exits due to those.
In case of any error due to collection we log the details and move on to
the next available organization.

Fixes #36
@Crevil Crevil closed this as completed in #37 Oct 7, 2019
Crevil pushed a commit that referenced this issue Oct 7, 2019
This change removes special handling of collection errors and thus
eliminating exits due to those.
In case of any error due to collection we log the details and move on to
the next available organization.

Closes #36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant