Skip to content

Commit c3c7421

Browse files
author
Yaroslav Derman
committed
apply PR comments
1 parent 0d680ce commit c3c7421

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

instrumentation/kamon-play/src/main/resources/reference.conf

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ kamon.instrumentation.play.http {
107107
# Custom mappings between routes and operation names.
108108
operations {
109109

110+
# Default configuration for HttpOperationNameGenerator implementation, but it has never been used
111+
# - default: Uses the set default operation name
112+
# - method: Uses the request HTTP method as the operation name.
113+
#
114+
name-generator = "default"
115+
110116
# The default operation name to be used when creating Spans to handle the HTTP server requests. In most
111117
# cases it is not possible to define an operation name right at the moment of starting the HTTP server Span
112118
# and in those cases, this operation name will be initially assigned to the Span. Instrumentation authors
@@ -140,9 +146,29 @@ kamon.instrumentation.play.http {
140146
}
141147
}
142148

143-
name-generator = "kamon.instrumentation.play.DefaultRouterOperationNameGenerator"
149+
#
150+
# Configure specefic tracing/monitoring elements which depends on `play-framework` internal APIs that might change in the future
151+
#
152+
extra {
153+
# Framework-specific way to generate operations names instead of using `kamon.instrumentation.play.http.server.tracing.operations.name-generator`
154+
# Used by default with implementations that converts paths of form `/foo/bar/$paramname<regexp>/blah` to `/foo/bar/paramname/blah`
155+
#
156+
# FQCN for a kamon.instrumentation.play.RouterOperationNameGenerator implementation, or ony of the following shorthand forms:
157+
# - default: Uses the set default operation name
158+
# - method: Uses the request HTTP method as the operation name.
159+
#
160+
name-generator = "kamon.instrumentation.play.DefaultRouterOperationNameGenerator"
161+
162+
# Framework-specific way to generate operations names instead of using `kamon.instrumentation.play.http.server.tracing.operations.name-generator`
163+
# Used by default with setting operation name to `request.uri.toRelative`
164+
#
165+
# FQCN for a kamon.instrumentation.play.GrpcRouterNameGenerator implementation, or ony of the following shorthand forms:
166+
# - default: Uses the set default operation name
167+
# - method: Uses the request HTTP method as the operation name.
168+
#
169+
grpc-name-generator = "kamon.instrumentation.play.DefaultGrpcRouterNameGenerator"
170+
}
144171

145-
grpc-name-generator = "kamon.instrumentation.play.DefaultGrpcRouterNameGenerator"
146172
}
147173

148174
client {

instrumentation/kamon-play/src/main/scala/kamon/instrumentation/play/PlayServerInstrumentation.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ object GenerateOperationNameOnFilterHandler {
253253
Kamon.onReconfigure(newConfig => _routerNameGenerator = rebuildRouterNameGenerator(newConfig))
254254

255255
private def rebuildRouterNameGenerator(config: Config): RouterOperationNameGenerator = {
256-
val nameGeneratorClazz = config.getString("kamon.instrumentation.play.http.server.name-generator")
256+
val nameGeneratorClazz = config.getString("kamon.instrumentation.play.http.server.extra.name-generator")
257257
Try(ClassLoading.createInstance[RouterOperationNameGenerator](nameGeneratorClazz)) match {
258258
case Failure(exception) =>
259259
_logger.error(s"Exception occurred on $nameGeneratorClazz instance creation, used default", exception)
@@ -284,7 +284,7 @@ object GenerateGRPCOperationName {
284284
Kamon.onReconfigure(newConfig => _grpcRouterNameGenerator = rebuildRouterNameGenerator(newConfig))
285285

286286
private def rebuildRouterNameGenerator(config: Config): GrpcRouterNameGenerator = {
287-
val nameGeneratorClazz = config.getString("kamon.instrumentation.play.http.server.grpc-name-generator")
287+
val nameGeneratorClazz = config.getString("kamon.instrumentation.play.http.server.extra.grpc-name-generator")
288288
Try(ClassLoading.createInstance[GrpcRouterNameGenerator](nameGeneratorClazz)) match {
289289
case Failure(exception) =>
290290
_logger.error(s"Exception occurred on $nameGeneratorClazz instance creation, used default", exception)

0 commit comments

Comments
 (0)