Skip to content

Commit

Permalink
Merge branch 'kkeirstead/SDM_CR_New' of https://github.com/kkeirstead…
Browse files Browse the repository at this point in the history
…/dotnet-monitor into kkeirstead/SDM_CR_New
  • Loading branch information
kkeirstead committed Mar 10, 2023
2 parents f47c33f + 23ff8f0 commit 8f016d2
Show file tree
Hide file tree
Showing 99 changed files with 2,681 additions and 616 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ jobs:
with:
persist-credentials: false

- uses: streetsidesoftware/cspell-action@faedcf94dee84afad3966c3ca108a0650b0e6c5e
- uses: streetsidesoftware/cspell-action@609ebcda6da2bfabadeb091ac90cdbfaf7feab93
name: Documentation spellcheck
if: ${{ !cancelled() }}
with:
files: '**/*.md'
inline: error
incremental_files_only: true

- uses: streetsidesoftware/cspell-action@faedcf94dee84afad3966c3ca108a0650b0e6c5e
- uses: streetsidesoftware/cspell-action@609ebcda6da2bfabadeb091ac90cdbfaf7feab93
name: Resx spellcheck
if: ${{ !cancelled() }}
with:
files: 'src/**/*.resx'
inline: error
incremental_files_only: true

- uses: streetsidesoftware/cspell-action@faedcf94dee84afad3966c3ca108a0650b0e6c5e
- uses: streetsidesoftware/cspell-action@609ebcda6da2bfabadeb091ac90cdbfaf7feab93
name: Source code spellcheck
if: ${{ !cancelled() }}
with:
Expand Down
80 changes: 59 additions & 21 deletions .github/workflows/track-shipping-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:

permissions: {}

env:
shipping_branch_prefix: 'shipped'

jobs:
update-shipping-branch:
if: github.repository == 'dotnet/dotnet-monitor'
Expand All @@ -17,22 +14,63 @@ jobs:
contents: write

steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Calculate branch name
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
id: calculate-branch-name
with:
result-encoding: string
script: |
const regex = /v(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/;
const releaseVersion = regex.exec(context.payload.release.tag_name);
if (releaseVersion == null) throw "Error: Unexpected tag format";
return `shipped/v${releaseVersion.groups.major}.${releaseVersion.groups.minor}`;
- name: Create or update shipped branch
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
with:
persist-credentials: true # We need to persist credentials to push the resulting changes upstream.

- name: Update shipping branch
run: |
release_version=${GITHUB_REF_NAME%-*}
if [[ ! "$release_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Unexpected release tag: $release_version."
exit 1
fi
major_minor_version=${release_version%.*}
shipping_branch_name="${shipping_branch_prefix}/${major_minor_version}"
# This is a shallow clone so we will always create a new local branch even if it already exists on the remote
git checkout -b "$shipping_branch_name"
git push --force --set-upstream origin "HEAD:$shipping_branch_name"
script: |
const branchName = `${{ steps.calculate-branch-name.outputs.result }}`;
const refName = `heads/${branchName}`;
// Check if the ref already exists, if so we will need to fast forward it.
let needToCreateRef = true;
try {
await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: refName
});
needToCreateRef = false;
} catch {
}
if (needToCreateRef) {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
ref: `refs/${refName}`
});
} else {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
ref: refName,
force: true
});
}
//
// Trigger branch mirror, empty commits and new refs will **not** trigger mirroring.
// The simplest way of doing this is to create an empty file on the desired branch.
//
await github.rest.repos.createOrUpdateFileContents({
owner: context.repo.owner,
repo: context.repo.repo,
branch: branchName,
message: 'Trigger branch mirroring',
path: '.mirror',
content: ''
});
10 changes: 9 additions & 1 deletion documentation/api/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ Describes custom metrics.
| Name | Type | Description |
|---|---|---|
| `includeDefaultProviders` | bool | Determines if the default counter providers should be used (such as System.Runtime). |
| `providers` | [EventMetricsProvider](#eventmetricsprovider)[] | Array of providers for metrics to collect. |
| `providers` | [EventMetricsProvider](#eventmetricsprovider)[] | Array of counter providers for metrics to collect. |
| `meters` | [EventMetricsMeter](#eventmetricsmeter)[] | Array of meters for metrics to collect. |

## EventMetricsMeter

| Name | Type | Description |
|---|---|---|
| `meterName` | string | The name of the meter. Note this is case-insensitive. |
| `instrumentNames` | string[] | Array of instruments for metrics to collect for the specified meter. These are case-sensitive. |

## EventMetricsProvider

Expand Down
12 changes: 6 additions & 6 deletions documentation/api/livemetrics-custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ Authorization: Bearer fffffffffffffffffffffffffffffffffffffffffff=
{
"includeDefaultProviders": false,
"providers": [
"meters": [
{
"providerName": "CustomProvider",
"counterNames": [
"meterName": "CustomMeter",
"instrumentNames": [
"myHistogram"
]
}
Expand All @@ -146,7 +146,7 @@ Location: localhost:52323/operations/67f07e40-5cca-4709-9062-26302c484f18
{
"timestamp": "2021-08-31T16:58:39.7514031+00:00",
"provider": "CustomProvider",
"provider": "CustomMeter",
"name": "myHistogram",
"displayName": "myHistogram",
"unit": null,
Expand All @@ -156,7 +156,7 @@ Location: localhost:52323/operations/67f07e40-5cca-4709-9062-26302c484f18
}
{
"timestamp": "2021-08-31T16:58:39.7514031+00:00",
"provider": "CustomProvider",
"provider": "CustomMeter",
"name": "myHistogram",
"displayName": "myHistogram",
"unit": null,
Expand All @@ -166,7 +166,7 @@ Location: localhost:52323/operations/67f07e40-5cca-4709-9062-26302c484f18
}
{
"timestamp": "2021-08-31T16:58:39.7514031+00:00",
"provider": "CustomProvider",
"provider": "CustomMeter",
"name": "myHistogram",
"displayName": "myHistogram",
"unit": null,
Expand Down
2 changes: 1 addition & 1 deletion documentation/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Authenticated requests to `dotnet monitor` help protect sensitive diagnostic artifacts from unauthorized users and lower privileged processes. `dotnet monitor` can be configured to use any one of the following authentication modes:
- [API Key](#api-key-authentication)
- [Azure Active Directory Authentication](#azure-active-directory-authentication) (8.0+)
- [Azure Active Directory Authentication](#azure-active-directory-authentication) (7.1+)
- [Windows Authentication](#windows-authentication)

It is also possible, although strongly not recommended, to [disable authentication](#disabling-authentication).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

### Was this documentation helpful? [Share feedback](https://www.research.net/r/DGDQWXH?src=documentation%2Fconfiguration%2Fazure-ad-authentication-configuration)

# Azure Active Directory Authentication Configuration (8.0+)
# Azure Active Directory Authentication Configuration (7.1+)

Azure Active Directory authentication must be configured before `dotnet monitor` starts, it does not support being configured or changed at runtime.

Expand Down
2 changes: 1 addition & 1 deletion documentation/configuration/egress-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ The Queue Message's payload will be the blob name (`<BlobPrefix>/<ArtifactName>`
| awsProfileName | string | false | The AWS profile name to be used for login. |
| awsProfilePath | string | false | The AWS profile path, if profile details not stored in default path. |
| generatePreSignedUrl | bool | false | A boolean flag to control if either a pre-signed url is returned after successful upload or only the name of bucket and the artifacts S3 object key. |
| regionName | string | false | A Region is a named set of AWS resources in the same geographical area. This option specifies the region to connect to. |
| regionName | string | false | A Region is a named set of AWS resources in the same geographical area. This option specifies the region to connect to. If the Endpoint is specified, this is the AuthenticationRegion; otherwise, it is the RegionEndpoint. |
| preSignedUrlExpiry | TimeStamp? | false | The amount of time the generated pre-signed url should be accessible. The value has to be between 1 minute and 1 day. |
| forcePathStyle | bool | false | The boolean flag set for AWS connection configuration ForcePathStyle option. |
| copyBufferSize | int | false | The buffer size to use when copying data from the original artifact to the blob stream. There is a minimum size of 5 MB which is set when the given value is lower.|
Expand Down
4 changes: 2 additions & 2 deletions documentation/configuration/metrics-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Due to limitations in event counters, `dotnet monitor` supports only **one** refresh interval when collecting metrics. This interval is used for
Prometheus metrics, livemetrics, triggers, traces, and trigger actions that collect traces. The default interval is 5 seconds, but can be changed in configuration.

[7.1+] For EventCounter providers, is possible to specify a different interval for each provider. See [Per provider intervals](#per-provider-intervals-71).
[8.0+] For EventCounter providers, is possible to specify a different interval for each provider. See [Per provider intervals](#per-provider-intervals-71).

<details>
<summary>JSON</summary>
Expand Down Expand Up @@ -39,7 +39,7 @@ Prometheus metrics, livemetrics, triggers, traces, and trigger actions that coll
```
</details>
## Per provider intervals (7.1+)
## Per provider intervals (8.0+)
It is possible to override the global interval on a per provider basis. Note this forces all scenarios (triggers, live metrics, prometheus metrics, traces) that use a particular provider to use that interval. Metrics that are `System.Diagnostics.Metrics` based always use global interval.

Expand Down
87 changes: 87 additions & 0 deletions documentation/learningPath/aks.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,90 @@
### Was this documentation helpful? [Share feedback](https://www.research.net/r/DGDQWXH?src=documentation%2FlearningPath%2Faks)

# AKS

In addition to its availability as a .NET CLI tool, the `dotnet monitor` tool is available as a prebuilt Docker image that can be run in container runtimes and orchestrators, such as Kubernetes. To learn more about using `dotnet monitor` with Kubernetes, you can check out our [example deployment](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/kubernetes.md) and our [video tutorial](https://github.com/dotnet/dotnet-monitor/tree/main/samples/AKS_Tutorial). This section covers how to test your development version of `dotnet monitor` in AKS; however, we recommend having some basic experience with AKS before following this workflow.

## What This Workflow Does

This workflow takes your local development copy of `dotnet-monitor`, patches it with a local development copy of the [.NET Core Diagnostics Repo](https://github.com/dotnet/diagnostics#net-core-diagnostics-repo), and makes it available as an image for you to consume in an ACR (Azure Container Registry). Note that there are many other ways to do this - this is meant to serve as a basic template that can be adapted to match your needs.

1. Open `pwsh` and run the [generate-dev-sln script](https://github.com/dotnet/dotnet-monitor/blob/main/generate-dev-sln.ps1), providing a path to your local copy of the diagnostics repo.

>**Note**: If your changes do not involve the [.NET Core Diagnostics Repo](https://github.com/dotnet/diagnostics#net-core-diagnostics-repo), you don't need to complete this step.
```ps1
cd C:\your-path\dotnet-monitor
.\generate-dev-sln.ps1 C:\your-path\diagnostics
```

2. Publish `dotnet monitor` to your desired (local) target location (TEMP is used throughout this example)

```ps1
dotnet publish .\src\Tools\dotnet-monitor -o $env:TEMP\dotnet-monitor -c Release -f net8.0
```

3. Pull the latest copy of the base image to avoid using a cached version (this should be the same as the REPO used in the next step)

```ps1
docker pull mcr.microsoft.com/dotnet/aspnet:8.0-alpine-amd64
```

4. Add a Dockerfile to the `dotnet monitor` directory created in the previous step. Below is an example of the contents of the Dockerfile:

```dockerfile
ARG REPO=mcr.microsoft.com/dotnet/aspnet
FROM $REPO:8.0-alpine-amd64

WORKDIR /app

ENV \
# Unset ASPNETCORE_URLS from aspnet base image
ASPNETCORE_URLS= \
# Unset ASPNETCORE_HTTP_PORTS from aspnet base image (.NET 8+)
ASPNETCORE_HTTP_PORTS= \
# Disable debugger and profiler diagnostics to avoid diagnosing self.
COMPlus_EnableDiagnostics=0 \
# Default Filter
DefaultProcess__Filters__0__Key=ProcessId \
DefaultProcess__Filters__0__Value=1 \
# Remove Unix Domain Socket before starting diagnostic port server
DiagnosticPort__DeleteEndpointOnStartup=true \
# Server GC mode
DOTNET_gcServer=1 \
# Logging: JSON format so that analytic platforms can get discrete entry information
Logging__Console__FormatterName=simple \
# Logging: Use round-trip date/time format without timezone information (always logged in UTC)
Logging__Console__FormatterOptions__TimestampFormat=yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffff'Z' \
# Logging: Write timestamps using UTC offset (+0:00)
Logging__Console__FormatterOptions__UseUtcTimestamp=true \
# Add dotnet-monitor path to front of PATH for easier, prioritized execution
PATH="/app:${PATH}"

COPY . .

ENTRYPOINT [ "dotnet-monitor" ]
CMD [ "collect", "--urls", "http://+:52323", "--metricUrls", "http://+:52325" ]

```

5. Log in to your ACR

```ps1
az account set -s <subscription_id>
az aks get-credentials --resource-group <name_of_resource_group> --name <name_of_aks>
az acr login --resource-group <name_of_resource_group> --name <name_of_acr>
```

6. Build the Docker image locally

```ps1
docker build $env:TEMP\dotnet-monitor -f $env:TEMP\dotnet-monitor\Dockerfile.localagent -t <name_of_acr>.azurecr.io/localagent
```

7. Push the Docker image to your ACR

```ps1
docker push <name_of_acr>.azurecr.io/localagent:latest
```

8. Update the aks deployment file to use your image instead of the published version of `dotnet monitor`
Loading

0 comments on commit 8f016d2

Please sign in to comment.