https://github.com/opentracing-contrib/scala-finagle
OpenTracing Instrumentation for Finagle
https://github.com/opentracing-contrib/scala-finagle
finagle opentracing
Last synced: 3 months ago
JSON representation
OpenTracing Instrumentation for Finagle
- Host: GitHub
- URL: https://github.com/opentracing-contrib/scala-finagle
- Owner: opentracing-contrib
- License: apache-2.0
- Created: 2017-11-10T02:15:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-03T03:19:48.000Z (over 6 years ago)
- Last Synced: 2025-04-04T22:11:18.714Z (6 months ago)
- Topics: finagle, opentracing
- Language: Scala
- Size: 77.1 KB
- Stars: 2
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Released Version][maven-img]][maven] [](https://opensource.org/licenses/Apache-2.0)
# OpenTracing Finagle Instrumentation
OpenTracing instrumentation for Finagle.## Installation
build.sbt
```sbt
libraryDependencies += "io.opentracing.contrib" % "opentracing-finagle" % "0.0.2"
```## Usage
```scala
// Instantiate tracer
val tracer: Tracer = ...
```### Http Server
```scala
// Apply OpenTracingHttpFilter to Finagle service to serve HTTP requests
val service = new OpenTracingHttpFilter(tracer, true) andThen new Service[http.Request, http.Response] {
def apply(req: http.Request): Future[http.Response] =
Future.value(
http.Response(req.version, http.Status.Ok)
)
}
// Create server
val server = Http.server.serve(":8080", service)
Await.ready(server)
```### Http Client
```scala
// Apply OpenTracingHttpFilter to Finagle client service
val client = new OpenTracingHttpFilter(tracer, false) andThen Http.client.newService(":8080")// Build request
val request = http.Request(http.Method.Get, "/")// Build response
val response: Future[http.Response] = client(request)// Wait for result
val result = Await.result(response)
```## License
[Apache 2.0 License](./LICENSE).
[ci-img]: https://travis-ci.org/opentracing-contrib/scala-finagle.svg?branch=master
[ci]: https://travis-ci.org/opentracing-contrib/scala-finagle
[cov-img]: https://coveralls.io/repos/github/opentracing-contrib/scala-finagle/badge.svg?branch=master
[cov]: https://coveralls.io/github/opentracing-contrib/scala-finagle?branch=master
[maven-img]: https://img.shields.io/maven-central/v/io.opentracing.contrib/opentracing-finagle.svg
[maven]: http://search.maven.org/#search%7Cga%7C1%7Copentracing-finagle