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

Commit 130ed72

Browse files
author
Bjørn
authored
Increase default interval to 10 minutes (#43)
Currently the scrape interval is 1 minute. As the metrics we are tracking are rather slow moving we can accept a delay of up to 10 minutes for changes to be reflected. This reduces the load in Snyk APIs significantly and also reduces resource usage of the exporter (as it does the scraping 10 times less).
1 parent 706e0d2 commit 130ed72

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,22 @@ usage: snyk_exporter --snyk.api-token=SNYK.API-TOKEN [<flags>]
3737
Snyk exporter for Prometheus. Provide your Snyk API token and the organization(s) to scrape to expose Prometheus metrics.
3838
3939
Flags:
40-
-h, --help Show context-sensitive help (also try --help-long and --help-man).
40+
-h, --help Show context-sensitive help (also try --help-long and --help-man).
4141
--snyk.api-url="https://snyk.io/api/v1"
42-
Snyk API URL
42+
Snyk API URL
4343
--snyk.api-token=SNYK.API-TOKEN
44-
Snyk API token
45-
-i, --snyk.interval=60 Polling interval for requesting data from Snyk API in seconds
44+
Snyk API token
45+
-i, --snyk.interval=600 Polling interval for requesting data from Snyk API in seconds
4646
--snyk.organization=SNYK.ORGANIZATION ...
47-
Snyk organization ID to scrape projects from (can be repeated for multiple organizations)
48-
--snyk.timeout=10 Timeout for requests against Snyk API
47+
Snyk organization ID to scrape projects from (can be repeated for multiple organizations)
48+
--snyk.timeout=10 Timeout for requests against Snyk API
4949
--web.listen-address=":9532"
50-
Address on which to expose metrics.
51-
--log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
50+
Address on which to expose metrics.
51+
--log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]
5252
--log.format="logger:stderr"
53-
Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"
54-
--version Show application version.
53+
Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"
54+
--version Show application version.
55+
5556
```
5657

5758
It is possible to use a file to pass arguments to the exporter.
@@ -66,7 +67,7 @@ And run the exporter using:
6667

6768
# Design
6869

69-
The exporter starts a long-running go routine on startup that scrapes the Snyk API with a fixed interval (default every `60` seconds).
70+
The exporter starts a long-running go routine on startup that scrapes the Snyk API with a fixed interval (default every `10` minutes).
7071
The interval can be configured as needed.
7172

7273
The API results are aggregated and recorded on the `snyk_vulnerabiilities_total` metric with the following labels:

main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func main() {
5252
flags := kingpin.New("snyk_exporter", "Snyk exporter for Prometheus. Provide your Snyk API token and the organization(s) to scrape to expose Prometheus metrics.")
5353
snykAPIURL := flags.Flag("snyk.api-url", "Snyk API URL").Default("https://snyk.io/api/v1").String()
5454
snykAPIToken := flags.Flag("snyk.api-token", "Snyk API token").Required().String()
55-
snykInterval := flags.Flag("snyk.interval", "Polling interval for requesting data from Snyk API in seconds").Short('i').Default("60").Int()
55+
snykInterval := flags.Flag("snyk.interval", "Polling interval for requesting data from Snyk API in seconds").Short('i').Default("600").Int()
5656
snykOrganizations := flags.Flag("snyk.organization", "Snyk organization ID to scrape projects from (can be repeated for multiple organizations)").Strings()
5757
requestTimeout := flags.Flag("snyk.timeout", "Timeout for requests against Snyk API").Default("10").Int()
5858
listenAddress := flags.Flag("web.listen-address", "Address on which to expose metrics.").Default(":9532").String()

0 commit comments

Comments
 (0)