All Projects → RisingStack → opentracing-metrics-tracer

RisingStack / opentracing-metrics-tracer

Licence: MIT license
Exports cross-process metrics via OpenTracing to Prometheus.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to opentracing-metrics-tracer

go-gin-logrus
Gin Web Framework for using Logrus as the Gin logger with Tracing middleware
Stars: ✭ 38 (+192.31%)
Mutual labels:  opentracing
egg-exporter
Egg.js 的 Prometheus 指标收集插件,附带 Grafana 看板。
Stars: ✭ 24 (+84.62%)
Mutual labels:  prometheus-exporter
amas
Amas is recursive acronym for “Amas, monitor alert system”.
Stars: ✭ 77 (+492.31%)
Mutual labels:  opentracing
dd-go-opentracing
[WIP] OpenTracing Tracer implementation for Datadog in Go
Stars: ✭ 22 (+69.23%)
Mutual labels:  opentracing
java-grpc
OpenTracing Instrumentation for gRPC
Stars: ✭ 52 (+300%)
Mutual labels:  opentracing
pgbouncer exporter
Prometheus exporter for Pgbouncer metrics.
Stars: ✭ 19 (+46.15%)
Mutual labels:  prometheus-exporter
azure-devops-exporter
Prometheus exporter for Azure DevOps (VSTS) including agent pools, builds, releases, deployments, pullrequests and repo stats
Stars: ✭ 102 (+684.62%)
Mutual labels:  prometheus-exporter
lightstep-tracer-ruby
The Lightstep distributed tracing library for Ruby
Stars: ✭ 14 (+7.69%)
Mutual labels:  opentracing
profiler
A tool to trace java method dynamically for android application.
Stars: ✭ 32 (+146.15%)
Mutual labels:  tracer
lightstep-tracer-java
The Lightstep distributed tracing library for JRE
Stars: ✭ 46 (+253.85%)
Mutual labels:  opentracing
shield-dubbo-tracer
基于dubbo2.6.4的Dubbo TraceId的设置/获取/传递工具包
Stars: ✭ 28 (+115.38%)
Mutual labels:  tracer
vrops-exporter
Prometheus exporter running python to get metrics out of VMware vRealize Operations
Stars: ✭ 16 (+23.08%)
Mutual labels:  prometheus-exporter
kafka-consumer-lag-monitoring
Client tool that exports the consumer lag of Kafka consumer groups to Prometheus or your terminal
Stars: ✭ 45 (+246.15%)
Mutual labels:  prometheus-exporter
nodejs
Node.js in-process collectors for Instana
Stars: ✭ 66 (+407.69%)
Mutual labels:  opentracing
smallrye-opentracing
An MicroProfile-OpenTracing implementation
Stars: ✭ 17 (+30.77%)
Mutual labels:  opentracing
otters
Support for OpenTracing in Erlang
Stars: ✭ 31 (+138.46%)
Mutual labels:  opentracing
microservices-demo
A Monorepo Demoing Microservices Architecture
Stars: ✭ 36 (+176.92%)
Mutual labels:  opentracing
ftracer
A toolkit for tracing C/C++ program, to generate a time-line based callgraph
Stars: ✭ 38 (+192.31%)
Mutual labels:  tracer
azure-metrics-exporter
Azure Monitor metrics exporter for Prometheus with dimension support, template engine and ServiceDiscovery
Stars: ✭ 54 (+315.38%)
Mutual labels:  prometheus-exporter
modbus exporter
Exporter which retrieves stats from a modbus system and exports them via HTTP for Prometheus consumption.
Stars: ✭ 16 (+23.08%)
Mutual labels:  prometheus-exporter

opentracing-metrics-tracer

Build Status

Exports cross-process metrics via OpenTracing instrumentation to reporters: Prometheus.
It's capable to measure operation characteristics in a distributed system like microservices.

It also makes possible to reverse engineer the infrastructure topology as we know the initiators

Available Reporters

Getting started

const MetricsTracer = require('@risingstack/opentracing-metrics-tracer')
const prometheusReporter = new MetricsTracer.PrometheusReporter()
const metricsTracer = new MetricsTracer('my-service', [prometheusReporter])

// Instrument
const span = metricsTracer.startSpan('my-operation')
span.finish()
...

app.get('/metrics', (req, res) => {
  res.set('Content-Type', MetricsTracer.PrometheusReporter.Prometheus.register.contentType)
  res.end(prometheusReporter.metrics())
})

With auto instrumentation and multiple tracers

Check out: https://github.com/RisingStack/opentracing-auto

// Prometheus metrics tracer
const MetricsTracer = require('@risingstack/opentracing-metrics-tracer')
const prometheusReporter = new MetricsTracer.PrometheusReporter()
const metricsTracer = new MetricsTracer('my-service', [prometheusReporter])

// Jaeger tracer (classic distributed tracing)
const jaeger = require('jaeger-client')
const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender').default
const sampler = new jaeger.RateLimitingSampler(1)
const reporter = new jaeger.RemoteReporter(new UDPSender())
const jaegerTracer = new jaeger.Tracer('my-server-pg', reporter, sampler)

// Auto instrumentation
const Instrument = require('@risingstack/opentracing-auto')
const instrument = new Instrument({
  tracers: [metricsTracer, jaegerTracer]
})

// Rest of your code
const express = require('express')
const app = express()

app.get('/metrics', (req, res) => {
  res.set('Content-Type', MetricsTracer.PrometheusReporter.Prometheus.register.contentType)
  res.end(prometheusReporter.metrics())
})

Example

See example server.

node example/server
curl http://localhost:3000
curl http://localhost:3000/metrics

API

const Tracer = require('@risingstack/opentracing-metrics-tracer')

new Tracer(serviceKey, [reporter1, reporter2, ...])

  • serviceKey String, required, unique key that identifies a specific type of service (for example: my-frontend-api)
  • reporters Array of reporters, optional, default: []

OpenTracing compatible tracer, for the complete API check out the official documentation.

new Tracer.PrometheusReporter([opts])

  • opts Object, optional
  • opts.ignoreTags Object, optional
    • Example: { ignoreTags: { [Tags.HTTP_URL]: /\/metrics$/ } } to ignore Prometheus scraper

Creates a new Prometheus reporter.

Tracer.PrometheusReporter.Prometheus

Exposed prom-client.

Reporters

Prometheus Reporter

Exposes metrics in Prometheus format via prom-client

Metrics

operation_duration_seconds

Always measured.
Sample output: Two distributed services communicate over the network.

# HELP operation_duration_seconds Duration of operations in second
# TYPE operation_duration_seconds histogram
operation_duration_seconds_bucket{le="0.005",parent_service="my-parent-service",name="my-operation" 0
operation_duration_seconds_bucket{le="0.01",parent_service="my-parent-service",name="my-operation" 0
operation_duration_seconds_bucket{le="0.025",parent_service="my-parent-service",name="my-operation" 0
operation_duration_seconds_bucket{le="0.05",parent_service="my-parent-service",name="my-operation" 0
operation_duration_seconds_bucket{le="0.1",parent_service="my-parent-service",name="my-operation" 1
operation_duration_seconds_bucket{le="0.25",parent_service="my-parent-service",name="my-operation" 1
operation_duration_seconds_bucket{le="0.5",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_bucket{le="1",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_bucket{le="2.5",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_bucket{le="5",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_bucket{le="10",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_bucket{le="+Inf",parent_service="my-parent-service",name="my-operation" 2
operation_duration_seconds_sum{parent_service="my-parent-service",name="my-operation" 0.4
operation_duration_seconds_count{parent_service="my-parent-service",name="my-operation" 2
http_request_duration_seconds

Measured only when the span is tagged with SPAN_KIND_RPC_SERVER and any of HTTP_URL, HTTP_METHOD or HTTP_STATUS_CODE.
Sample output:

# HELP http_request_handler_duration_seconds Duration of HTTP requests in second
# TYPE http_request_handler_duration_seconds histogram
http_request_handler_duration_seconds_bucket{le="0.005",parent_service="my-parent-service",method="GET",code="200",name="http_request" 0
http_request_handler_duration_seconds_bucket{le="0.01",parent_service="my-parent-service",method="GET",code="200",name="http_request" 0
http_request_handler_duration_seconds_bucket{le="0.025",parent_service="my-parent-service",method="GET",code="200",name="http_request" 0
http_request_handler_duration_seconds_bucket{le="0.05",parent_service="my-parent-service",method="GET",code="200",name="http_request" 0
http_request_handler_duration_seconds_bucket{le="0.1",parent_service="my-parent-service",method="GET",code="200",name="http_request" 1
http_request_handler_duration_seconds_bucket{le="0.25",parent_service="my-parent-service",method="GET",code="200",name="http_request" 1
http_request_handler_duration_seconds_bucket{le="0.5",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_bucket{le="1",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_bucket{le="2.5",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_bucket{le="5",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_bucket{le="10",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_bucket{le="+Inf",parent_service="my-parent-service",method="GET",code="200",name="http_request" 2
http_request_handler_duration_seconds_sum{parent_service="my-parent-service",method="GET",code="200",name="http_request" 0.4
http_request_handler_duration_seconds_count{parent_service="my-parent-service",method="GET",code="200",name="http_request" 2

Future and ideas

This library is new, in the future we could measure much more useful and specific metrics with it.
Please share your ideas in a form of issues or pull-requests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].