### Install Dependencies and Start Development Server Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.react/README.md Install project dependencies using npm and start the development server. The UI will run on http://localhost:3000 and communicate with the backend. ```bash npm install npm run start ``` -------------------------------- ### Start Orchestration Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Schedules a new orchestration instance to start. You can optionally provide a custom instance ID. ```APIDOC ## POST /a/p/i/{connName}-{hubName}/orchestrations ### Description Schedules a new orchestration instance. An optional custom instance ID can be provided. ### Method POST ### Endpoint /a/p/i/{connName}-{hubName}/orchestrations ### Parameters #### Request Body - **name** (string) - Required - The name of the orchestrator function to start. - **id** (string) - Optional - A custom instance ID for the orchestration. - **data** (any) - Optional - The input payload for the orchestration. ### Request Example ```bash BASE="https://my-dfm.azurewebsites.net/durable-functions-monitor/a/p/i/--MyTaskHub" curl -s -X POST "${BASE}/orchestrations" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-dfm-xsrf-token: $XSRF_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "OrderProcessingOrchestrator", "id": "order-2024-custom-id", "data": { "orderId": 99, "customerId": "CUST-42", "items": ["itemA", "itemB"] } }' ``` ### Response #### Success Response (200) - **instanceId** (string) - The ID of the newly created orchestration instance. ### Response Example ```json { "instanceId": "order-2024-custom-id" } ``` ``` -------------------------------- ### Start Durable Functions Monitor Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/custom-backends/dotnetIsolated-mssql/README.md Run the Azure Functions host locally to start the Durable Functions Monitor. Access the monitor via the specified local HTTP port. ```bash func start ``` -------------------------------- ### Start a New Orchestration with Custom ID Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Schedules a new orchestration instance with a provided custom instance ID. Requires 'x-dfm-xsrf-token' and 'Content-Type' headers. ```bash BASE="https://my-dfm.azurewebsites.net/durable-functions-monitor/a/p/i/--MyTaskHub" curl -s -X POST "${BASE}/orchestrations" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "x-dfm-xsrf-token: $XSRF_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "OrderProcessingOrchestrator", "id": "order-2024-custom-id", "data": { "orderId": 99, "customerId": "CUST-42", "items": ["itemA", "itemB"] } }' ``` -------------------------------- ### Add DurableFunctionsMonitor NuGet Package Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.dotnetisolated.core/README.md Install the DurableFunctionsMonitor.DotNetIsolated package using the .NET CLI. ```bash dotnet add package DurableFunctionsMonitor.DotNetIsolated ``` -------------------------------- ### Get backend version and connection info Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Retrieves the storage account name, task hub name, backend version, and user permissions. Requires Authorization header. ```bash BASE="https://my-dfm.azurewebsites.net/durable-functions-monitor/a/p/i/--MyTaskHub" curl -s "${BASE}/about" \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ```json # Read-only user response: # { # "accountName": "mystorageaccount", # "hubName": "MyTaskHub", # "version": "6.8.1.0 (isolated)", # "permissions": [] # } ``` -------------------------------- ### Configure Development Environment Variable Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.react/README.md Create a .env.development.local file to specify the backend URI for the development server. Ensure the backend is running on http://localhost:7072. ```bash REACT_APP_BACKEND_BASE_URI=http://localhost:7072 ``` -------------------------------- ### DfmEndpoint.Setup() (.NET In-Process) Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Embeds DfMon into an existing In-Process Azure Functions project by calling DfmEndpoint.Setup() in a WebJobsStartup class. This adds all DfMon API endpoints and static UI to the host automatically. ```APIDOC ## DfmEndpoint.Setup() ### Description Embeds DfMon into an existing In-Process Azure Functions project by calling `DfmEndpoint.Setup()` in a `WebJobsStartup` class. All DfMon API endpoints and static UI are added to the host automatically. ### Language C# ### Usage ```csharp // NuGet: Install-Package DurableFunctionsMonitor.DotNetBackend // In your Functions project: using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Hosting; using DurableFunctionsMonitor.DotNetBackend; [assembly: WebJobsStartup(typeof(MyProject.DfmStartup))] namespace MyProject { public class DfmStartup : IWebJobsStartup { public void Configure(IWebJobsBuilder builder) { DfmEndpoint.Setup( settings: new DfmSettings { // Allow only specific AAD app roles AllowedFullAccessAppRoles = new[] { "DfMon.Admin" }, AllowedReadOnlyAppRoles = new[] { "DfMon.Viewer" }, // Or restrict by individual email addresses // AllowedUserNames = new[] { "admin@mycompany.com" }, // Optionally set ReadOnly mode globally // Mode = DfmMode.ReadOnly, // Custom folder for Liquid templates (adjacent to host.json) CustomTemplatesFolderName = "my-dfm-templates", // Custom claim names if not using defaults UserNameClaimName = "preferred_username", // default RolesClaimName = "roles" // default }, extensionPoints: new DfmExtensionPoints { // Override history fetching for a custom storage provider GetInstanceHistoryRoutine = async (durableClient, connStringEnvVar, hubName, instanceId) => { // Custom implementation - e.g., read from SQL or Netherite return await MyCustomStorage.GetHistory(instanceId); }, // Override Task Hub name discovery GetTaskHubNamesRoutine = async (connStringEnvVar) => { return new[] { "ProdHub", "StagingHub" }; } } ); } } } ``` ``` -------------------------------- ### Setup DfmEndpoint in Azure Functions Startup Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.dotnetbackend/NUGET_README.md Invoke DfmEndpoint.Setup() in your Function's startup class to enable the Durable Functions Monitor endpoint. Ensure AzureWebJobsStorage is configured correctly. ```csharp [assembly: WebJobsStartup(typeof(StartupNs.Startup))] namespace StartupNs { public class Startup : IWebJobsStartup { public void Configure(IWebJobsBuilder builder) { DfmEndpoint.Setup(); } } } ``` -------------------------------- ### Get Orchestration History Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Retrieves the execution history of a specific orchestration, with support for time-range filtering and pagination. ```APIDOC ## GET /a/p/i/{connName}-{hubName}/orchestrations('{instanceId}')/history ### Description Returns the execution history of an orchestration with optional time-range filtering and paging. ### Method GET ### Endpoint /a/p/i/{connName}-{hubName}/orchestrations('{instanceId}')/history ### Parameters #### Query Parameters - **$filter** (string) - Optional - Filters results based on the timestamp. - **$skip** (integer) - Optional - Skips a specified number of results. - **$top** (integer) - Optional - Returns a specified number of results. ### Request Example ```bash INSTANCE_ID="order-abc-123" BASE="https://my-dfm.azurewebsites.net/durable-functions-monitor/a/p/i/--MyTaskHub" curl -s "${BASE}/orchestrations('${INSTANCE_ID}')/history?\$filter=timestamp ge '2024-01-15T10:00:00Z'&\$skip=0&\$top=100" \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` ### Response #### Success Response (200) - **history** (array) - An array of history events for the orchestration. - **timestamp** (string) - The timestamp of the event. - **eventType** (string) - The type of the event. - **eventId** (string) - The ID of the event. - **name** (string) - The name of the activity or orchestrator. - **scheduledTime** (string) - The scheduled time for the event. - **input** (any) - The input payload for the event. - **result** (any) - The result payload for the event. - **details** (any) - Additional details about the event. - **durationInMs** (integer) - The duration of the task in milliseconds. - **subOrchestrationId** (string) - The instance ID of a sub-orchestration. ### Response Example ```json { "history": [ { "timestamp": "2024-01-15T10:00:00.0000000Z", "eventType": "ExecutionStarted", "eventId": null, "name": "OrderProcessingOrchestrator", "scheduledTime": null, "input": "{\"orderId\": 42}", "result": null, "details": null, "durationInMs": null, "subOrchestrationId": null } ] } ``` ``` -------------------------------- ### Add DurableFunctionsMonitor.DotNetIsolated.MsSql NuGet Package Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.dotnetisolated.mssql/README.md Install the necessary NuGet package to enable Durable Functions Monitor integration with MsSql durability. ```bash dotnet add package DurableFunctionsMonitor.DotNetIsolated.MsSql ``` -------------------------------- ### Build and Copy Artifacts Source: https://github.com/microsoft/durablefunctionsmonitor/blob/main/durablefunctionsmonitor.react/README.md Use the custom build command to compile the project and copy the resulting artifacts to the DfmStatics folder within the .NET backend project. ```bash npm run build-and-copy ``` -------------------------------- ### Get Durable Entity Orchestration Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Retrieves information about a durable entity orchestration instance using its instance ID, which follows the '@EntityName@entityKey' pattern. ```bash curl -s "${BASE}/orchestrations('%40Counter%40myCounter')" \ -H "Authorization: Bearer $ACCESS_TOKEN" ``` -------------------------------- ### Get Backend Version and Connection Info Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Returns the storage account name, task hub name, backend version string, and the current user's effective permissions. ```APIDOC ## GET /a/p/i/{connName}-{hubName}/about ### Description Returns the storage account name, task hub name, backend version string, and the current user's effective permissions. ### Method GET ### Endpoint /a/p/i/{connName}-{hubName}/about ### Response #### Success Response (200) - **accountName** (string) - The name of the storage account. - **hubName** (string) - The name of the task hub. - **version** (string) - The version of the Durable Functions backend. - **permissions** (array of strings) - The effective permissions for the current user. ``` -------------------------------- ### Get AAD Authentication Configuration Source: https://context7.com/microsoft/durablefunctionsmonitor/llms.txt Retrieves the AAD client ID and authority for client-directed login, or the current user's name in server-directed (EasyAuth) mode. ```APIDOC ## GET /a/p/i/easyauth-config ### Description Returns the AAD client ID and authority needed by the React UI to perform client-directed (token-based) login. In server-directed (EasyAuth cookie) mode, returns only the current user's name. ### Method GET ### Endpoint `/a/p/i/easyauth-config` ### Response #### Success Response (200) - **clientId** (string) - The AAD client ID (if in client-directed mode). - **authority** (string) - The AAD authority URL (if in client-directed mode). - **userName** (string) - The current user's name (if in server-directed mode). ```