The aim of this framework is to measure maturity across the disciplines required to build, test, deploy, reuse, support & sell Intellectual Property. This flexible framework is based on a number of conventions to measure "quality", many of these measures are subjective, rather than qualitative, and need to reviewed by people rather than automated by tools.
Our IP exists at different levels of fidelity:
| Level | Type |
|---|---|
| 0 | Script / Template / Code file |
| 1 | Component |
| 2 | Tool |
| 3 | HTTP APIs |
| 4 | Solution |
| 5 | Product |
Each of these has different nuances when it comes to the categories in the IP Maturity Model outlined below.
We have, collectively, defined the following categories as quality measures for our IP. In many ways these measures can be thought of as a more traditional "definition of done". These quality measures cover different aspects of the lifecycle of IP, from maintainance to adoption, to operational support. It also includes commercial and legal concerns.
- IP Maturity Model
- Categories
- Shared Engineering Standards
- Coding Standards
- Executable Specifications
- Coverage
- Benchmarks
- Reference Documentation
- Design & Implementation Documentation
- How-to Documentation
- Demos
- Date of Last IP Review
- Framework Version
- Associated Work Items
- Source Code Availability
- License
- Production Use
- Insights
- Packaging
- Deployment
- Ops
- The IMM Schema
- How to use the IP Maturity Model
- Building
- Licenses
- Project Sponsor
- Code of conduct
- Categories
We have developed a standardised set of configuration files for projects and IDEs. Using these creates a pit of quality for internal and external developers to follow.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Configured |
We have agreed upon coding standards for our primary languages, and in most languages these are enforced by linters or other code analysis tools.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Enforced via tooling |
Executable Specifications are our fundamental design tool; whether via Gherkin or OpenAPI, it creates a shared understanding of behaviour, and a common domain language.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Specs which cover golden path / APIs have full OpenAPI Definition |
| +1 | Specs which cover common failure cases |
| +1 | Specs which explore edge cases |
Code coverage should be used as a ancillary measure of how well we have written our Executable Specifications. We could expect a similar score across both categories. A discrepancy between scored requires further inspection & analysis.
| Score | Measure |
|---|---|
| 0 | 0-25 |
| +1 | +26-50 |
| +1 | 51-75 |
| +1 | 75+ |
We are commonly asked to write high performance / low latency code; understanding the performance characteristics from a memory and CPU perspective is vital as production performance issues have big reputational impact.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Benchmarks which cover baseline performance |
| +1 | Benchmarks which demonstrate failure conditions |
Code should be self-documenting, but long term support of maintaince of code requires context and narrative as well as purpose.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Good quality |
| +1 | Technical Fellow quality |
One of our constant failings is under valuing the thought and effort that goes into creating solutions, and capturing all that knowledge in a format we can use to take customers along on the journey.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Up-to-date architecture & high level conceptual docs & diagrams |
| +1 | Logical, infrastructure, security & ops views |
| +1 | Constraints & extensibility (obtained from benchmarks & specs) |
The use of IP can be nuanced. Effective documentation allows users to be self-starters. Questions should be captured as FAQs.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Common scenarios |
| +1 | Extensibility Scenarios |
| +1 | FAQs / Troubleshooting |
Understanding how to get started with our IP, or how different elements of IP can be used together is fundamental for increased producivity.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Common scenarios |
| +1 | Extensibility Scenarios |
| +1 | End to end integration (with other IP) |
How recently IP was reviewed is a powerful code smell. We exist at the bleeding edge, which means that change is a constant. We need to be vigilant to change, especially when we depend on cloud PaaS services that can change beneath our feet.
| Score | Measure |
|---|---|
| 0 | Unknown |
| 1 | > 3 months |
| 2 | > 1 month |
| 3 | < 1 month |
The majority of our IP is based on the .NET Framework. This is now a rapidly evolving ecosystem. Staying up to date is no small feat.
| Score | Measure |
|---|---|
| 0 | Using an unsupported flavour of .NET |
| +1 | Using a LTS version of a flavour of .NET |
| +1 | Using the most current LTS flavour of .NET |
The number of associated work items is another code smell; it can signal either chaos or order. We need to distinguish between these two states.
| Score | Measure |
|---|---|
| 0 | None |
| 1 | Bugs & Features |
| 2 | Curated Bugs & Features |
| 3 | Active Roadmap |
One of the most overlooked aspects of our use of IP is supporting our contractual clauses, allowing customers to access the source code for the binaries we use. Historically, we have been approached 5 years after the actual engagement as part of acquisition / due dilligence processes.
| Score | Measure |
|---|---|
| 0 | None |
| 1 | Snapshot archive for escrow |
| 2 | Private OSS / Mirrored Repo |
| 3 | Public OSS |
A foundation of our commercial success is establishing the licensing of our IP.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Copyright headers in each source file |
| +1 | License in Source & Packages |
| +1 | Contributor license in Repo |
A good measure of the quality of our IP is how many times it is being used in a production environment by our customers.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Accepted by a customer |
| +1 | In production use by a customer |
| +1 | In production use by multiple customers |
When things go wrong, we need the infrastucture in place to help us quickly resolve the situation.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Telemetry, Diagnostics & Debugging |
| +1 | Perf Counters |
| +1 | Operational Insights (Custom Queries defining abnormal behaviour) |
It's one thing to create reusable IP, it's entirely another for it to be in a form that easy to find and use.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Packaged |
| +1 | Versioned |
| +1 | Discoverable |
The final hurdle is getting the IP into an environment where it can be used.
| Score | Measure |
|---|---|
| 0 | None |
| +1 | Scripted & Documented |
| +1 | Templated |
| +1 | Multi-tenanted - as a Service |
We need to consider other personas, whose funciton is to support the IP we create. How do we make their experience "delightful"?
| Score | Measure |
|---|---|
| 0 | TBD |
The IMM schema is designed to be very flexible as you may decide that you want to add or alter categories. The current RuleSet is defined in the Endjin.Imm.App project in the solution.
Each rule needs a unique, guid based Id, a name, and a data type which can either be Discrete (meaning it can only be scored by a single item listed in the schema), or Continuous (meaning that the score can be cumulative). These two data types are used to select and run the correct rules engine to calculate the values to be used to render the badges.
Each project that adopts the IMM simply adds a imm.yaml file into the root of the repo. Endjin.Ip.Maturity.Model.Host is an Azure Function, which when given the path to the GitHub repo, will render the IMM Measure as a badge, which can be displayed in the repo and provide an "at a glance" view of the quality of the project.
A deployment of the Function renders badges only for repositories owned by the GitHub organizations in its accept list. By default, this is endjin's open source estate. See Allowed GitHub organizations.
The Azure Function exposes a HTTP Trigger, which has two actions.
Call the the Function api/imm/github/<Org_Name>/<Repo>/total?cache=false
And it will render a badge - the example below is for the AIS.NET Project (you may need to refresh the page to wake the Function up!)
To display a badge for each measure you need to call api/imm/github/<Org_Name>/<Repo>/rule/<RuleId>?nocache=true
Here are examples for the AIS.NET Project;
You will need the .NET 10 SDK; the version is pinned by global.json in the root of the repo. The solution, Solutions/Endjin.Ip.Maturity.Model.slnx, uses Central Package Management (Solutions/Directory.Packages.props) and shared build settings (Solutions/Directory.Build.props).
dotnet build Solutions/Endjin.Ip.Maturity.Model.slnx
dotnet test --solution Solutions/Endjin.Ip.Maturity.Model.slnxThe full build process, which is the same one CI runs, uses ZeroFailed. It needs PowerShell 7, and it downloads the ZeroFailed and InvokeBuild modules on first run:
./build.ps1It versions the build with GitVersion, then builds, tests, writes a code coverage report to _codeCoverage/, and publishes the Functions app to _packages/. Its configuration is in .zf/build/config.ps1.
ZeroFailed records the exact version of each extension that a process uses in a lock file. The build's lock file is .zf/build/extensions.lock.json, and the deployment's lock file is .zf/deploy/extensions.lock.json. In GitHub Actions, build.ps1 and deploy.ps1 run in Frozen mode. In this mode, they install the versions in the lock file, and they fail if the configured extensions differ from it. Other runs use Write mode, which resolves the extensions again and updates the lock file. To update the extensions, for example to get the latest commit of an extension that uses main, run the script locally and commit the changed lock file. To check the lock file without changing it, use -ZfExtensionsLockMode Frozen.
There are three test projects. They are written with MSTest and Shouldly, and run on Microsoft.Testing.Platform. None of them uses the network: GitHub is replaced by a stub HTTP handler or by NSubstitute substitutes.
Solutions/Endjin.Imm.Testscovers rule evaluation, YAML loading, and fetching and caching the rule set and IMMs from GitHub.Solutions/Endjin.Badger.Testscovers SVG badge rendering, including how far the widths of the fonts a browser falls back to without Verdana (DejaVu Sans, and Liberation Sans for Arial and Helvetica) are from the Verdana widths badges are sized with.Solutions/Endjin.Ip.Maturity.Model.Host.Testscovers the badge andshowbadgesfunctions, the startup warm-up, the spans they are traced with, and when telemetry is exported.
To collect code coverage and a TRX report as well:
dotnet test --solution Solutions/Endjin.Ip.Maturity.Model.slnx --coverage --report-trxEndjin.Imm.App is a console app that renders badges for the imm-default.yaml file in its working directory, which is handy for checking changes to the badge rendering.
Badge text is sized from a table of Verdana's advance widths and kerning (Solutions/Endjin.Badger/VerdanaMetrics.g.cs), so no fonts are needed on the server. The viewer's browser draws the text in the first font it has from Verdana, Geneva, DejaVu Sans, sans-serif, and each text has a textLength of its measured Verdana width, so whatever font is used fills exactly the width the badge was sized for. The tables are generated by tools/GenerateFontMetrics.cs, which also generates the DejaVu Sans and Liberation Sans tables the tests compare against (the font files themselves are never committed).
Endjin.Ip.Maturity.Model.Host is an Azure Function using the isolated worker model with ASP.NET Core integration. To run it locally, copy local.settings.json.template to local.settings.json and start it with the Azure Functions Core Tools (func start, or dotnet run, which calls func for you). The template sets FUNCTIONS_WORKER_RUNTIME to dotnet-isolated, which the Core Tools need. In Azure, the Function App runs on Flex Consumption, which sets the runtime in a different way: see Deploying to Azure Functions Flex Consumption.
A deployment of the Host evaluates IMMs only for repositories owned by the GitHub organizations (or users) in its accept list. Without this list, anyone could use the deployment to score any public repository, and to make it fetch content from GitHub for them.
The list is the Imm:AllowedGitHubOrganizations setting in the Host's appsettings.json, which is part of the deployment package. As shipped, it is endjin's open source estate:
{
"Imm": {
"AllowedGitHubOrganizations": [
"endjin",
"corvus-dotnet",
"ais-dotnet",
"marain-dotnet",
"menes-dotnet",
"argotic-syndication-framework",
"zerofailed",
"reaqtive"
]
}
}To change the list for every deployment, edit appsettings.json. To change it for one deployment without rebuilding, set the app setting (or environment variable) Imm__AllowedGitHubOrganizations to the names, separated by commas, for example contoso,fabrikam. The value replaces the whole list in appsettings.json. It does not add to the list, so to keep the defaults, include them. The name * allows every organization. Locally, add the setting to the Values in local.settings.json. In an environment that you deploy with deploy.ps1, add it to additionalAppSettings in config/<environment>.ps1, because a deployment removes app settings that are set by hand.
Names are not case sensitive. If the list is missing or empty, the Host does not start, so a mistake in the configuration cannot make it refuse every badge or allow every organization without you noticing. For an organization that is not in the list, the badges are light grey and say org not allowed, and the showbadges page has status 403. Both set the X-Imm-Error header to org-not-allowed. The Host checks the organization before it fetches anything from GitHub.
The Host is designed to run on the Flex Consumption plan, which runs on Linux only.
Create the app with the .NET 10 isolated runtime and 2048 MB instances. Put its storage account in the same region as the app.
az functionapp create --resource-group <rg> --name <app> --storage-account <storage> \
--flexconsumption-location <region> --runtime dotnet-isolated --runtime-version 10.0 \
--instance-memory 2048- Use 2048 MB instances. Do not use 512 MB: the CPU allocation scales with the memory size, and a 512 MB instance has a quarter of a core (a 2048 MB instance has one core), so cold starts and badge rendering are slower.
- Flex Consumption sets the runtime and its version in the app's
functionAppConfig, not in app settings. Do not set these app settings, which Flex Consumption does not support:FUNCTIONS_WORKER_RUNTIME,FUNCTIONS_EXTENSION_VERSION,WEBSITE_RUN_FROM_PACKAGEandWEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT. The site settingsalwaysOn,use32BitWorkerProcessandnetFrameworkVersionalso do not apply. - Do not set
WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED. By default, Flex Consumption starts .NET isolated apps from a pre-started placeholder, which makes cold starts faster. - The Warmup trigger is not supported on Flex Consumption, so the Host does not use it. The Host warms itself up instead (see below).
An app with no always-ready instances scales to zero, and the first request after that waits for a cold start. To keep one instance ready for HTTP requests at all times:
az functionapp scale config always-ready set --resource-group <rg> --name <app> --settings http=1You pay for always-ready instances while they are idle, so this is a trade-off between cost and latency. It is the only way to make sure that no request waits for a cold start.
The build publishes the Host for linux-x64 with ReadyToRun compilation, which precompiles the assemblies to native code so that less code is JIT compiled during a cold start. The publish settings are in .zf/build-config.ps1, not in the project file, so local builds and tests are not affected. The output is in _packages/Endjin.Ip.Maturity.Model.Host/linux-x64/, and CI uploads it as the function-app artifact. CI also runs tools/Test-ReadyToRun.ps1, which fails the build if the app's own assemblies are not ReadyToRun.
The package is ready to run, so deploy it without a remote build. Zip the contents of the publish folder, including the hidden .azurefunctions folder, which the isolated worker needs. (PowerShell's Compress-Archive leaves out hidden files, so do not use it.)
# Linux or macOS
cd _packages/Endjin.Ip.Maturity.Model.Host/linux-x64 && zip -r ../app.zip . && cd -
# PowerShell
[IO.Compression.ZipFile]::CreateFromDirectory("$PWD/_packages/Endjin.Ip.Maturity.Model.Host/linux-x64", "$PWD/_packages/app.zip")
az functionapp deployment source config-zip --resource-group <rg> --name <app> --src _packages/app.zipFrom GitHub Actions, you can instead deploy the function-app artifact with Azure/functions-action, with remote-build: false and OpenID Connect sign-in to Azure.
deploy.ps1 runs a ZeroFailed deployment, which does the steps in this section for you. It provisions the Function App, zips the package and deploys it. The deployment uses these files:
infra/main.bicepcreates the storage account, Application Insights, the Flex Consumption plan and the Function App. It uses the settings that this section describes. The app connects to its storage account with a user-assigned managed identity (id-<function app name>), which the template creates and gives storage roles before it creates the app.config/common.ps1lists the settings that every environment needs, and sets the ones that are the same for every environment.config/<environment>.ps1sets the values for one environment, for exampleconfig/dev.ps1..zf/deploy/config.ps1configures the deployment process.
The deployment needs:
- The Bicep CLI on your
PATH. If it is not installed, the deployment installs it with the Azure CLI, so you need one of the two. - The Owner role (or another role that can assign roles) on the environment's resource group, because the template assigns storage roles to the app's managed identity. If the resource group does not exist, you also need the right to create it in the subscription. To deploy without the Owner role, for example to test the deployment locally, set the environment variable
IMM_SKIP_RBAC_OPERATIONStotrue, and the template skips the storage role assignments. This works only if the role assignments already exist, for example from an earlier deployment by an Owner. Otherwise, the deployment of the package fails, because the app cannot use its storage account.
To deploy:
- Sign in to Azure PowerShell with
Connect-AzAccount. - Set the environment variable
AZURE_TENANT_IDto the ID of the tenant, and the environment's subscription variable to the ID of its subscription:IMM_DEV_SUBSCRIPTION_IDfor dev, orIMM_PROD_SUBSCRIPTION_IDfor prod. The configuration files read these variables, so the repository does not contain the IDs. Each environment has its own variable, so that a deployment of prod cannot go to the dev subscription by mistake. - Run
./build.ps1 -Configuration Release. The build publishes the app to_packages/Endjin.Ip.Maturity.Model.Host/linux-x64/. If you use-PackagesDir, pass the same value to./deploy.ps1. - Run
./deploy.ps1 -EnvironmentName dev.
The process waits for the deployment of the package to finish. If the deployment fails, the process fails too. Then the process requests a badge from the app, to check that the app works.
The deployment sets all the app's settings and its instance memory size, and replaces any value set by hand, for example in the Azure portal. To change them, change instanceMemoryMB or additionalAppSettings in config/<environment>.ps1, and deploy again.
The build workflow runs the same deployment after a build:
- A build of
maindeploys todev. - A build of a tag deploys to
dev. If the tag is a release version (it has no pre-release label, for example1.2.0), the build then deploys toprodif thedevdeployment succeeds. - Pull request builds do not deploy.
Each deployment job (.github/workflows/deploy.yml) runs in the GitHub environment with the same name. It downloads the function-app artifact, signs in to Azure with OpenID Connect, and runs ./deploy.ps1. It signs in as the environment's deployment identity, ip-maturity-matrix-dev or ip-maturity-matrix-prod. These identities are defined in endjin/endjin-identity-ops (identities/<nonprod|prod>/endjin/ip-maturity-matrix.yml). That repo also creates the environments and sets their AZURE_CLIENT_ID and AZURE_SUBSCRIPTION_ID variables, and the repository variable AZURE_TENANT_ID. To change what an identity can access, change its file there.
An identity has the Owner role on its environment's resource group only (rg-imm-dev or rg-imm-prod), so resourceGroupName in config/<environment>.ps1 must match that group.
.zf/deploy-config.ps1 uses a development branch of the ZeroFailed.Deploy.Azure extension, because the released versions cannot report the result of a Flex Consumption deployment. When a release supports Flex Consumption, change the extension's GitRef to that release.
When an instance starts, the Host's StartupWarmup service does, in the background, the one-off work that would otherwise slow down the first request: it renders badges, loads and evaluates a small IMM (which compiles that code and builds the YAML deserializer), and fetches the canonical rule set from GitHub, which the Host then caches. It does not delay startup, which matters because Flex Consumption allows an app only 30 seconds to initialize when an instance is assigned to it. Requests that arrive before it finishes are served as usual.
When it finishes, it writes one log line that contains Warm-up:. When the Host exports telemetry (see Tracing and logging with OpenTelemetry), the line goes to the exporter with the rest of the Host's logs. When it does not, the line would never be seen, because the worker relays logs to the Functions host only when they are written during a function invocation, so the Host writes this line (and only this line) to the console, which the Functions host captures. Look for it in the Application Insights traces table, for example with traces | where message contains "Warm-up:", or in the console output of func start. The line gives the time taken by each step and whether the step succeeded:
info: Endjin.Ip.Maturity.Model.Host.StartupWarmup[1] Warm-up: badges 104 ms (ok), yaml/evaluate 35 ms (ok), rule set 80 ms (ok)
A failed step shows failed: and the exception instead of ok, and the line is logged as a warning. A failure does not stop the Host: the step's work is done when the first request needs it, as it would be without the warm-up. If the rule set step fails, check that the app can reach raw.githubusercontent.com.
To measure the effect of the warm-up, set the app setting IMM_DISABLE_WARMUP to true, which turns it off. In an environment that you deploy with deploy.ps1, set it in additionalAppSettings in config/<environment>.ps1, because a deployment removes app settings that are set by hand. tools/Measure-ColdStart.ps1 measures cold starts locally under the Core Tools, with and without ReadyToRun and the warm-up. Its results show the relative effect of each, but they are not the times you will see on Flex Consumption.
The warm-up is also traced, as a trace of its own: an imm.warmup span with a child span for each step, imm.warmup.badges, imm.warmup.yaml and imm.warmup.ruleset. The last one contains the spans of the rule set fetch. A step that fails, and the imm.warmup span, have the status Error, and imm.warmup has the tag imm.warmup.failed.
The Host can export traces and logs with OpenTelemetry, so that you can see where the time of any badge request went: waiting for the Functions host, fetching the rule set and the IMM from GitHub (or getting them from the cache), parsing the YAML, evaluating the IMM, and rendering the badge or page. Each log line carries the trace id and span id of the request that wrote it.
The Host exports only when one of these settings is set. Without either, nothing listens to the spans, so they are never created and cost nothing.
APPLICATIONINSIGHTS_CONNECTION_STRINGexports traces, logs and metrics to Application Insights.OTEL_EXPORTER_OTLP_ENDPOINTexports traces and logs over OTLP, for example to the Aspire dashboard. The other standardOTEL_EXPORTER_OTLP_*settings also apply.
You can set both. These are the spans of one badge request:
<Functions host request span> (host process)
└─ GitHubImmTotalScore Microsoft.Azure.Functions.Worker (the invocation)
└─ imm.badge.total Endjin.Ip.Maturity.Model.Host
├─ imm.content.get [rule set URL] Endjin.Imm (cache lookup)
│ └─ imm.content.fetch Endjin.Imm (only on a miss or revalidation)
│ ├─ GET System.Net.Http (raw.githubusercontent.com)
│ └─ imm.content.deserialize Endjin.Imm (only when a body was received)
├─ imm.content.get [IMM URL] Endjin.Imm (in parallel with the one above)
│ └─ ...
├─ imm.evaluate Endjin.Imm
└─ imm.render Endjin.Ip.Maturity.Model.Host
The rule endpoint's span is imm.badge.rule, and the showbadges endpoint's span is imm.badge.showbadges. The spans have these tags:
imm.badge.*:imm.github.owner,imm.github.repo,imm.github.ref(theprojectBranch) andimm.ruleset.ref(thedefinitionsBranch);imm.rule.idon the rule endpoint; andimm.error, theX-Imm-Errorcode, when an error badge or page is returned. The status is Error only when GitHub is unavailable, or when an exception propagates (thenerror.typeand anexceptionevent are also recorded). A request for an IMM that does not exist is answered correctly, so its span has animm.errortag but is not an error.imm.render:imm.render.kind, which istotal,rule,showbadges,error-badgeorerror-page.imm.content.get:url.full, andimm.cache.result, which ishit(the cached content was fresh),miss(nothing was cached, so it was fetched),revalidate(the cached content was stale, so it was fetched again with its ETag) orcoalesced(the request joined a fetch that another request had started; the span links to that fetch).imm.content.fetch:url.full,http.response.status_code,imm.cache.conditional(an ETag was sent),imm.cache.not_modified(GitHub returned 304) andimm.cache.stale_if_error(GitHub was unavailable, so the content cached before was used).imm.content.deserialize:imm.content.length, the length of the YAML.imm.evaluate:imm.rule_count,imm.scoreandimm.max_score.
host.json sets telemetryMode to OpenTelemetry, so that the Functions host's request span and the worker's spans are in one trace.
Set the app setting APPLICATIONINSIGHTS_CONNECTION_STRING to the connection string of an Application Insights resource. Nothing else is needed. To see the spans of one request as a tree, open a request in Application Insights and choose View all under the end-to-end transaction details. Span tags appear in customDimensions.
In this mode, log streaming in the Azure portal is not supported. Use Application Insights (Live Metrics, or the traces table) instead.
These queries are a place to start. The full tree for one request, given its operation id:
union requests, dependencies
| where operation_Id == "<id>"
| project timestamp, itemType, name, duration, customDimensions
| order by timestamp ascWhere the time goes, on average and at the 95th percentile, for each span:
dependencies
| where name startswith "imm."
| summarize avg(duration), percentile(duration, 95), count() by nameHow well the cache works:
dependencies
| where name == "imm.content.get"
| summarize count() by tostring(customDimensions["imm.cache.result"])The Aspire dashboard shows traces and logs from any OTLP exporter. Start it with Docker:
docker run --rm -it -p 18888:18888 -p 4317:18889 -e DOTNET_DASHBOARD_UNSECURED_ALLOW_ANONYMOUS=true mcr.microsoft.com/dotnet/aspire-dashboard:latestThen add the endpoint to the Values in local.settings.json, start the Host with func start, request a badge, and open http://localhost:18888:
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317"Set IMM_TRACE_CONNECTIONS to 1 or true to also trace DNS lookups, socket connections, TLS handshakes and waits for a connection from the pool. These spans are noisy, so leave the setting off unless you need it. They are useful for diagnosing cold starts, where the first fetch from GitHub pays for setting up a connection, and the Host's 5-minute connection recycling, which makes a fetch set up a new one.
If the worker process fails at startup with exit code 139 (a segmentation fault), you might have hit azure-functions-dotnet-worker#3335, which affects .NET 10 isolated apps on Flex Consumption. The workarounds are to set the app setting WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED to 0 (cold starts are then slower), or to use 4096 MB instances. In an environment that you deploy with deploy.ps1, make the change in config/<environment>.ps1 (additionalAppSettings or instanceMemoryMB), because the next deployment undoes a change made by hand.
Solutions/Endjin.Imm.Benchmarks is a BenchmarkDotNet project that measures execution time and memory allocations for the work the Host does on each request:
- loading rule sets and IMMs from YAML, including the cost of building the YAML deserializer
- evaluating an IMM, and each rule calculator on its own
- rendering SVG badges, and the text measurement and HTML decoding steps inside it
- the complete pipeline for the total badge, rule badge and
showbadgesendpoints, with and without a cache hit, using the Host's own code (the benchmarks reference the Host project, and theHostEndpoint_*benchmarks call its function methods) - a hit in the HTTP deserializing cache
The benchmarks make no network calls. They use a pinned snapshot of the canonical rule set (see Solutions/Endjin.Imm.Benchmarks/Data/README.md) and an in-process stub in place of GitHub.
Always run the benchmarks in Release. A Debug build fails validation.
# List the benchmarks
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --list flat
# Run all the benchmarks with the default job (took 43 minutes for the first baseline)
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*"
# Smoke test: run each benchmark once, to make sure that it executes
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*" --job dry
# Quick, less accurate results
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*" --job short
# Run some categories only (Yaml, Evaluate, Badge, Pipeline, Cache)
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --anyCategories Yaml Evaluate
# Run one class, or one method
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*BadgePainterBenchmarks*"
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*.Evaluate"
# On a hybrid CPU (performance and efficiency cores), keep the benchmark processes on the performance cores.
# The mask is specific to the machine: 4095 (0xFFF) selects logical processors 0-11, the performance cores of an i7-13800H.
dotnet run -c Release --project Solutions/Endjin.Imm.Benchmarks -- --filter "*" --affinity 4095The results go to Solutions/Endjin.Imm.Benchmarks/BenchmarkDotNet.Artifacts/results (GitHub Markdown, compressed JSON and CSV). This folder is in .gitignore. To keep a set of results for comparison, copy them into Solutions/Endjin.Imm.Benchmarks/Baselines/, one folder for each baseline, with a README that records the commit, command and environment. That folder is also in .gitignore: results depend on the machine they were measured on, so baselines are kept locally and not in source control.
dotnet test --solution does not run the benchmarks.
The IP Maturity Model is available under the Apache 2.0 open source license.
For any licensing questions, please email licensing@endjin.com
This project is sponsored by endjin, a UK based Technology Consultancy which specializes in Data & Analytics, AI & Cloud Native App Dev.
We help small teams achieve big things.
We produce three free weekly newsletters:
- Azure Weekly for all things about the Microsoft Azure Platform
- Power BI Weekly for all things Power BI
- Fabric Weekly for all things Microsoft Fabric
Keep up with everything that's going on at endjin via our blog, follow us on Twitter, YouTube or LinkedIn.
We have become the maintainers of a number of popular .NET Open Source Projects:
And we have over 50 Open Source projects of our own, spread across the following GitHub Orgs:
And the DevOps tooling we have created for managing all these projects is available on the PowerShell Gallery.
For more information about our products and services, or for commercial support of this project, please contact us.
This project has adopted a code of conduct adapted from the Contributor Covenant to clarify expected behavior in our community. This code of conduct has been adopted by many other projects. For more information see the Code of Conduct FAQ or contact hello@endjin.com with any additional questions or comments.