Skip to content

Instantly share code, notes, and snippets.

@evanlouie
Created November 15, 2021 20:10
Show Gist options
  • Save evanlouie/e9df0b17f89364d17e31442e9e4ebe77 to your computer and use it in GitHub Desktop.
Save evanlouie/e9df0b17f89364d17e31442e9e4ebe77 to your computer and use it in GitHub Desktop.
mermaid flow doc
sequenceDiagram
participant AI as Application Insights
link AI: JS SDK @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/nodejs
link AI: Node.js SDK @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript
link AI: Azure Functions Java Distributed Tracing @ https://docs.microsoft.com/en-ca/azure/azure-monitor/app/monitor-functions
link AI: AKS App Monitoring @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/kubernetes-codeless
link AI: AKS Java Codeless Monitoring @ https://docs.microsoft.com/en-us/azure/azure-monitor/app/java-in-process-agent
participant Functions as Azure Functions
participant FrontendServer as Frontend
participant Storage as Storage Account
participant IoTHub as IoT Hub
link IoTHub: Uploading files @ https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-file-upload
participant EdgeDevice as Edge Device
actor Bob as Bob (Frontend User/Client)
actor Alice as Alice (IoT Platform Engineer)
loop user requests frontend
Bob->>+FrontendServer: Makes request to page
FrontendServer-->>-Bob: HTML with AppInsights JS
loop as user interacts with client
par Page changes, load times, etc...
Bob-->>AI: Metrics
and API calls
Bob->>+FrontendServer: Makes API calls
FrontendServer->>Functions: Does stuff
Functions-->>AI: Metrics
FrontendServer-->>AI: Metrics
FrontendServer-->>-Bob: response
Bob-->>AI: Sends metrics for API call
end
end
end
loop edge device uploads files
EdgeDevice->>+IoTHub: Initiate File upload
IoTHub->>EdgeDevice: correlationId and sasToken
Note over IoTHub,EdgeDevice: How to monitor failures in SaS token generation?
EdgeDevice->>+Storage: Upload Blob
Note over EdgeDevice,Storage: How to monitor if upload fails?
Storage-->>-EdgeDevice: ack
EdgeDevice->>IoTHub: Notify Complete upload
IoTHub-->>-EdgeDevice: ack
Storage-->>Functions: Storage trigger
Note over Storage,Functions: Can we pick up the correlationId created from IoTHub from the storage trigger?
Functions->>+Functions: Do something
Note over Functions,Functions: TBD: What to do here? (malware scan?)
Functions-->>AI: Requests, dependencies, traces, etc...
Functions->>-Functions: Do something
end
loop Every N Minutes
AI->>AI: Check that messages in == messages out (within a range)
alt is ok
AI->>AI: noop
else is not ok
AI->>Alice: Email notification saying something is wrong
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment