Giter VIP home page Giter VIP logo

lametric-azure's Introduction

lametric-azure

Context : I want to keep an eye on how many resources are currently provisioned on a specific Azure subscription and understand when we are adding or removing resources.

I recently got a LaMetric Time device which can be easily configured to poll an HTTP endpoint and it was quite a while I wanted to play a bit with Azure Durable Entities that's why I assembled this simple integration.

The architecture is pretty straightforward:

In this example I am using Azure functions to query the Azure Resource Graph to count the resources using a simple query like the following:

Resources | summarize count()

The result of the query is persisted using an Azure Durable Entity function activated via an HTTP.

The entity state looks as the following:

{
    "entityExists": true,
    "entityState": {
        "Name": null,
        "PreviousRead": 575,
        "LastRead": 571,
        "UpdatedOn": "2021-04-01T19:44:04.5683114Z"
    }
}

The output of the GET call returned to the LaMetric device is formatted this way:

{
    "frames": [
        {
            "text": "-4", // increment
            "icon": 124 // up or down icon
        },
        {
            "text": "571", // last read
            "icon": 37287 // azure icon
        }
    ]
}

Here the final result.

e2e visibility with Application Insights

Arcus.Observability is used to simplify the integration with Application Insights.

notes about durable entities

  • Entities stateful addressable singletons.

  • Entities can be called either from durable clients (IDurableEntityClient) or from durable orchestrations (IDurableOrchestrationClient).

  • Entities guarantee that requests are processed in series.

  • Entities are triggered via 'control' queues (default 4) prefixed with the {task-hub-name}.

    • Only a single Azure Function instance can read from a single queue at a certain time. This is guarantee by the blob leases approach of the durable framework.
    • from a scale prospective, 4 queues means maximum 4 azure function instances. In my case 1 function instance interacted with two queues.

    • the Functions scale controller add/remove instances according to the queue latency for peeking messages.

  • Data persistence for Durable Functions.

  • Performance and scale of durable functions.

The Entity instances are persisted in the 'Instances' table with the key @{entityname}@{entityid}

History table contains the events occurred for every instance. There is one table per "hubname".

lametric-azure's People

Contributors

massimoc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.