Git Product home page Git Product logo

snyk_exporter's People

Contributors

crevil avatar dantarian avatar dependabot[bot] avatar hoeg avatar kaspernissen avatar lunar-renovate avatar mahlunar avatar nixboot avatar omerlh avatar opdude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snyk_exporter's Issues

Upgrading to v1.3.1 produces unexpected crashes

Describe the bug
Upgrading the exporter from v1.2.0->v1.3.1 is causing it to crash multiple times a day. The exporter is running on kubernetes and crashes when it's liveness probe tries to access /healthz and gets the following error - net/http: request canceled (Client.Timeout exceeded while awaiting headers).

To Reproduce
Steps to reproduce the behavior:

  1. Publish the exporter as a k8s pod, with /healthz configured as the liveness probe
  2. Wait for a few hours until the pod crashes.

Expected behavior
The container health check should either return a healthy response or produce a descriptive error of the cause for crashing.

Application (please complete the following information):

  • Distribution: Docker image
  • Version 1.3.1

Log output (if applicable):
This log record is printed just before the pod crashes, but it's probably the sigterm received from k8s causing it -

time="2019-07-15T07:24:58Z" level=error msg="Snyk exporter exited due to error: received os signal 'terminated'" source="main.go:119"

Additional context
Exporter is running fine on v1.2.0. I will try to bisect the issue to a specific release and perhaps narrow it down to a specific feature by gradually incrementing the exporter version and update when I have more info.

Application exits on timeouts

It should be expected to see request timeouts once in a while and the application should just ignore these as another scrape will occur in the near future anyway.

Here is an example of the log line just before an exit.

time="2019-02-23T10:34:32Z" level=error msg="Snyk exporter exited due to error: Get https://snyk.io/api/v1/org/UUID/projects: net/http: request canceled (Client.Timeout exceeded while awaiting headers)" source="main.go:83"

Don't exit on errors

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"}

Filter ignored issues

Currently, the request to get issues does not filter ignored issues:

postData := issuesPostData{
		Filters: issueFilters{
			Severities: []string{
				"high", "medium", "low",
			},
		},
	}

See the API documentation for more details. I'm working on a fix PR.

package the binary in a docker container

Wrapping the binary in a docker container would make the usability of the project better. A simple example of a docker run with the arguments to deploy and run this container.

Organization name can change when using --snyk.organization and all organizations

If you specify an organization through the flags, that name will be used for the metrics. Here you need to specify the organizations original name, opposed to the display name.

We tag metrics with the original name in these cases.

If you run the exporter without the organization flag, we export all organizations related to the token. Here we lavel metrics with the display name instead which can lead to confusing behaviour.

snyk_vulnerabilities_total{organization="my-org",project="my-app",severity="low",type="Sandbox (chroot) Escape"} 2.0
snyk_vulnerabilities_total{organization="my-org",project="My App",severity="low",type="Sandbox (chroot) Escape"} 2.0

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • Update actions/setup-go action to v4
  • Update goreleaser/goreleaser-action action to v4

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • Update actions/checkout action to v3.5.3

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • golang 1.19.3
Dockerfile-goreleaser
  • alpine 3.16.3
github-actions
.github/workflows/build.yml
  • actions/checkout v3.1.0
  • actions/setup-go v3
  • actions/cache v3
.github/workflows/codeql-analysis.yml
  • actions/checkout v3.1.0
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/release-drafter.yml
  • release-drafter/release-drafter v5
.github/workflows/release.yml
  • actions/checkout v3.1.0
  • actions/setup-go v3
  • actions/cache v3
  • docker/login-action v2
  • goreleaser/goreleaser-action v3
gomod
go.mod
  • github.com/prometheus/client_golang v1.8.0
  • github.com/prometheus/common v0.15.0
  • gopkg.in/alecthomas/kingpin.v2 v2.2.6

Duplicate metrics upon ignore

Hi,

After ignoring a vulnerability the exporter adds another gauge with the ignore: true label, but doesn't remove the old metric with ignore: false.

It requires server restart to get only the updated metric.

Add /healthz endpoint for kubernetes probes

For easy kubernetes monitoring, we need to provide readyness and liveness probes. The /healthz should always return true, I would like to have /ready that returns true only if the initial scrap completed. So the pod will get traffic only when it finish scarping, and expose the correct metrics

Add support for isUpgradeable/isPatchable

Snyk API exposes 2 properties that can help devs understand if the issue is actionable - isUpgradeable and isPatchable. I think this can be nice to expose them also on the exporter.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.