-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
267 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
<!-- This file is auto generated during release from readme/RELEASE_NOTES.md --> | ||
|
||
[![Coverage Status](https://coveralls.io/repos/github/skuzzle/gh-prom-exporter/badge.svg?branch=master)](https://coveralls.io/github/skuzzle/gh-prom-exporter?branch=master) | ||
[![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS) | ||
[![Coverage Status](https://coveralls.io/repos/github/skuzzle/gh-prom-exporter/badge.svg?branch=master)](https://coveralls.io/github/skuzzle/gh-prom-exporter?branch=master) [![Twitter Follow](https://img.shields.io/twitter/follow/skuzzleOSS.svg?style=social)](https://twitter.com/skuzzleOSS) | ||
|
||
* Configuration option to allow anonymous scraping | ||
* Minimal documentation for on-premise setup | ||
* Update to Spring-Boot 2.6.2 | ||
* [#1](https://github.com/skuzzle/gh-prom-exporter/issues/1) Allow to scrape multiple repository with single call | ||
|
||
``` | ||
docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.4 | ||
docker pull ghcr.io/skuzzle/gh-prom-exporter/gh-prom-exporter:0.0.5 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/java/de/skuzzle/ghpromexporter/clock/ApplicationClock.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
src/main/java/de/skuzzle/ghpromexporter/clock/ClockConfiguration.java
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
src/main/java/de/skuzzle/ghpromexporter/clock/StaticApplicationClock.java
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
src/main/java/de/skuzzle/ghpromexporter/scrape/RepositoryMeters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package de.skuzzle.ghpromexporter.scrape; | ||
|
||
import io.prometheus.client.CollectorRegistry; | ||
import io.prometheus.client.Counter; | ||
import io.prometheus.client.Summary; | ||
|
||
public final class RepositoryMeters { | ||
|
||
private static final String LABEL_REPOSITORY = "repository"; | ||
private static final String LABEL_OWNER = "owner"; | ||
private static final String NAMESPACE = "github"; | ||
|
||
private final CollectorRegistry registry; | ||
private final Counter additions; | ||
private final Counter deletions; | ||
private final Counter stargazers; | ||
private final Counter forks; | ||
private final Counter open_issues; | ||
private final Counter subscribers; | ||
private final Counter watchers; | ||
private final Counter size; | ||
private final Summary scrapeDuration; | ||
|
||
public static RepositoryMeters newRegistry() { | ||
return new RepositoryMeters(new CollectorRegistry()); | ||
} | ||
|
||
private RepositoryMeters(CollectorRegistry registry) { | ||
this.registry = registry; | ||
this.additions = Counter.build("additions", "Sum of additions over the last 52 weeks") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.deletions = Counter.build("deletions", "Negative sum of deletions over the last 52 weeks") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.stargazers = Counter.build("stargazers", "The repository's stargazer count") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.forks = Counter.build("forks", "The repository's fork count") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.open_issues = Counter.build("open_issues", "The repository's open issue count") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.subscribers = Counter.build("subscribers", "The repository's subscriber count") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.watchers = Counter.build("watchers", "The repository's watcher count") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.size = Counter.build("size", "The repository's size in KB") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
this.scrapeDuration = Summary.build("scrape_duration", "Duration of a single scrape") | ||
.namespace(NAMESPACE).labelNames(LABEL_OWNER, LABEL_REPOSITORY).register(registry); | ||
} | ||
|
||
public RepositoryMeters addRepositoryScrapeResults(ScrapeRepositoryRequest repository, RepositoryMetrics metrics) { | ||
additions.labels(repository.owner(), repository.name()).inc(metrics.totalAdditions()); | ||
deletions.labels(repository.owner(), repository.name()).inc(metrics.totalDeletions()); | ||
stargazers.labels(repository.owner(), repository.name()).inc(metrics.stargazersCount()); | ||
forks.labels(repository.owner(), repository.name()).inc(metrics.forkCount()); | ||
open_issues.labels(repository.owner(), repository.name()).inc(metrics.openIssueCount()); | ||
subscribers.labels(repository.owner(), repository.name()).inc(metrics.subscriberCount()); | ||
watchers.labels(repository.owner(), repository.name()).inc(metrics.watchersCount()); | ||
size.labels(repository.owner(), repository.name()).inc(metrics.sizeInKb()); | ||
scrapeDuration.labels(repository.owner(), repository.name()).observe(metrics.scrapeDuration()); | ||
return this; | ||
} | ||
|
||
public CollectorRegistry registry() { | ||
return this.registry; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/de/skuzzle/ghpromexporter/web/MultipleRepositories.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package de.skuzzle.ghpromexporter.web; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import de.skuzzle.ghpromexporter.scrape.ScrapeRepositoryRequest; | ||
import reactor.core.publisher.Flux; | ||
|
||
final class MultipleRepositories { | ||
|
||
private final String owner; | ||
private final List<String> repositories; | ||
|
||
private MultipleRepositories(String owner, List<String> repositories) { | ||
this.owner = owner; | ||
this.repositories = repositories; | ||
} | ||
|
||
public static MultipleRepositories parse(String owner, String repositoriesString) { | ||
final String[] repositories = repositoriesString.split(","); | ||
return new MultipleRepositories(owner, Arrays.asList(repositories)); | ||
} | ||
|
||
Flux<ScrapeRepositoryRequest> requests() { | ||
return Flux.fromStream(repositories.stream() | ||
.map(repository -> ScrapeRepositoryRequest.of(owner, repository))); | ||
} | ||
} |
Oops, something went wrong.