reactive-streams-telemetry


License

License

Categories

Categories

React User Interface Web Frameworks Reactive Streams Container Microservices Reactive libraries
GroupId

GroupId

au.com.titanclass
ArtifactId

ArtifactId

reactive-streams-telemetry_2.13
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

reactive-streams-telemetry
reactive-streams-telemetry
Project URL

Project URL

https://github.com/titanclass/reactive-streams-telemetry
Project Organization

Project Organization

Titan Class Pty Ltd
Source Code Management

Source Code Management

https://github.com/titanclass/reactive-streams-telemetry

Download reactive-streams-telemetry_2.13

How to add to project

<!-- https://jarcasting.com/artifacts/au.com.titanclass/reactive-streams-telemetry_2.13/ -->
<dependency>
    <groupId>au.com.titanclass</groupId>
    <artifactId>reactive-streams-telemetry_2.13</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/au.com.titanclass/reactive-streams-telemetry_2.13/
implementation 'au.com.titanclass:reactive-streams-telemetry_2.13:2.1.0'
// https://jarcasting.com/artifacts/au.com.titanclass/reactive-streams-telemetry_2.13/
implementation ("au.com.titanclass:reactive-streams-telemetry_2.13:2.1.0")
'au.com.titanclass:reactive-streams-telemetry_2.13:jar:2.1.0'
<dependency org="au.com.titanclass" name="reactive-streams-telemetry_2.13" rev="2.1.0">
  <artifact name="reactive-streams-telemetry_2.13" type="jar" />
</dependency>
@Grapes(
@Grab(group='au.com.titanclass', module='reactive-streams-telemetry_2.13', version='2.1.0')
)
libraryDependencies += "au.com.titanclass" % "reactive-streams-telemetry_2.13" % "2.1.0"
[au.com.titanclass/reactive-streams-telemetry_2.13 "2.1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.13.3
com.typesafe.akka : akka-stream_2.13 jar 2.6.9
io.opentelemetry : opentelemetry-proto jar 0.3.0
io.opentelemetry : opentelemetry-sdk jar 0.8.0

test (2)

Group / Artifact Type Version
com.lihaoyi : utest_2.13 jar 0.7.5
com.typesafe.akka : akka-stream-testkit_2.13 jar 2.6.9

Project Modules

There are no modules declared in this project.

reactive-streams-telemetry

maven-central-badge build-badge

Welcome to reactive-streams-telemetry!

The goal of this Scala/Java library is to provide a Reactive Streams interface to Open Telemetry metrics and traces so that low memory utilization can be attained.

Metrics and traces are presented using streams where elements pertain to Open Telemetry's MetricData and SpanData classes respectively. Applications can consume these streams and present them however they wish e.g. Akka HTTP can be used to serve a snapshot of metrics and traces as JSON with an HTTP GET route. Another example could be where metrics and traces are published over UDP to your favorite collection engine.

Akka Streams is used as the Reactive Streams interface and implementation.

Other than the libraries declared above, there are no additional dependencies.

Teaser

Serve up the latest telemetry gathered given an Alpakka Unix Domain Socket and the establishment of the metrics and traces sources from their respective exporters:

import akka.NotUsed
import akka.stream.alpakka.unixdomainsocket.scaladsl.UnixDomainSocket
import akka.stream.scaladsl.{ Flow, Sink, Source }
import au.com.titanclass.streams.telemetry.{ MetricProtobufMarshalling, SpanProtobufMarshalling }
import io.opentelemetry.sdk.metrics.data.MetricData
import io.opentelemetry.sdk.trace.data.SpanData
import java.io.File

val metrics: Source[MetricData, NotUsed] = ???
val traces: Source[SpanData, NotUsed] = ???

val source =
  metrics
    .map { metricData =>
      import MetricProtobufMarshalling._
      metricData.toProtobuf.build().toString
    }
    .merge(
      traces
        .map { spanData =>
          import SpanProtobufMarshalling._
          spanData.toProtobuf.build().toString
        }
    )

UnixDomainSocket()
  .bindAndHandle(Flow.fromSinkAndSourceCoupled(Sink.ignore, source),
                 new File("/var/run/mysocket.sock"))

The above will just output the string representations of each element of telemetry.

Download

Builds are published to Maven Central. Please substitute version accordingly.

"au.com.titanclass" %% "reactive-streams-telemetry" % version

Usage

Please check out the tests for sample usage.

Contribution policy

Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.

Publishing

You'll need a GPG key to sign as artifacts are published to Sonatype for publishing at Maven Central. Once you have GPG setup:

export GPG_TTY=$(tty)
sbt publishSigned

License

This code is open source software licensed under the Apache-2.0 license.

(c) Copyright Titan Class Pty Ltd, 2019

au.com.titanclass

Versions

Version
2.1.0
2.0.0