Silky Microservice FrameworkSilky Microservice Framework
Home
Docs
Config
Source
github
gitee
  • 简体中文
  • English
Home
Docs
Config
Source
github
gitee
  • 简体中文
  • English
  • Introduction

    • Silky Framework Overview
  • Getting Started

    • Glossary
    • Quick Start
    • Project Template
    • Microservice Architecture
    • Sample Projects
  • Host & Module

    • Host Types
    • Gateway Configuration
    • Module System
    • Plugin System
  • Gateway & HTTP

    • Swagger / OpenAPI
    • MiniProfiler
    • CORS
    • Audit Logging
  • Service & RPC

    • App Services & Service Entries
    • RPC Communication
    • WebSocket
    • Service Registry
    • Service Governance
  • Data & Cache

    • EFCore Data Access
    • Caching
    • Distributed Lock
  • Security & Auth

    • Identity & Authentication
    • Distributed Transactions
  • Infrastructure

    • Dependency Injection
    • Object Mapping
    • Validation
    • Link Tracking (SkyAPM)
    • Logging (Serilog)
    • Health Checks
    • Message Bus (MassTransit)
    • Unit & Integration Testing

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:

LayerDiagnostics PackageSpan Info
HTTP GatewaySilky.SkyApm.Diagnostics.HttpHTTP method, URL, status code
RPC CallsSilky.SkyApm.Diagnostics.RpcService entry ID, host, latency
TCC TransactionSilky.SkyApm.Diagnostics.TransactionTransaction ID, participant list, phase
EFCoreSkyAPM.Plugin.EFCoreSQL 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.

Edit this page
Prev
Validation
Next
Logging (Serilog)