Delen via


LatentiePlugin

Hiermee worden reacties met een willekeurig aantal milliseconden uit het geconfigureerde bereik vertraagd. Ondersteunt zowel HTTP-aanvragen als STDIO-communicatie.

Dev Proxy latentie simuleren voor een API-aanvraag.

Configuratievoorbeeld

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/rc.schema.json",
  "plugins": [
    {
      "name": "LatencyPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "latencyPlugin"
    }
  ],
  "latencyPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.0.0/latencyplugin.schema.json",
    "minMs": 200,
    "maxMs": 10000
  }
}

Configuratie-eigenschappen

Eigenschap Beschrijving Verstek
minMs De minimale hoeveelheid vertraging die is toegevoegd aan een aanvraag in milliseconden. 0
maxMs De maximale hoeveelheid vertraging die is toegevoegd aan een aanvraag in milliseconden. 5.000

Opdrachtregelopties

Geen

STDIO-ondersteuning

Wanneer u de LatencyPluginSTDIO opdracht gebruikt, voegt de invoegtoepassing kunstmatige latentie toe aan stdout-antwoorden. Het simuleren van latentie is handig om te testen hoe uw toepassing trage MCP-serverreacties (Model Context Protocol) of andere op STDIO gebaseerde hulpprogramma's verwerkt.

Configuratievoorbeeld voor STDIO

{
  "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/rc.schema.json",
  "plugins": [
    {
      "name": "LatencyPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "latencyPlugin"
    },
    {
      "name": "MockSTDIOResponsePlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
      "configSection": "mockSTDIOResponsePlugin"
    }
  ],
  "latencyPlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/latencyplugin.schema.json",
    "minMs": 100,
    "maxMs": 500
  },
  "mockSTDIOResponsePlugin": {
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.1.0/mockSTDIOresponseplugin.schema.json",
    "mocksFile": "STDIO-mocks.json"
  }
}

Voer vervolgens het volgende uit:

devproxy STDIO npx -y @modelcontextprotocol/server-filesystem

Volgende stap