-
Notifications
You must be signed in to change notification settings - Fork 327
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
1 parent
6bb9b9b
commit da53f7d
Showing
6 changed files
with
26 additions
and
35 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
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
21 changes: 0 additions & 21 deletions
21
...nstrumentation-common/src/main/scala/kamon/instrumentation/http/HttpInstrumentation.scala
This file was deleted.
Oops, something went wrong.
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
18 changes: 18 additions & 0 deletions
18
...trumentation-common/src/main/scala/kamon/instrumentation/http/OperationNameSettings.scala
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,18 @@ | ||
package kamon.instrumentation.http | ||
|
||
import kamon.util.Filter | ||
|
||
final case class OperationNameSettings(defaultOperationName: String, | ||
operationMappings: Map[Filter.Glob, String], | ||
operationNameGenerator: HttpOperationNameGenerator) { | ||
private[http] def operationName(request: HttpMessage.Request): String = { | ||
val requestPath = request.path | ||
//first apply any mappings rules | ||
val customMapping = operationMappings.collectFirst { | ||
case (pattern, operationName) if pattern.accept(requestPath) => operationName | ||
}.orElse( //fallback to use any configured name generator | ||
operationNameGenerator.name(request) | ||
) | ||
customMapping.getOrElse(defaultOperationName) | ||
} | ||
} |