APM Integration


Use OpenTracing

  • Method 1: inject Tracer provided by APM system through reading system parameters

Add startup arguments


Call initialization method.

  • Method 2: inject Tracer provided by APM through parameter.
ShardingTracer.init(new SkywalkingTracer());

Notice: when using SkyWalking OpenTracing agent, you should disable the former ShardingSphere agent plug-in to avoid the conflict between them.

Use SkyWalking’s Automatic Agent

Please refer to SkyWalking Manual.

Use OpenTelemetry

Just fill in the configuration in agent.yaml. For example, export Traces data to Zipkin.

      otel.resource.attributes: "service.name=shardingsphere-agent"
      otel.traces.exporter: "zipkin"
      otel.exporter.zipkin.endpoint: ""

Result Demonstration

No matter in which way, it is convenient to demonstrate APM information in the connected system. Take SkyWalking for example:

Application Architecture

Use ShardingSphere-Proxy to visit two databases, and, and there are two tables in each one of them.


The topology diagram

It can be seen from the picture that the user has accessed ShardingSphere-Proxy 18 times, with each database twice each time. It is because two tables in each database are accessed each time, so there are totally four tables accessed each time.

Tracking Data

The tracking diagram

SQL parsing and implementation can be seen from the tracing diagram.

/Sharding-Sphere/parseSQL/ indicates the SQL parsing performance this time.

The parsing node

/Sharding-Sphere/executeSQL/ indicates the SQL parsing performance in actual execution.

The actual access node


Exception tracking diagram

Exception nodes can be seen from the tracing diagram.

/Sharding-Sphere/executeSQL/ indicates the exception results of SQL.

Exception node

/Sharding-Sphere/executeSQL/ indicates the exception log of SQL execution.

Exception log