Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rephrasing documentation for clariry. #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 57 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,77 @@
# Dotnet Build Metrics

This is a custom MSBuild task that will measure the time to build each project and publishes the information to a datastore. The intent is to measure and improve developer experience on local workstations.
## Overview

**_Username and hostname are collected as a part of build information_**
Dotnet Build Metrics is a custom MSBuild task that measures the time to build each project and publishes the information to a datastore. The intent is to measure and improve developer experience on local workstations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's gone beyond this. We also have Web server startup time and the test data collection in the repo now.

I think the "build time" I would rephrase (for dotnet) to "the F5 experience". Because it's commonly known to dotnet developers that F5 is the should cut ket to debug your application.

The other part is test run data collection.

Overall the goal is around measuring and improving developer local experience

Copy link
Author

@letItCurl letItCurl Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, It feels like the base work needed more than just rephrasing.
Let me rework that.


```
{
"id": "026fe42b-7888-4a76-81ee-2ab431ae4987",
"userName": "aanand",
"cpuCount": 12,
"hostname": "25BVM13",
"platform": 2,
"os": "Microsoft Windows NT 10.0.19042.0",
"timeTaken": "453",
"branch": "master",
"type": ".Net",
"projectName": "Agoda.Cronos.Accommodation",
"repository": "[email protected]:front-end/dotnet-build-metrics.git",
"date": "2021-06-28T02:53:22.1420552Z"
}
```
**_The tool collects username and hostname as a part of build information. [See example payload](#data-sent-to-the-datastore)_**

## Installation

To use the task simply install the [`Agoda.Builds.Metrics` NuGet package](https://www.nuget.org/packages/Agoda.Builds.Metrics) to all of the projects in your solution, this will automatically enable metrics publication for that project.
To use the task, install the [Agoda.Builds.Metrics NuGet package](https://www.nuget.org/packages/Agoda.Builds.Metrics) to all projects in your solution. This will automatically enable metrics publication for that project.

Web API URL and the name of the endpoint are taken from environment variables if they are present as per the following table:
## Configuration

|Parameter |Environment Variable |Default Value |
|-----------------------|-------------------------|-------------------------------------|
|Elastic Search Endpoint|BUILD_METRICS_ES_ENDPOINT|http://compilation-metrics/dotnet |
Web API URL and the name of the endpoint are taken from environment variables. If they are present, they will override the defaults as per the following table:

We recommend create a CNAME on your internal DNS servers for compilation-metrics to point at an internal API that captures the data and stores it.
| Parameter | Environment Variable | Default Value |
| --- | --- | --- |
| Elastic Search Endpoint | BUILD_METRICS_ES_ENDPOINT | http://compilation-metrics/dotnet |

Example build log output in Visual Studio using MSBuild.
We recommend creating a CNAME on your internal DNS servers for `compilation-metrics` to point at an internal API that captures the data and stores it.

## Example Output

### Visual Studio

Example build log output in Visual Studio using MSBuild:

![](doc/img/VSBuildOutput.PNG)

Example build log output in Dotnet core CLI.
### .NET Core CLI

Example build log output in .NET Core CLI:

![](doc/img/DotnetCLIBuildTimeOutput.PNG)

## Agoda.DevFeedback.AspNetStartup NuGet Package

### Overview

### Agoda.DevFeedback.AspNetStartup NuGet package
The goal of the Agoda.DevFeedback.AspNetStartup NuGet package is to measure the application startup time as an additional metric that affects developer feedback besides build time. Monoliths are especially prone to slow startup times on developer laptops, and this provides visibility and tracking of improvements/regressions thereof.

The goal of this package is to measure the application startup time as an additional metrics that affects developer feedback besides build time.
Monoliths are especially prone to slow startup times on developer laptops and this provides visibility and tracking of improvements/regressions thereof.
### Measurement

This package measures the ASP.NET application's startup time in two ways.
1) The time from WebHostBuilder ConfigureServices until HostApplicationLifetime OnStarted sent with type '.AspNetStartup'.
2) The time from WebHostBuilder ConfigureServices until the first HTTP Reponse (measured from middleware) sent with type '.AspNetResponse'.
This package measures the [ASP.NET](http://asp.net/) application's startup time in two ways:

Two environment variables are required to be set to enable the measurements.
1) `ASPNETCORE_ENVIRONMENT` needs to be set as `Development` for the functionality to be added. This is so it's only enabled locally and not on production.
2) `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` needs to be/include `Agoda.DevFeedback.AspNetStartup`. This is for package activation due to the use of [HostingStartup](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.hostingstartupattribute?view=aspnetcore-6.0).
1. The time from WebHostBuilder ConfigureServices until HostApplicationLifetime OnStarted sent with type '.AspNetStartup'.
2. The time from WebHostBuilder ConfigureServices until the first HTTP Response (measured from middleware) sent with type '.AspNetResponse'.

For convenience these environment variables can be set under the lauch profile of the web application's `launchSettings.json` file and committed to the repository.
### Configuration

Two environment variables are required to be set to enable measurements:

1. `ASPNETCORE_ENVIRONMENT` needs to be set as `Development` for the functionality to be added. This is so it's only enabled locally and not on production.
2. `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` needs to include `Agoda.DevFeedback.AspNetStartup`. This is for package activation due to the use of [HostingStartup](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.hosting.hostingstartupattribute?view=aspnetcore-6.0).

For convenience, these environment variables can be set under the launch profile of the web application's `launchSettings.json` file and committed to the repository.

### Data sent to the datastore
> This is an example payload sent to the datastore.

```
{
"id": "026fe42b-7888-4a76-81ee-2ab431ae4987",
"userName": "aanand",
"cpuCount": 12,
"hostname": "25BVM13",
"platform": 2,
"os": "Microsoft Windows NT 10.0.19042.0",
"timeTaken": "453",
"branch": "master",
"type": ".Net",
"projectName": "Agoda.Cronos.Accommodation",
"repository": "[email protected]:front-end/dotnet-build-metrics.git",
"date": "2021-06-28T02:53:22.1420552Z"
}
```