Skip to content

Commit

Permalink
okay I did some dumb things here
Browse files Browse the repository at this point in the history
I thought I tested it?? bruh.
  • Loading branch information
solonovamax committed Nov 2, 2024
1 parent 06549c1 commit 7d49b01
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.reposilite.plugin.prometheus.metrics.QueuedThreadPoolMetrics
import com.reposilite.plugin.prometheus.metrics.ReposiliteMetrics
import com.reposilite.status.FailureFacade
import com.reposilite.status.StatusFacade
import com.reposilite.storage.api.toLocation
import com.reposilite.web.api.HttpServerConfigurationEvent
import com.reposilite.web.api.HttpServerStartedEvent
import com.reposilite.web.api.RoutingSetupEvent
Expand All @@ -28,9 +29,9 @@ class PrometheusPlugin : ReposilitePlugin() {
logger.info("")
logger.info("--- Prometheus")

val prometheusPath = System.getProperty("reposilite.prometheus.path")
val prometheusPath = (System.getProperty("reposilite.prometheus.path")
?: System.getenv("REPOSILITE_PROMETHEUS_PATH")
?: "/metrics"
?: "/metrics").toLocation()

val prometheusUser = System.getProperty("reposilite.prometheus.user")
?: System.getenv("REPOSILITE_PROMETHEUS_USER")
Expand Down Expand Up @@ -72,10 +73,10 @@ class PrometheusPlugin : ReposilitePlugin() {
}

it.after { ctx ->
if (ctx.path() == prometheusPath)
if (ctx.path().toLocation() == prometheusPath)
return@after

JettyMetrics.responseCounter.labelValues(ctx.statusCode().toString()).inc()
ReposiliteMetrics.responseCounter.labelValues(ctx.statusCode().toString()).inc()

val currentTime = System.currentTimeMillis()
val timestamp = ctx.attribute<Long>("timestamp")
Expand Down Expand Up @@ -115,7 +116,7 @@ class PrometheusPlugin : ReposilitePlugin() {
event.registerRoutes(
PrometheusEndpoints(
prometheusFacade = prometheusFacade,
prometheusPath = prometheusPath
prometheusPath = prometheusPath.toString()
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ object JettyMetrics : Connection.Listener {
.quantile(0.01, 0.05, 0.1, 0.5, 0.9, 0.95, 0.99)
.register()

val responseCounter: Counter = Counter.builder()
.name("jetty_responses_total")
.help("Total response count")
.labelNames("code")
.register()

fun register(statisticsHandler: StatisticsHandler) {
CounterWithCallback.builder()
.name("jetty_requests_total")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ object ReposiliteMetrics {
.help("Total successful deployments count")
.register()

val responseCounter: Counter = Counter.builder()
.name("reposilite_responses_total")
.help("Total response count, filtered to exclude /metrics")
.labelNames("code")
.register()

fun register(statusFacade: StatusFacade, failureFacade: FailureFacade) {
GaugeWithCallback.builder()
.name("reposilite_uptime_seconds")
Expand Down

0 comments on commit 7d49b01

Please sign in to comment.