-
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.
+ adds configurable operation name mappings for http client instrumen…
…tation
- Loading branch information
1 parent
e94625a
commit be5959d
Showing
11 changed files
with
105 additions
and
34 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
...on-akka-http/src/main/scala/kamon/instrumentation/akka/http/AkkaHttpInstrumentation.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
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
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
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) | ||
} | ||
} |
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