• Dependency the toolkit, such as using maven or gradle
   <dependency>
      <groupId>org.apache.skywalking</groupId>
      <artifactId>apm-toolkit-micrometer-registry</artifactId>
      <version>${skywalking.version}</version>
   </dependency>
  • Using org.apache.skywalking.apm.meter.micrometer.SkywalkingMeterRegistry as the registry, it could forward the MicroMeter collected metrics to OAP server.
import org.apache.skywalking.apm.meter.micrometer.SkywalkingMeterRegistry;

SkywalkingMeterRegistry registry = new SkywalkingMeterRegistry();

// If you has some counter want to rate by agent side
SkywalkingConfig config = new SkywalkingConfig(Arrays.asList("test_rate_counter"));
new SkywalkingMeterRegistry(config);

// Also you could using composite registry to combine multiple meter registry, such as collect to Skywalking and prometheus
CompositeMeterRegistry compositeRegistry = new CompositeMeterRegistry();
compositeRegistry.add(new PrometheusMeterRegistry(PrometheusConfig.DEFAULT));
compositeRegistry.add(new SkywalkingMeterRegistry());
  • Using snake case as the naming convention. Such as test.meter will be send to test_meter.

  • Using Millisecond as the time unit.

  • Adapt micrometer data convention.

Micrometer data typeTransform to meter nameSkywalking data typeDescription
CounterCounter nameCounterSame with counter
GaugesGauges nameGaugesSame with gauges
TimerTimer name + “_count”CounterExecute finished count
Timer name + “_sum”CounterTotal execute finished duration
Timer name + “_max”GaugesMax duration of execute finished time
Timer name + “_histogram”HistogramHistogram of execute finished duration
LongTaskTimerTimer name + “_active_count”GaugesExecuting task count
Timer name + “_duration_sum”CounterAll of executing task sum duration
Timer name + “_max”CounterCurrent longest running task execute duration
Function TimerTimer name + “_count”GaugesExecute finished timer count
Timer name + “_sum”GaugesExecute finished timer total duration
Function CounterCounter nameCounterCustom counter value
Distribution summarySummary name + “_count”CounterTotal record count
Summary name + “_sum”CounterTotal record amount sum
Summary name + “_max”GaugesMax record amount
Summary name + “_histogram”GaugesHistogram of the amount
  • Not Adapt data convention.
Micrometer data typeData type
LongTaskTimerHistogram