1 /* 2 * Make.org Core API 3 * Copyright (C) 2018 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.api.technical 21 22 import grizzled.slf4j.Logging 23 import kamon.Kamon 24 import kamon.instrumentation.http.{HttpMessage, HttpOperationNameGenerator} 25 26 class MakeServerOperationNameGenerator extends HttpOperationNameGenerator with Logging { 27 28 logger.info("creating make name generator for akka-http") 29 30 override def name(request: HttpMessage.Request): Option[String] = { 31 logger.warn("Generating server name...") 32 Option(Kamon.currentSpan().operationName()) 33 .filter(name => !name.isEmpty && name != "http.server.request") 34 .orElse(Some(request.path)) 35 36 } 37 38 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 28 | 49364 | 995 - 1052 | Apply | grizzled.slf4j.Logger.info | MakeServerOperationNameGenerator.this.logger.info("creating make name generator for akka-http") | |
| 31 | 41510 | 1128 - 1168 | Apply | grizzled.slf4j.Logger.warn | MakeServerOperationNameGenerator.this.logger.warn("Generating server name...") | |
| 32 | 33934 | 1180 - 1215 | Apply | kamon.trace.Span.operationName | kamon.Kamon.currentSpan().operationName() | |
| 33 | 50726 | 1256 - 1285 | Apply | java.lang.Object.!= | name.!=("http.server.request") | |
| 33 | 43141 | 1239 - 1285 | Apply | scala.Boolean.&& | name.isEmpty().unary_!.&&(name.!=("http.server.request")) | |
| 34 | 35015 | 1306 - 1318 | Select | kamon.instrumentation.http.HttpMessage.Request.path | request.path | |
| 34 | 48042 | 1301 - 1319 | Apply | scala.Some.apply | scala.Some.apply[String](request.path) | |
| 34 | 39919 | 1173 - 1320 | Apply | scala.Option.orElse | scala.Option.apply[String](kamon.Kamon.currentSpan().operationName()).filter(((name: String) => name.isEmpty().unary_!.&&(name.!=("http.server.request")))).orElse[String](scala.Some.apply[String](request.path)) |