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

Silky integrates MiniProfiler to provide real-time profiling of HTTP requests — including RPC timing, database queries, and cache hits. Use it in development and staging environments to quickly identify performance bottlenecks.

Installation

<PackageReference Include="Silky.Http.MiniProfiler" Version="3.9.2" />

Setup

Module Reference

[DependsOn(
    typeof(MiniProfilerModule),
    typeof(GatewayHostModule)
)]
public class GatewayModule : SilkyModule { }

Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    services.AddSilkyHttpCore()
            .AddSilkyMiniProfiler();   // adds MiniProfiler services
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment() || env.IsStaging())
    {
        app.UseMiniProfiler();         // serves /mini-profiler-resources/**
    }

    app.UseSwagger();
    app.UseSwaggerUI(c =>
    {
        c.SwaggerEndpoint("/swagger/v1/swagger.json", "API V1");
        c.IndexStream = () =>
            typeof(Startup).Assembly
                .GetManifestResourceStream(
                    "GatewayHost.wwwroot.swagger.index.html");
        // Use the built-in index template that injects MiniProfiler widget
    });

    app.UseSilkyRpcProxy();
}

MiniProfiler in Swagger UI

Silky provides a customized Swagger index template that automatically injects the MiniProfiler widget into the Swagger UI. After calling app.UseMiniProfiler(), open the Swagger UI — a profiling widget appears in the top-left corner showing timing for the last request.

Profiling RPC Calls

When MiniProfiler is enabled, each RPC call made through the gateway is timed and appears in the profiler trace:

GET /api/order/1  42ms total
  └─ RPC: IOrderAppService.GetAsync   38ms
      └─ EFCore query                 12ms

Configuration

{
  "miniProfiler": {
    "enabled": true,
    "colorScheme": "Light",
    "routeBasePath": "/mini-profiler-resources",
    "maxUnviewedProfiles": 20,
    "popupStartHidden": false
  }
}

Warning

Enable MiniProfiler only in non-production environments. It adds per-request overhead and exposes internal timing details.

Edit this page
Prev
Swagger / OpenAPI
Next
CORS