kamon-futures

  • 所有者: kamon-io/kamon-futures
  • 平台:
  • 許可證: Other
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Futures Instrumentation

Build Status
Gitter
Maven Central

Getting Started

The Futures instrumentation is currently available for Scala 2.10, 2.11 and 2.12.

Supported releases and dependencies are shown below., kamon-futures, status, jdk, scala, :------:, :------:, :----:, ------------------, 1.0.0, stable, 1.7+, 1.8+, 2.10, 2.11, 2.12

To get started with SBT, simply add the following to your build.sbt
file:

resolvers += Resolver.bintrayRepo("kamon-io", "snapshots")

libraryDependencies += "io.kamon" %% "kamon-scala-future" % "1.0.0"
libraryDependencies += "io.kamon" %% "kamon-scalaz-future" % "1.0.0"
libraryDependencies += "io.kamon" %% "kamon-twitter-future" % "1.0.0"

Automatic TraceContext Propagation with Futures

The kamon-futures module provides bytecode instrumentation for Scala, Scalaz and Twitter Futures that automatically
propagates the Context across the asynchronous operations that might be scheduled for a given Future.

All modules in the kamon-futures project module require you to start your application using the AspectJ Weaver
Agent.

Instrumenting Future's Body and Callbacks

In the following piece of code, the body of the future will be executed asynchronously on some other thread provided by
the ExecutionContext available in implicit scope, but Kamon will capture the TraceContext available when the future
was created and make it available while executing the future's body.

  val context = contextWithLocal("in-future-transformations")
        val baggageAfterTransformations = Kamon.withContext(context) {
            Future("Hello Kamon!")
              // The active span is expected to be available during all intermediate processing.
              .map(_.length)
              .flatMap(len => Future(len.toString))
              .map(_ => Kamon.currentContext().get(StringKey))
          }

Also, when you transform a future by using map/flatMap/filter and friends or you directly register a
onComplete/onSuccess/onFailure callback on a future, Kamon will capture the Context available when transforming
the future and make it available when executing the given callback. The code snippet above would print the same
Context that was available when creating the future, during it's body execution and during the execution of all
the asynchronous operations scheduled on it.

主要指標

概覽
名稱與所有者kamon-io/kamon-futures
主編程語言Scala
編程語言Scala (語言數: 1)
平台
許可證Other
所有者活动
創建於2017-01-04 19:15:40
推送於2020-03-18 14:48:41
最后一次提交2020-03-18 15:48:34
發布數12
最新版本名稱v2.0.1 (發布於 2019-08-14 22:33:09)
第一版名稱v1.0.0-RC5 (發布於 )
用户参与
星數9
關注者數2
派生數11
提交數89
已啟用問題?
問題數2
打開的問題數0
拉請求數4
打開的拉請求數0
關閉的拉請求數8
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?