File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
apps/common/src/main/scala/org/lfdecentralizedtrust/splice/http Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,17 @@ class HttpServerMetrics(metricsFactory: LabeledMetricsFactory) {
4141 // We need to pass the operation explicitly, which represents the OpenAPI operation ID.
4242 def withMetrics (service : String )(operation : String ): Directive0 = {
4343 import org .apache .pekko .http .scaladsl .server .Directives .*
44- implicit val mc : MetricsContext =
45- MetricsContext (" operation" -> operation, " http_service" -> service)
4644
4745 extractExecutionContext.flatMap { implicit ec =>
48- extractRequest.flatMap { _ =>
46+ extractRequest.flatMap { req =>
47+ val c = MetricsContext (" operation" -> operation, " http_service" -> service)
48+ implicit val mc : MetricsContext = req.headers
49+ .find(_.is(" x-source-ui" )) // custom header added by the UI
50+ .map { header =>
51+ c.withExtraLabels(" source_ui" -> header.value)
52+ }
53+ .getOrElse(c)
54+
4955 inFlightRequests.inc()
5056 val timing = requestTiming.startAsync()
5157 mapRouteResultFuture { resultFuture =>
You can’t perform that action at this time.
0 commit comments