All Projects → opentracing-contrib → java-metrics

opentracing-contrib / java-metrics

Licence: Apache-2.0 License
No description or website provided.

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to java-metrics

Haystack
Top level repository for Haystack, containing documentation and deployment scripts
Stars: ✭ 261 (+741.94%)
Mutual labels:  metrics, tracing, opentracing
Stagemonitor
an open source solution to application performance monitoring for java server applications
Stars: ✭ 1,664 (+5267.74%)
Mutual labels:  metrics, tracing, opentracing
Opentelemetry Rust
OpenTelemetry API and SDK for Rust
Stars: ✭ 280 (+803.23%)
Mutual labels:  metrics, prometheus, tracing
Bricks
A standard library for microservices.
Stars: ✭ 142 (+358.06%)
Mutual labels:  metrics, prometheus, tracing
Opencensus Java
A stats collection and distributed tracing framework
Stars: ✭ 640 (+1964.52%)
Mutual labels:  metrics, prometheus, tracing
gateway
A proxy to buffer and forward metrics, events, and traces.
Stars: ✭ 94 (+203.23%)
Mutual labels:  metrics, prometheus, tracing
ctrace-go
Canonical OpenTracing for GoLang
Stars: ✭ 12 (-61.29%)
Mutual labels:  tracing, opentracing
feign-opentracing
OpenTracing Feign integration
Stars: ✭ 20 (-35.48%)
Mutual labels:  tracing, opentracing
octane-exporter
Export Laravel Octane metrics using this Prometheus exporter.
Stars: ✭ 14 (-54.84%)
Mutual labels:  metrics, prometheus
gcloud-opentracing
OpenTracing Tracer implementation for GCloud StackDriver in Go.
Stars: ✭ 44 (+41.94%)
Mutual labels:  tracing, opentracing
java-jaxrs
OpenTracing Java JAX-RS instrumentation
Stars: ✭ 37 (+19.35%)
Mutual labels:  tracing, opentracing
zipkin-ruby-opentracing
OpenTracing Tracer implementation for Zipkin in Ruby
Stars: ✭ 15 (-51.61%)
Mutual labels:  tracing, opentracing
go-sensor
🚀 Go Distributed Tracing & Metrics Sensor for Instana
Stars: ✭ 90 (+190.32%)
Mutual labels:  tracing, opentracing
splunk-otel-java
Splunk Distribution of OpenTelemetry Java
Stars: ✭ 39 (+25.81%)
Mutual labels:  metrics, tracing
nginx-opentracing
Instrument nginx for OpenTracing.
Stars: ✭ 21 (-32.26%)
Mutual labels:  tracing, opentracing
easeagent
An agent component for the Java system
Stars: ✭ 437 (+1309.68%)
Mutual labels:  tracing, opentracing
axios-opentracing
Axios interceptor which traces your requests 👀
Stars: ✭ 15 (-51.61%)
Mutual labels:  tracing, opentracing
ruby-sensor
💎 Ruby Distributed Tracing & Metrics Sensor for Instana
Stars: ✭ 23 (-25.81%)
Mutual labels:  tracing, opentracing
prometheus-httpd
Expose Prometheus metrics using inets httpd.
Stars: ✭ 21 (-32.26%)
Mutual labels:  metrics, prometheus
zipkin-cpp-opentracing
OpenTracing Tracer implementation for Zipkin in C++
Stars: ✭ 46 (+48.39%)
Mutual labels:  tracing, opentracing

Build Status Released Version

OpenTracing Metrics

The OpenTracing Metrics project enables any OpenTracing compliant Tracer to be decorated with support for reporting span based application metrics.

The project currently has support for reporting metrics via:

  • Micrometer
  • Prometheus (deprecated in favor of Micrometer)

A Tracer is decorated in the following way:

	Tracer tracer = ...;
	MetricsReporter reporter = ...;
	Tracer metricsTracer = io.opentracing.contrib.metrics.Metrics.decorate(tracer, reporter);

Metric Labels

Labels are used as a way to separate sampled metric values into related groups. A combination of label values will uniquely define a specific metric.

If one of the metric labels returned for a particular sampling point (i.e. span) returns a null value, then the metric will not be recorded. This provided a means to selective choose which metrics values are of interest.

For example, by default if the span.kind tag is not specified, it's label value will be null. This means that metrics for internal spans will by default not be recorded. If an application/service developer wants specific internal span metrics recorded, they can add a MetricLabel that returns an appropriate value for the span.kind for the spans of interest.

Label Types

Label types:

  • ConstMetricLabel

This label type returns a constant value, e.g. service name

  • OperationMetricLabel

This label type returns the span's operation name

  • TagMetricLabel

This label type attempts to obtain the value associated with the requested name from the span's tags, and if not found uses a default value.

  • BaggageMetricLabel

This label type attempts to obtain the value associated with the requested name from the span's baggage items, and if not found uses a default value.

Default Labels

By default, the metrics are reported using the following labels:

  • operation - the operation associated with the span

  • span.kind - the span.kind tag associated with the span, by default if not specified, then the metrics for the span will not be recorded

  • error - the error tag, by default the value will be false

Adding Metric Labels

An application may want to add specific labels to help classify the metrics being reported for each span.

For example, many Tracer implementations associate spans with a service name. This can also be achieved for the span metrics, by specifying a ConstMetricLabel when creating the reporter.

Customizing Metric Labels

When initializing the MetricsReporter, it would be possible to provide a MetricLabel for a default label, to override its value.

For example, a MetricLabel implementation could be provided for the error label, which could override the standard boolean value and potentially provide an alternative set of values based on other tags or baggage values associated with a span.

Reporting Metrics

Micrometer metrics reporting is provided by a specific implementation of the MetricsReporter interface.

For example,

// Your application needs to setup a concrete Micrometer backend
io.micrometer.core.instrument.Metrics.addRegistry(new SimpleMeterRegistry());

// Prepare a concrete OpenTracing tracer
Tracer tracer = getTracer();

// A reporter can then be created like this:
MicrometerMetricsReporter reporter = MicrometerMetricsReporter.newMetricsReporter()
    .withName("MyName")
    .withConstLabel("span.kind", Tags.SPAN_KIND_CLIENT)
    .build();

// Wrap the concrete Tracer, so that we can record the metrics about the reported spans
Tracer metricsTracer = io.opentracing.contrib.metrics.Metrics.decorate(tracer, reporter);

Builder methods are provided to enable new labels to be provided, or existing ones overridden.

Refer to the Micrometer documentation on how to get the metrics into a concrete backend, such as JMX, StatsD or Prometheus.

Reporting metrics with a Prometheus backend

Auto-configuration for Spring Boot applications of a Prometheus backend is provided via the module opentracing-metrics-prometheus-spring-autoconfigure. To auto-register an endpoint serving Prometheus metrics, export the property OPENTRACING_METRICS_EXPORTER_HTTP_PATH with the path to be used - e.g. "/metrics".

TracerObserver approach

Instead of decorating an OpenTracing tracer, it's also possible to combine the usage of Spring Boot's auto configuration feature and the TracerObserver from io.opentracing.contrib:opentracing-api-extensions-tracer.

Just include the artifact io.opentracing.contrib:opentracing-metrics-spring-autoconfigure into your Spring Boot application and the TracerObserver will be registered automatically.

Known Issues

Only works with ActiveSpanSource implementations that don't require a tracer specific Span implementation

The current mechanism uses a wrapper tracer implementation to identify when a span has finished. This requires a wrapped Span to be passed to the ActiveSpanSource.makeActive method, and therefore will fail if the ActiveSpanSource implementation has an expectation of receiving a particular Span implementation.

This wrapper approach is only being used as a short term workaround until a TracerObserver mechanism is available.

Release

Follow instructions in RELEASE

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].