aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2018-08-30 13:25:10 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2018-08-30 13:25:10 +0200
commitd30ff29cdb5f94be34163d851d71716a316bdf10 (patch)
treec49ef34299f14ac281a2cf06e93484db65c3ac13
parente4abea098ef4d6e71a805812bfa95c14bd9002b5 (diff)
downloadKamon-d30ff29cdb5f94be34163d851d71716a316bdf10.tar.gz
Kamon-d30ff29cdb5f94be34163d851d71716a316bdf10.tar.bz2
Kamon-d30ff29cdb5f94be34163d851d71716a316bdf10.zip
mockup definition on the HTTP Server instrumentation configuration
-rw-r--r--kamon-core/src/main/resources/reference.conf102
-rw-r--r--kamon-core/src/main/scala/kamon/ContextPropagation.scala17
2 files changed, 105 insertions, 14 deletions
diff --git a/kamon-core/src/main/resources/reference.conf b/kamon-core/src/main/resources/reference.conf
index 5e5078ca..279a00a9 100644
--- a/kamon-core/src/main/resources/reference.conf
+++ b/kamon-core/src/main/resources/reference.conf
@@ -195,10 +195,12 @@ kamon {
propagation {
- channels {
- http {
- type = http
+ http {
+ # Default HTTP propagation. Unless specified otherwise, all instrumentation will use the configuration on
+ # this section for HTTP context propagation.
+ #
+ default {
tags {
# Header name used to encode context tags.
@@ -247,6 +249,100 @@ kamon {
}
}
+ instrumentation {
+ http-server {
+ default {
+
+ # Configuration for HTTP server metrics collection
+ #
+ metrics {
+
+ # Enables collection of HTTP server metrics
+ enable = yes
+
+ # Tags to include on the HTTP server metrics. The available options are:
+ # - method: HTTP method from the request.
+ # - status-code: HTTP status code from the responses.
+ #
+ tags = [
+ "method",
+ "status-code"
+ ]
+ }
+
+ # Configuration for HTTP request tracing
+ #
+ tracing {
+
+ # Enables HTTP request tracing. When enabled the instrumentation will create Spans for incoming requests
+ # and finish them when the response is sent back to the clients.
+ enable = yes
+
+ # Select a context tag that provides a custom trace identifier. The custom trace identifier will be used
+ # only if all these conditions are met:
+ # - the context tag is present.
+ # - there is no parent Span on the incoming context (i.e. this is the first service on the trace).
+ # - the identifier is valued in accordance to the identity provider.
+ trace-id-tag = "none"
+
+ # Metric tags to be automatically included in the HTTP server Spans. The available options are:
+ # - method: HTTP method from the request.
+ # - status-code: HTTP status code from the responses.
+ # - peer: Name of the service issuing the HTTP call. Will use "unknown" if not present.
+ metric-tags = [
+ "method",
+ "status-code",
+ "peer"
+ ]
+ }
+
+ # Configuration for HTTP context propagation
+ #
+ propagation {
+
+ # Enables or disables HTTP context propagation on this HTTP server instrumentation. Please note that if
+ # propagation is disabled then some distributed tracing features will not be work as expected (e.g. Spans can
+ # be created and reported but will not be linked across boundaries nor take trace identifiers from tags).
+ enabled = yes
+
+ # HTTP propagation channel to b used by this instrumentation. Take a look at the kamon.propagation.http.default
+ # configuration for more details on how to configure the detault HTTP context propagation.
+ channel = "default"
+ }
+
+
+ # Custom mappings between routes and operation names.
+ #
+ operations {
+
+ # Operation name for Spans created on requests that could not be handled by any route in the current
+ # application.
+ unhanlded = "unhandled"
+
+ # Provides custom mappings from HTTP paths into operation names. Meant to be used in cases where the bytecode
+ # instrumentation is not able to provide a sensible operation name that is free of high cardinality values.
+ # For example, with the following configuration:
+ # mappings {
+ # "/organization/*/user/*/profile" = "/organization/:orgID/user/:userID/profile"
+ # "/events/*/rsvps" = "EventRSVPs"
+ # }
+ #
+ # Requests to "/organization/3651/user/39652/profile" and "/organization/22234/user/54543/profile" will have
+ # the same operation name "/organization/:orgID/user/:userID/profile".
+ #
+ # Similarly, requests to "/events/aaa-bb-ccc/rsvps" and "/events/1234/rsvps" will have the same operation
+ # name "EventRSVPs".
+ #
+ # The patterns are expressed as globs and the operation names are free form.
+ #
+ mappings {
+
+ }
+ }
+ }
+ }
+ }
+
util {
filters {
diff --git a/kamon-core/src/main/scala/kamon/ContextPropagation.scala b/kamon-core/src/main/scala/kamon/ContextPropagation.scala
index 518aa021..bfcfbf7e 100644
--- a/kamon-core/src/main/scala/kamon/ContextPropagation.scala
+++ b/kamon-core/src/main/scala/kamon/ContextPropagation.scala
@@ -40,8 +40,8 @@ trait ContextPropagation { self: Configuration with ClassLoading =>
}
object ContextPropagation {
- val DefaultHttpChannel = "http"
- val DefaultBinaryChannel = "binary"
+ val DefaultHttpChannel = "default"
+ val DefaultBinaryChannel = "default"
case class Components(
httpChannels: Map[String, HttpPropagation]
@@ -51,17 +51,12 @@ object ContextPropagation {
def from(config: Config, classLoading: ClassLoading): Components = {
val propagationConfig = config.getConfig("kamon.propagation")
- val channels = propagationConfig.getConfig("channels").configurations
-
- val httpChannels = Map.newBuilder[String, HttpPropagation]
-
- channels.foreach {
- case (channelName, channelConfig) => channelConfig.getString("type") match {
- case "http" => httpChannels += (channelName -> HttpPropagation.from(channelConfig, classLoading))
- }
+ val httpChannelsConfig = propagationConfig.getConfig("http").configurations
+ val httpChannels = httpChannelsConfig.map {
+ case (channelName, channelConfig) => (channelName -> HttpPropagation.from(channelConfig, classLoading))
}
- Components(httpChannels.result())
+ Components(httpChannels)
}
}
}