Overview
In a microservice architecture, a single user request may traverse multiple services. Distributed tracing records the full call chain, enabling you to diagnose latency, errors, and service dependencies.
Silky integrates with Apache SkyWalking via the SkyAPM .NET agent, providing automatic tracing for:
- HTTP requests (gateway)
- RPC inter-service calls
- Database queries (EFCore)
- Distributed transactions (TCC)
Installation
<PackageReference Include="Silky.SkyApm.Agent" Version="3.9.2" />
<!-- Add per communication layer: -->
<PackageReference Include="Silky.SkyApm.Diagnostics.Rpc" Version="3.9.2" /> <!-- RPC spans -->
<PackageReference Include="Silky.SkyApm.Diagnostics.Http" Version="3.9.2" /> <!-- HTTP spans -->
<PackageReference Include="Silky.SkyApm.Diagnostics.Transaction" Version="3.9.2" /> <!-- TCC spans -->
Module
[DependsOn(
typeof(SkyApmModule),
typeof(SkyApmRpcDiagnosticsModule),
typeof(DotNettyTcpModule)
)]
public class OrderHostModule : SilkyModule { }
Configuration
appsettings.json
{
"SkyWalking": {
"ServiceName": "order-service",
"Namespace": "production",
"HeaderVersions": [ "sw8" ],
"Sampling": {
"SamplePer3Secs": -1,
"Percentage": -1.0
},
"Logging": {
"Level": "Information",
"FilePath": "logs/skyapm-{Date}.log"
},
"Transport": {
"Interval": 3000,
"ProtocolVersion": "v8",
"QueueSize": 30000,
"BatchSize": 3000,
"gRPC": {
"Servers": "localhost:11800",
"Timeout": 10000,
"ConnectTimeout": 10000,
"ReportTimeout": 600000
}
}
}
}
Environment Variable Alternative
SKYWALKING__TRANSPORT__GRPC__SERVERS=skywalking-oap:11800
SKYWALKING__SERVICENAME=order-service
What Gets Traced
Each framework extension creates a span in the distributed trace:
| Layer | Diagnostics Package | Span Info |
|---|---|---|
| HTTP Gateway | Silky.SkyApm.Diagnostics.Http | HTTP method, URL, status code |
| RPC Calls | Silky.SkyApm.Diagnostics.Rpc | Service entry ID, host, latency |
| TCC Transaction | Silky.SkyApm.Diagnostics.Transaction | Transaction ID, participant list, phase |
| EFCore | SkyAPM.Plugin.EFCore | SQL query, parameters |
Trace Context Propagation
The TraceId and SpanId are propagated automatically via RpcContext through the entire call chain:
HTTP Request (TraceId: abc123)
│
▼
Gateway (Span 1: gateway)
│
▼
OrderService (Span 2: rpc)
│
├─▶ InventoryService (Span 3: rpc)
└─▶ AccountService (Span 4: rpc)
All spans share the same TraceId (abc123), enabling end-to-end trace reconstruction in the SkyWalking UI.
SkyWalking OAP Deployment
Run the SkyWalking backend with Docker Compose:
version: '3.8'
services:
elasticsearch:
image: elasticsearch:7.17.0
environment:
- discovery.type=single-node
ports:
- "9200:9200"
oap:
image: apache/skywalking-oap-server:9.x
environment:
SW_STORAGE: elasticsearch
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
ports:
- "11800:11800"
- "12800:12800"
depends_on:
- elasticsearch
ui:
image: apache/skywalking-ui:9.x
environment:
SW_OAP_ADDRESS: http://oap:12800
ports:
- "8080:8080"
depends_on:
- oap
Open http://localhost:8080 to view traces in the SkyWalking UI.
