Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update jicoco to 1.1-142-gfed0320. #547

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<mockk.version>1.13.8</mockk.version>
<ktor.version>2.3.4</ktor.version>
<jwt.version>0.11.5</jwt.version>
<jicoco.version>1.1-127-gf49982f</jicoco.version>
<jicoco.version>1.1-142-gfed0320</jicoco.version>
<jitsi.utils.version>1.0-127-g6c65524</jitsi.utils.version>
</properties>

Expand Down Expand Up @@ -273,7 +273,7 @@
<dependency>
<groupId>org.jitsi</groupId>
<artifactId>jicoco-metrics</artifactId>
<version>1.1-133-g768ef2e</version>
<version>${jicoco.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
26 changes: 5 additions & 21 deletions src/main/kotlin/org/jitsi/jibri/api/http/HttpApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package org.jitsi.jibri.api.http

import io.ktor.http.ContentType
import io.ktor.http.HttpStatusCode
import io.ktor.http.parseHeaderValue
import io.ktor.serialization.jackson.jackson
import io.ktor.server.application.Application
import io.ktor.server.application.call
Expand All @@ -30,7 +31,6 @@ import io.ktor.server.routing.get
import io.ktor.server.routing.post
import io.ktor.server.routing.route
import io.ktor.server.routing.routing
import io.prometheus.client.exporter.common.TextFormat
import jakarta.ws.rs.core.Response
import org.jitsi.jibri.FileRecordingRequestParams
import org.jitsi.jibri.JibriBusyException
Expand Down Expand Up @@ -138,26 +138,10 @@ class HttpApi(
if (StatsConfig.enablePrometheus) {
logger.info("Enabling prometheus interface at :$port/metrics")
get("/metrics") {
val accept = call.request.headers["Accept"]
when {
accept?.startsWith("application/openmetrics-text") == true ->
call.respondText(
JibriMetricsContainer.getPrometheusMetrics(TextFormat.CONTENT_TYPE_OPENMETRICS_100),
contentType = ContentType.parse(TextFormat.CONTENT_TYPE_OPENMETRICS_100)
)

accept?.startsWith("text/plain") == true ->
call.respondText(
JibriMetricsContainer.getPrometheusMetrics(TextFormat.CONTENT_TYPE_004),
contentType = ContentType.parse(TextFormat.CONTENT_TYPE_004)
)

else ->
call.respondText(
JibriMetricsContainer.jsonString,
contentType = ContentType.parse("application/json")
)
}
val accepts =
parseHeaderValue(call.request.headers["Accept"]).sortedBy { it.quality }.map { it.value }
val (metrics, contentType) = JibriMetricsContainer.getMetrics(accepts)
call.respondText(metrics, contentType = ContentType.parse(contentType))
}
}
}
Expand Down
Loading