From 7dbd0fbc17af58729c2431ea479dbc5a7d6daf8d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 2 Oct 2023 10:29:25 -0700 Subject: [PATCH 001/352] Put Learning Path In-Progress Staleness Checker Back In Main * Create check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update ActivityExtensions.cs * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update submit-linter-suggestions.yml * Update submit-linter-suggestions.yml * Create submit-learning-paths-staleness-check.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update check-learning-path-links.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update check-learning-path-links.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update check-learning-path-links.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update submit-learning-paths-staleness-check.yml * Update TestAssemblies.cs * Update CollectionRulePipeline.cs * Update submit-learning-paths-staleness-check.yml * Update CollectionRulePipeline.cs * Update CollectionRulePipeline.cs * Update submit-learning-paths-staleness-check.yml * Update ActivityExtensions.cs * Update CollectionRulePipeline.cs * Update TestAssemblies.cs --- .../workflows/check-learning-path-links.yml | 75 ++++++++++++++++++ .../submit-learning-paths-staleness-check.yml | 76 +++++++++++++++++++ .../workflows/submit-linter-suggestions.yml | 9 ++- 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/check-learning-path-links.yml create mode 100644 .github/workflows/submit-learning-paths-staleness-check.yml diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml new file mode 100644 index 00000000000..e2b3154574e --- /dev/null +++ b/.github/workflows/check-learning-path-links.yml @@ -0,0 +1,75 @@ +name: 'Check Learning Path Links' +on: + pull_request: + branches: ['main'] + +permissions: + pull-requests: read + +jobs: + check-learning-path-links: + name: 'Check Learning Path Links' + runs-on: ubuntu-latest + + steps: + - name: Checkout merge + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + with: + persist-credentials: false + path: merge + + - name: Checkout head + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + with: + persist-credentials: false + ref: main + path: head + + - name: Get base commit for the PR + working-directory: ./merge + run: | + git fetch origin "$GITHUB_BASE_REF" + base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF") + echo "base_sha=$base_sha" >> $GITHUB_ENV + echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" + + - name: Get changed files + working-directory: ./merge + run: | + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + echo "Files to validate: '${changed_source_files}'" + echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV + + - name: Check Learning Path Links + id: check-links + uses: kkeirstead/LearningPathFileChecks@main + with: + repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' + learningPathsDirectory: 'documentation/learningPath' + paths: ${{ env.updated_files }} + + - name: Generate artifacts (Suggestion) + working-directory: ./merge + run: | + mkdir -p ./pr + cp "$GITHUB_EVENT_PATH" ./pr/pr-event.json + git diff > ./pr/linter.diff + + - name: Generate artifacts (Comment) + working-directory: ./merge + run: | + mkdir -p ./learning-path-review + echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles + echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview + + - name: Upload artifacts (Suggestion) + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce + with: + name: pr-linter + path: merge/pr/ + + - name: Upload artifacts (Comment) + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce + with: + name: learning-path-review + path: merge/learning-path-review/ diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml new file mode 100644 index 00000000000..da3e649acd2 --- /dev/null +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -0,0 +1,76 @@ +name: 'Submit Learning Paths Staleness Check' + +on: + workflow_run: + workflows: ["Check Learning Path Links"] + types: + - completed + +permissions: + contents: write + issues: write + pull-requests: write + + +jobs: + submit-learning-paths-staleness-check: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + + steps: + - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 + id: check-user + with: + script: | + await github.rest.repos.checkCollaborator({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.workflow_run.triggering_actor.login + }); + + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + with: + persist-credentials: true + + # Download the artifact from the workflow that kicked off this one. + # The default artifact download action doesn't support cross-workflow + # artifacts, so use a 3rd party one. + - name: 'Download linting results' + uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 + with: + workflow: ${{env.workflow_name}} + run_id: ${{github.event.workflow_run.id }} + name: learning-path-review + path: ./learning-path-review + + - name: Set Env Vars + run: | + modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + manuallyReview=$(cat ./learning-path-review/manuallyReview) + echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV + echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV + + - uses: actions/github-script@v6 + name: Submit Comment + if: ${{ env.modifiedFiles != '' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MODIFIED_FILES: ${{ env.modifiedFiles }} + MANUALLY_REVIEW: ${{ env.manuallyReview }} + with: + script: | + modifiedFiles = process.env.MODIFIED_FILES; + manuallyReview = process.env.MANUALLY_REVIEW; + comment_body = "### Learning Paths Links Check \n\nChanged files in the Learning Path:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n Files that should be manually reviewed:\n\n" + manuallyReview.replaceAll(",", "\n"); + github.rest.issues.createComment({ + issue_number: context.payload.workflow_run.pull_requests[0].number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment_body + }) + diff --git a/.github/workflows/submit-linter-suggestions.yml b/.github/workflows/submit-linter-suggestions.yml index 54f080d0938..b68a99aec33 100644 --- a/.github/workflows/submit-linter-suggestions.yml +++ b/.github/workflows/submit-linter-suggestions.yml @@ -2,7 +2,7 @@ name: 'Submit linter suggestions' on: workflow_run: - workflows: ["C# linting", "Add Markdown Feedback"] + workflows: ["C# linting", "Add Markdown Feedback", "Check Learning Path Links"] types: - completed @@ -45,6 +45,13 @@ jobs: run: | echo 'reporter_name=Add Markdown Feedback' >> $GITHUB_ENV echo 'workflow_name=add-markdown-feedback.yml' >> $GITHUB_ENV + + - name: Set Learning Path File Checks Env Vars + if: ${{ github.event.workflow_run.name == 'Check Learning Path Links' }} + run: | + echo 'reporter_name=Learning Path File Checks' >> $GITHUB_ENV + echo 'workflow_name=check-learning-path-links.yml' >> $GITHUB_ENV + # Download the artifact from the workflow that kicked off this one. # The default artifact download action doesn't support cross-workflow # artifacts, so use a 3rd party one. From 0d45cbdb446d0544fa7de2818240e1e5fe33f5a9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 2 Oct 2023 11:05:48 -0700 Subject: [PATCH 002/352] Update architecture.md --- documentation/learningPath/architecture.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/documentation/learningPath/architecture.md b/documentation/learningPath/architecture.md index 38476ca861c..cdaa40cb3d4 100644 --- a/documentation/learningPath/architecture.md +++ b/documentation/learningPath/architecture.md @@ -2,3 +2,10 @@ ### Was this documentation helpful? [Share feedback](https://www.research.net/r/DGDQWXH?src=documentation%2FlearningPath%2Farchitecture) # Architecture +This is a test of a deleted [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/OutputFormat.cs). + +This is a test of a shifted line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L20). + +This is a test of a removed line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L1). + +This is a test of an ambiguous line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L16). From 67cf5095fd1f78e25156d43e7e08fba9e5605713 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:05:00 -0700 Subject: [PATCH 003/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 6ea6c9ce47e..f361f22053b 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,49 +32,49 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L100). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. -* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). -* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L55). -* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L100). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). +* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L55). +* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L100) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L100) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L150) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L150) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters -Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L189); if so, the collection rule starts. +Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L189); if so, the collection rule starts. ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L80) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L235). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L80) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L235). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L117). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L117). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates -Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). +Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). ### Collection Rule Defaults -Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. +Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. ### Collection Rule API Endpoint -The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L532) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L557). **This API is solely for viewing the current state of rules, not altering state**. +The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L532) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L557). **This API is solely for viewing the current state of rules, not altering state**. -Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). +Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/v7.0.1/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/main/documentation/collectionrules). From 167398964a1a90b8577d3ed8328459e4594a3d0a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 2 Oct 2023 13:08:41 -0700 Subject: [PATCH 004/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index f361f22053b..dc7c0f8becb 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -35,17 +35,17 @@ graph LR * Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L100). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. * Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). * Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L55). +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). * To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L100) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L150) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters @@ -53,7 +53,7 @@ Filters can optionally be applied to a collection rule to choose which processes ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L80) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L235). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L235). ## Miscellaneous From 5b5de00aba4736711df92a189f0fb5ce8a290965 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:10:55 -0700 Subject: [PATCH 005/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index e2b3154574e..fd4ce368a75 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -63,13 +63,13 @@ jobs: echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview - name: Upload artifacts (Suggestion) - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: name: pr-linter path: merge/pr/ - name: Upload artifacts (Comment) - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: name: learning-path-review path: merge/learning-path-review/ From 9ce6f72379bd86512ca68d02d04fbc3116fc6b99 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:27:44 -0700 Subject: [PATCH 006/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index fd4ce368a75..d8219bc73ea 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -8,6 +8,7 @@ permissions: jobs: check-learning-path-links: + if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) name: 'Check Learning Path Links' runs-on: ubuntu-latest From 0598e8ac1eac589b47c946f6b2b4d1c585c50e27 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:28:25 -0700 Subject: [PATCH 007/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index d8219bc73ea..26cb1b62042 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -14,13 +14,13 @@ jobs: steps: - name: Checkout merge - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac with: persist-credentials: false path: merge - name: Checkout head - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac with: persist-credentials: false ref: main From 88ac5749c9c273535eb5c007cf8555de9fea75e2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:36:48 -0700 Subject: [PATCH 008/352] Update submit-linter-suggestions.yml --- .github/workflows/submit-linter-suggestions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-linter-suggestions.yml b/.github/workflows/submit-linter-suggestions.yml index b68a99aec33..4b52001ac1f 100644 --- a/.github/workflows/submit-linter-suggestions.yml +++ b/.github/workflows/submit-linter-suggestions.yml @@ -85,7 +85,7 @@ jobs: -f.diff.strip=1 \ -reporter="github-pr-review" \ -filter-mode="diff_context" \ - -fail-on-error="false" \ + -fail-on-error="true" \ -level="warning" \ < "./pr-linter/linter.diff" env: From e7d6ae7fa04873bcb82c484ce1e1360a1a322c90 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 07:58:30 -0700 Subject: [PATCH 009/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 26cb1b62042..62f02434605 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -62,6 +62,7 @@ jobs: mkdir -p ./learning-path-review echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview + echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions - name: Upload artifacts (Suggestion) uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 From 8fba8a1a9f44d2e5fec208f5a72066fc96b2a9b6 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 08:01:04 -0700 Subject: [PATCH 010/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index da3e649acd2..4a74cac4e06 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -52,8 +52,10 @@ jobs: run: | modifiedFiles=$(cat ./learning-path-review/modifiedFiles) manuallyReview=$(cat ./learning-path-review/manuallyReview) + suggestions=$(cat ./learning-path-review/suggestions) echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV + echo "suggestions=$suggestions" >> $GITHUB_ENV - uses: actions/github-script@v6 name: Submit Comment @@ -62,11 +64,13 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} MANUALLY_REVIEW: ${{ env.manuallyReview }} + SUGGESTIONS: ${{ env.suggestions }} with: script: | modifiedFiles = process.env.MODIFIED_FILES; manuallyReview = process.env.MANUALLY_REVIEW; - comment_body = "### Learning Paths Links Check \n\nChanged files in the Learning Path:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n Files that should be manually reviewed:\n\n" + manuallyReview.replaceAll(",", "\n"); + suggestions = process.env.SUGGESTIONS; + comment_body = "### Learning Paths Links Check \n\nChanged files in the Learning Path:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n Files that should be manually reviewed:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n Suggested changes (note: always verify for correctness):\n\n" + suggestions.replaceAll(",", "\n"); github.rest.issues.createComment({ issue_number: context.payload.workflow_run.pull_requests[0].number, owner: context.repo.owner, From c5895d0f6cfb78e738e4976f96b47a794fd90fc7 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 08:11:13 -0700 Subject: [PATCH 011/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 4a74cac4e06..a3b9ab5809e 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -70,7 +70,7 @@ jobs: modifiedFiles = process.env.MODIFIED_FILES; manuallyReview = process.env.MANUALLY_REVIEW; suggestions = process.env.SUGGESTIONS; - comment_body = "### Learning Paths Links Check \n\nChanged files in the Learning Path:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n Files that should be manually reviewed:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n Suggested changes (note: always verify for correctness):\n\n" + suggestions.replaceAll(",", "\n"); + comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); github.rest.issues.createComment({ issue_number: context.payload.workflow_run.pull_requests[0].number, owner: context.repo.owner, From 7c7530d2163f0f379ea8b8bcd72e378fe68a465a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:49:16 -0700 Subject: [PATCH 012/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index a3b9ab5809e..c68b42a56e5 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -11,7 +11,6 @@ permissions: issues: write pull-requests: write - jobs: submit-learning-paths-staleness-check: if: github.event.workflow_run.conclusion == 'success' From 7c8f459ac91877755a76b8e3897bcda88d2e63c1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:39:44 -0700 Subject: [PATCH 013/352] Update submit-learning-paths-staleness-check.yml --- .../submit-learning-paths-staleness-check.yml | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index c68b42a56e5..1be083f42ed 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -55,9 +55,9 @@ jobs: echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV echo "suggestions=$suggestions" >> $GITHUB_ENV - + - uses: actions/github-script@v6 - name: Submit Comment + name: Check For Duplicate Comment if: ${{ env.modifiedFiles != '' }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -70,10 +70,26 @@ jobs: manuallyReview = process.env.MANUALLY_REVIEW; suggestions = process.env.SUGGESTIONS; comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); - github.rest.issues.createComment({ + + const comments = github.rest.issues.listComments({ issue_number: context.payload.workflow_run.pull_requests[0].number, owner: context.repo.owner, - repo: context.repo.repo, - body: comment_body + repo: context.repo.repo }) + var commentExists = false; + for (const comment of comments) { + if (comment.body == comment_body) { + commentExists = true; + } + } + + if (!commentExists) + { + github.rest.issues.createComment({ + issue_number: context.payload.workflow_run.pull_requests[0].number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment_body + }) + } From bf6c3538a126d56270606a15b2b512034923c75f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:44:35 -0700 Subject: [PATCH 014/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 1be083f42ed..44d554788ff 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -71,12 +71,15 @@ jobs: suggestions = process.env.SUGGESTIONS; comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); - const comments = github.rest.issues.listComments({ + const comments = await github.rest.issues.listComments({ issue_number: context.payload.workflow_run.pull_requests[0].number, owner: context.repo.owner, repo: context.repo.repo }) + console.log(comments); + console.log(typeof comments); + var commentExists = false; for (const comment of comments) { if (comment.body == comment_body) { From 7d7aa674a852645d9480443812677ed290eccbe0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:48:40 -0700 Subject: [PATCH 015/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 44d554788ff..4c5bff6c110 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -81,7 +81,7 @@ jobs: console.log(typeof comments); var commentExists = false; - for (const comment of comments) { + for (const comment of comments[data]) { if (comment.body == comment_body) { commentExists = true; } From 8bb85e22b720c3a7a579b5ea0c2deb4ada4beab3 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:50:43 -0700 Subject: [PATCH 016/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 4c5bff6c110..cf6c37689d7 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -81,7 +81,7 @@ jobs: console.log(typeof comments); var commentExists = false; - for (const comment of comments[data]) { + for (const comment of comments.data) { if (comment.body == comment_body) { commentExists = true; } From 944ea6d0f79020cff0f859fbed01d52fa4cae39c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:54:57 -0700 Subject: [PATCH 017/352] Update submit-learning-paths-staleness-check.yml --- .../workflows/submit-learning-paths-staleness-check.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index cf6c37689d7..53a16b9deed 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -77,11 +77,14 @@ jobs: repo: context.repo.repo }) - console.log(comments); - console.log(typeof comments); - var commentExists = false; + + console.log("Actual comment body:"); + console.log(comment_body); + console.log(""); + for (const comment of comments.data) { + console.log(comment.body); if (comment.body == comment_body) { commentExists = true; } From a960d516ac2a538f3e54df0f38a8a4ca34e07c17 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:02:19 -0700 Subject: [PATCH 018/352] Update submit-learning-paths-staleness-check.yml --- .../workflows/submit-learning-paths-staleness-check.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 53a16b9deed..832e51bb096 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -82,11 +82,16 @@ jobs: console.log("Actual comment body:"); console.log(comment_body); console.log(""); + + const new_comment_stripped = comment_body.replaceAll(/\s/g,'') for (const comment of comments.data) { console.log(comment.body); - if (comment.body == comment_body) { + const old_comment_stripped = comment.body.replaceAll(/\s/g,'') + + if (old_comment_stripped.equals(new_comment_stripped)) { commentExists = true; + console.log("Match!"); } } From 506152d5a673ad9a70d4a36b41621a8160ae0351 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:04:27 -0700 Subject: [PATCH 019/352] Update submit-learning-paths-staleness-check.yml --- .github/workflows/submit-learning-paths-staleness-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml index 832e51bb096..fcf0bf10a42 100644 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -89,7 +89,7 @@ jobs: console.log(comment.body); const old_comment_stripped = comment.body.replaceAll(/\s/g,'') - if (old_comment_stripped.equals(new_comment_stripped)) { + if (old_comment_stripped === new_comment_stripped) { commentExists = true; console.log("Match!"); } From 84604addca2989056d86912a5d66cacf0f8f4e6b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:49:25 -0700 Subject: [PATCH 020/352] Update submit-linter-suggestions.yml --- .github/workflows/submit-linter-suggestions.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/submit-linter-suggestions.yml b/.github/workflows/submit-linter-suggestions.yml index 4b52001ac1f..bd2affb28af 100644 --- a/.github/workflows/submit-linter-suggestions.yml +++ b/.github/workflows/submit-linter-suggestions.yml @@ -2,7 +2,7 @@ name: 'Submit linter suggestions' on: workflow_run: - workflows: ["C# linting", "Add Markdown Feedback", "Check Learning Path Links"] + workflows: ["C# linting", "Add Markdown Feedback"] types: - completed @@ -46,12 +46,6 @@ jobs: echo 'reporter_name=Add Markdown Feedback' >> $GITHUB_ENV echo 'workflow_name=add-markdown-feedback.yml' >> $GITHUB_ENV - - name: Set Learning Path File Checks Env Vars - if: ${{ github.event.workflow_run.name == 'Check Learning Path Links' }} - run: | - echo 'reporter_name=Learning Path File Checks' >> $GITHUB_ENV - echo 'workflow_name=check-learning-path-links.yml' >> $GITHUB_ENV - # Download the artifact from the workflow that kicked off this one. # The default artifact download action doesn't support cross-workflow # artifacts, so use a 3rd party one. From c360b099022a49552d84d2b69fdafa7ffeac0634 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:50:13 -0700 Subject: [PATCH 021/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 62f02434605..6768742549a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -48,13 +48,6 @@ jobs: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' paths: ${{ env.updated_files }} - - - name: Generate artifacts (Suggestion) - working-directory: ./merge - run: | - mkdir -p ./pr - cp "$GITHUB_EVENT_PATH" ./pr/pr-event.json - git diff > ./pr/linter.diff - name: Generate artifacts (Comment) working-directory: ./merge @@ -64,12 +57,6 @@ jobs: echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions - - name: Upload artifacts (Suggestion) - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 - with: - name: pr-linter - path: merge/pr/ - - name: Upload artifacts (Comment) uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: From 62d84cbad46873db2a759ccc33df8312fa115714 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:52:38 -0700 Subject: [PATCH 022/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 6768742549a..611aa1be60e 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -48,6 +48,7 @@ jobs: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' paths: ${{ env.updated_files }} + sourceDirectoryName: 'src' - name: Generate artifacts (Comment) working-directory: ./merge From 82c54b407972511aadec6431d7a1dd5615fe0792 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:35:33 -0700 Subject: [PATCH 023/352] Update configuration.md --- documentation/learningPath/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 53242df9928..4b96afd97f8 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -8,7 +8,7 @@ `dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. -To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/Program.cs#L69) and [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). +To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L80)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. From 0a1a0f7b826b37a6ff52b6a6770c67e9d7d1c49b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 12:43:55 -0700 Subject: [PATCH 024/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index dc7c0f8becb..b6dd24da27c 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -53,7 +53,7 @@ Filters can optionally be applied to a collection rule to choose which processes ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L235). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous From b287d1bdba4b2fbf1dd2ac17e3fbd0881629c24d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:48:35 -0700 Subject: [PATCH 025/352] Update testing.md --- documentation/learningPath/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index 38a36633348..24153c55a7d 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -31,9 +31,9 @@ Functional tests are composed of 3 main parts: 1. An instance of an application that is being monitored (from the UnitTestApp assembly) * [ScenarioRunner](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. -* The dotnet-monitor Api surface can be accessed through the [ApiClient](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). +* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). * New scenarios can be added [here](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). -* The [AsyncWaitScenario](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. +* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. * Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](../../src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. ## Native/Profiler Tests From 0d1afa3e9902f4aaeb5ab81d1e5376355f48cd1f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 08:22:14 -0700 Subject: [PATCH 026/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 611aa1be60e..6a8f8a7dc72 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -47,7 +47,7 @@ jobs: with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' - paths: ${{ env.updated_files }} + changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' - name: Generate artifacts (Comment) From cee5e3e58abcc1d8a35a74f0280f2480b05e542e Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:23:37 -0700 Subject: [PATCH 027/352] Create check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/check-learning-path-links.yml diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml new file mode 100644 index 00000000000..611aa1be60e --- /dev/null +++ b/.github/workflows/check-learning-path-links.yml @@ -0,0 +1,65 @@ +name: 'Check Learning Path Links' +on: + pull_request: + branches: ['main'] + +permissions: + pull-requests: read + +jobs: + check-learning-path-links: + if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) + name: 'Check Learning Path Links' + runs-on: ubuntu-latest + + steps: + - name: Checkout merge + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false + path: merge + + - name: Checkout head + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false + ref: main + path: head + + - name: Get base commit for the PR + working-directory: ./merge + run: | + git fetch origin "$GITHUB_BASE_REF" + base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF") + echo "base_sha=$base_sha" >> $GITHUB_ENV + echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" + + - name: Get changed files + working-directory: ./merge + run: | + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + echo "Files to validate: '${changed_source_files}'" + echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV + + - name: Check Learning Path Links + id: check-links + uses: kkeirstead/LearningPathFileChecks@main + with: + repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' + learningPathsDirectory: 'documentation/learningPath' + paths: ${{ env.updated_files }} + sourceDirectoryName: 'src' + + - name: Generate artifacts (Comment) + working-directory: ./merge + run: | + mkdir -p ./learning-path-review + echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles + echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview + echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions + + - name: Upload artifacts (Comment) + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + with: + name: learning-path-review + path: merge/learning-path-review/ From 16b85ebd719b31096a6251de3626f4b57cc856f0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:25:33 -0700 Subject: [PATCH 028/352] Create submit-learning-paths-staleness-check.yml --- .../submit-learning-paths-staleness-check.yml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/submit-learning-paths-staleness-check.yml diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml new file mode 100644 index 00000000000..62dfe6b2b3e --- /dev/null +++ b/.github/workflows/submit-learning-paths-staleness-check.yml @@ -0,0 +1,100 @@ +name: 'Submit Learning Paths Staleness Check' + +on: + workflow_run: + workflows: ["Check Learning Path Links"] + types: + - completed + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + submit-learning-paths-staleness-check: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + + steps: + - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 + id: check-user + with: + script: | + await github.rest.repos.checkCollaborator({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.workflow_run.triggering_actor.login + }); + + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + with: + persist-credentials: true + + # Download the artifact from the workflow that kicked off this one. + # The default artifact download action doesn't support cross-workflow + # artifacts, so use a 3rd party one. + - name: 'Download linting results' + uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 + with: + workflow: ${{env.workflow_name}} + run_id: ${{github.event.workflow_run.id }} + name: learning-path-review + path: ./learning-path-review + + - name: Set Env Vars + run: | + modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + manuallyReview=$(cat ./learning-path-review/manuallyReview) + suggestions=$(cat ./learning-path-review/suggestions) + echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV + echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV + echo "suggestions=$suggestions" >> $GITHUB_ENV + + - uses: actions/github-script@v6 + name: Check For Duplicate Before Creating Comment + if: ${{ env.modifiedFiles != '' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MODIFIED_FILES: ${{ env.modifiedFiles }} + MANUALLY_REVIEW: ${{ env.manuallyReview }} + SUGGESTIONS: ${{ env.suggestions }} + with: + script: | + modifiedFiles = process.env.MODIFIED_FILES; + manuallyReview = process.env.MANUALLY_REVIEW; + suggestions = process.env.SUGGESTIONS; + comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); + + const comments = await github.rest.issues.listComments({ + issue_number: context.payload.workflow_run.pull_requests[0].number, + owner: context.repo.owner, + repo: context.repo.repo + }) + + var commentExists = false; + + const new_comment_stripped = comment_body.replaceAll(/\s/g,'') + + for (const comment of comments.data) { + const old_comment_stripped = comment.body.replaceAll(/\s/g,'') + + if (old_comment_stripped === new_comment_stripped) { + commentExists = true; + } + } + + if (!commentExists) + { + github.rest.issues.createComment({ + issue_number: context.payload.workflow_run.pull_requests[0].number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment_body + }) + } From 9394604c5bc40fbfc67705705fad46f60b9a9a5e Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 11:58:29 -0700 Subject: [PATCH 029/352] Update CollectionRulePipelineState.cs --- .../CollectionRulePipelineState.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs index 6eea50bc2b0..ead12b79546 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs @@ -231,6 +231,7 @@ private static void DequeueOldTimestamps(Queue executionTimestamps, Ti } } + # LP 5d8697c3-3ded-43df-a349-4b21207010a6 private static bool CheckForThrottling(int actionCountLimit, TimeSpan? actionCountSWD, int executionTimestampsCount) { return actionCountSWD.HasValue && actionCountLimit <= executionTimestampsCount; From 68ba9e946b0d0d572169ca52678812a3895d2e90 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:10:16 -0700 Subject: [PATCH 030/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index b6dd24da27c..414eff16a1b 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -53,7 +53,7 @@ Filters can optionally be applied to a collection rule to choose which processes ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous From 022fe98f84ef8192099ddb0bcf81128991bf072f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:11:04 -0700 Subject: [PATCH 031/352] Create check-learning-path-links-anchor.yml --- .github/workflows/check-learning-path-links-anchor.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/check-learning-path-links-anchor.yml diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -0,0 +1 @@ + From bc9c983d0ef11e914ea57f74499ade3a76d83561 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:27:26 -0700 Subject: [PATCH 032/352] Update check-learning-path-links-anchor.yml --- .../check-learning-path-links-anchor.yml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml index 8b137891791..2120c4558b9 100644 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -1 +1,49 @@ +name: 'Check Learning Path Links' +on: + pull_request: + branches: ['main'] +permissions: + pull-requests: read + +jobs: + check-learning-path-links-anchor: + if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) + name: 'Check Learning Path Links Anchor' + runs-on: ubuntu-latest + + steps: + - name: Checkout merge + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false + path: merge + + - name: Checkout head + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false + ref: main + path: head + + - name: Get base commit for the PR + working-directory: ./merge + run: | + git fetch origin "$GITHUB_BASE_REF" + base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF") + echo "base_sha=$base_sha" >> $GITHUB_ENV + echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" + + - name: Get learning path files from head + working-directory: ./head/documentation/learningPath + run: | + learning_path_files=$({ grep "**.md$" }) + echo "Files to validate: '${learning_path_files}'" + echo "learning_path_files=$(echo ${learning_path_files})" >> $GITHUB_ENV + + for file in learning_path_files; do + if grep -qE '^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$' "$file"; then + echo "Found unique identifier in $file" + else + echo "No unique identifier found in $file" + fi From eae3a2547160f114444fdb7cc08150d77b477eea Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 12:35:24 -0700 Subject: [PATCH 033/352] Update check-learning-path-links-anchor.yml --- .github/workflows/check-learning-path-links-anchor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml index 2120c4558b9..729dfeb8a94 100644 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -37,7 +37,7 @@ jobs: - name: Get learning path files from head working-directory: ./head/documentation/learningPath run: | - learning_path_files=$({ grep "**.md$" }) + learning_path_files=$(ls | grep "**/*.md$") echo "Files to validate: '${learning_path_files}'" echo "learning_path_files=$(echo ${learning_path_files})" >> $GITHUB_ENV From 83743036a48e7f04a14d75c79d9c3a13b871a84c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 13:29:47 -0700 Subject: [PATCH 034/352] Update check-learning-path-links-anchor.yml --- .../check-learning-path-links-anchor.yml | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml index 729dfeb8a94..9c30d76776f 100644 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -7,9 +7,9 @@ permissions: pull-requests: read jobs: - check-learning-path-links-anchor: + check-learning-path-links: if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) - name: 'Check Learning Path Links Anchor' + name: 'Check Learning Path Links' runs-on: ubuntu-latest steps: @@ -34,16 +34,15 @@ jobs: echo "base_sha=$base_sha" >> $GITHUB_ENV echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" - - name: Get learning path files from head - working-directory: ./head/documentation/learningPath + - name: Get changed files + working-directory: ./merge run: | - learning_path_files=$(ls | grep "**/*.md$") - echo "Files to validate: '${learning_path_files}'" - echo "learning_path_files=$(echo ${learning_path_files})" >> $GITHUB_ENV + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + echo "Files to validate: '${changed_source_files}'" - for file in learning_path_files; do - if grep -qE '^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$' "$file"; then - echo "Found unique identifier in $file" - else - echo "No unique identifier found in $file" - fi + - name: Check Learning Path Links + id: check-links + uses: kkeirstead/LearningPathFileChecks-Anchor@main + with: + learningPathsDirectory: 'documentation/learningPath' + changedFilePaths: ${{ env.updated_files }} From 0db0016a74acd5c53631138574fe160232cbc2e8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 13:32:10 -0700 Subject: [PATCH 035/352] Update check-learning-path-links-anchor.yml --- .github/workflows/check-learning-path-links-anchor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml index 9c30d76776f..285c9dc8632 100644 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -40,9 +40,9 @@ jobs: changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" - - name: Check Learning Path Links + - name: Check Learning Path Links Anchor id: check-links - uses: kkeirstead/LearningPathFileChecks-Anchor@main + uses: kkeirstead/LearningPathFileChecks-Anchor@master with: learningPathsDirectory: 'documentation/learningPath' changedFilePaths: ${{ env.updated_files }} From f9f38764bb04caa61e4bc75a2443f458fe240e97 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 6 Oct 2023 13:34:41 -0700 Subject: [PATCH 036/352] Update check-learning-path-links-anchor.yml --- .github/workflows/check-learning-path-links-anchor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml index 285c9dc8632..c40626e101a 100644 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ b/.github/workflows/check-learning-path-links-anchor.yml @@ -45,4 +45,3 @@ jobs: uses: kkeirstead/LearningPathFileChecks-Anchor@master with: learningPathsDirectory: 'documentation/learningPath' - changedFilePaths: ${{ env.updated_files }} From 701008b3ef073de94e05773a4a41a9006985d455 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:18:50 -0800 Subject: [PATCH 037/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 611aa1be60e..39cef82a3b0 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,7 +1,8 @@ name: 'Check Learning Path Links' on: - pull_request: - branches: ['main'] + schedule: # Run once a week. + - cron: '0 0 * * 1' + workflow_dispatch: permissions: pull-requests: read @@ -13,11 +14,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout merge + - name: Checkout previous update uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac with: persist-credentials: false - path: merge + ref: abc - name: Checkout head uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac From 843999f53f8791c2ca6d0d8f104a47e7e2074f84 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:27:05 -0800 Subject: [PATCH 038/352] Create learning-path-sha --- .github/learning-path-sha | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/learning-path-sha diff --git a/.github/learning-path-sha b/.github/learning-path-sha new file mode 100644 index 00000000000..687bf7d4c0d --- /dev/null +++ b/.github/learning-path-sha @@ -0,0 +1 @@ +9bf6287 From e4b4780619fdca4258447b67101fc4de716ef321 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:27:22 -0800 Subject: [PATCH 039/352] Rename learning-path-sha to learning-path-sha.txt --- .github/{learning-path-sha => learning-path-sha.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{learning-path-sha => learning-path-sha.txt} (100%) diff --git a/.github/learning-path-sha b/.github/learning-path-sha.txt similarity index 100% rename from .github/learning-path-sha rename to .github/learning-path-sha.txt From 8d2ed6a228dbdd7d3e5b635d3a780336eb5f5a7a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:45:12 -0800 Subject: [PATCH 040/352] Update check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 39cef82a3b0..a420f5c93ab 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -14,11 +14,22 @@ jobs: runs-on: ubuntu-latest steps: + + - name: Get previous update SHA + id: get_sha + run: | + cd .github + prev_sha=$(cat learning-path-sha.txt) + echo "prev_sha=$prev_sha" >> $GITHUB_ENV + echo "Writing Prev Sha into GitHub Env" + cd ../ + - name: Checkout previous update uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac with: persist-credentials: false - ref: abc + ref: ${{ env.prev_sha }} + path: prev - name: Checkout head uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac @@ -27,18 +38,10 @@ jobs: ref: main path: head - - name: Get base commit for the PR - working-directory: ./merge - run: | - git fetch origin "$GITHUB_BASE_REF" - base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF") - echo "base_sha=$base_sha" >> $GITHUB_ENV - echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" - - name: Get changed files - working-directory: ./merge + working-directory: ./head run: | - changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV From 711252c1ce6a40dcd97b5fd619ed93d5db86b2ae Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:52:30 -0800 Subject: [PATCH 041/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a420f5c93ab..ad06a52dcc0 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,8 +1,15 @@ name: 'Check Learning Path Links' on: - schedule: # Run once a week. - - cron: '0 0 * * 1' workflow_dispatch: + inputs: + baselineTag: + description: 'Baseline Release Tag Override' + required: false + type: string + + # schedule: # Run once a week. + # - cron: '0 0 * * 1' + # workflow_dispatch: permissions: pull-requests: read From 2a8807441d5e6a74637bf2ca96dd734b81b9e33c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:00:30 -0800 Subject: [PATCH 042/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index fcb07c48422..3f96a7bc8fb 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -12,7 +12,9 @@ on: # workflow_dispatch: permissions: - pull-requests: read + contents: write + issues: write + pull-requests: write jobs: check-learning-path-links: From eaa404ae3370b020127621c1bada80f4e3b999e3 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:03:12 -0800 Subject: [PATCH 043/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 3f96a7bc8fb..7c77bdf308a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,6 @@ permissions: jobs: check-learning-path-links: - if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) name: 'Check Learning Path Links' runs-on: ubuntu-latest From ab976a37e458d8d9e67e449a22b56064f8c43ab4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:05:10 -0800 Subject: [PATCH 044/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 7c77bdf308a..e42479720e8 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -23,8 +23,16 @@ jobs: steps: + - name: Checkout head + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + with: + persist-credentials: false + ref: main + path: head + - name: Get previous update SHA id: get_sha + working-directory: ./head run: | cd .github prev_sha=$(cat learning-path-sha.txt) @@ -38,13 +46,6 @@ jobs: persist-credentials: false ref: ${{ env.prev_sha }} path: prev - - - name: Checkout head - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - with: - persist-credentials: false - ref: main - path: head - name: Get changed files working-directory: ./head From e7c58d36f58f0a999c249a5fa8b418acb1621acc Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:12:45 -0800 Subject: [PATCH 045/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 687bf7d4c0d..4692f8b79f0 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -9bf6287 +ab976a3 From 945807dac58ba42eaa9fb57b0ad1f156ce17a0b5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:16:24 -0800 Subject: [PATCH 046/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 4692f8b79f0..515a8d9cdcb 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -ab976a3 +kkeirstead/StackFrameExceptions From eff79e2a7397ea2e49faac9751b74245010e8dc0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:23:07 -0800 Subject: [PATCH 047/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index e42479720e8..2c44d6bf168 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -50,7 +50,8 @@ jobs: - name: Get changed files working-directory: ./head run: | - changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + # changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + changed_source_files=$(git diff-tree --no-commit-id --name-only -r 9c3809d "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV From 0895a6a26015dc5004d042d783cdf5e1f97fdd5a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:25:51 -0800 Subject: [PATCH 048/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 2c44d6bf168..abe3f2e46eb 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -51,7 +51,7 @@ jobs: working-directory: ./head run: | # changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) - changed_source_files=$(git diff-tree --no-commit-id --name-only -r 9c3809d "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "9c3809d" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV From be97bffc2c688ccdbfe02c86f6da5ed128e8adbb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:31:51 -0800 Subject: [PATCH 049/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index abe3f2e46eb..6262f7cbac4 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -35,9 +35,13 @@ jobs: working-directory: ./head run: | cd .github - prev_sha=$(cat learning-path-sha.txt) + prev_branch_name=$(cat learning-path-sha.txt) + echo "prev_branch_name=$prev_branch_name" >> $GITHUB_ENV + echo "Writing prev_branch_name into GitHub Env" + echo "prev_sha=$(git rev-parse $prev_branch_name)" echo "prev_sha=$prev_sha" >> $GITHUB_ENV - echo "Writing Prev Sha into GitHub Env" + echo "$prev_sha" + echo "Writing prev_sha into GitHub Env" cd ../ - name: Checkout previous update @@ -51,7 +55,7 @@ jobs: working-directory: ./head run: | # changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) - changed_source_files=$(git diff-tree --no-commit-id --name-only -r "9c3809d" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV From 4494324ca1dd1906e4d9240fed4705da20c82fd5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:55:02 -0800 Subject: [PATCH 050/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 6262f7cbac4..442afbf84af 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -38,7 +38,7 @@ jobs: prev_branch_name=$(cat learning-path-sha.txt) echo "prev_branch_name=$prev_branch_name" >> $GITHUB_ENV echo "Writing prev_branch_name into GitHub Env" - echo "prev_sha=$(git rev-parse $prev_branch_name)" + echo "prev_sha=$(git rev-parse kkeirstead/StackFrameExceptions)" echo "prev_sha=$prev_sha" >> $GITHUB_ENV echo "$prev_sha" echo "Writing prev_sha into GitHub Env" From bef96bf41eb8bb86ad79179522b0743b6573aa13 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 13:56:40 -0800 Subject: [PATCH 051/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 442afbf84af..be22da3bb9c 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -38,7 +38,7 @@ jobs: prev_branch_name=$(cat learning-path-sha.txt) echo "prev_branch_name=$prev_branch_name" >> $GITHUB_ENV echo "Writing prev_branch_name into GitHub Env" - echo "prev_sha=$(git rev-parse kkeirstead/StackFrameExceptions)" + echo "prev_sha=$(git rev-parse kkeirstead/kkeirstead/StackFrameExceptions)" echo "prev_sha=$prev_sha" >> $GITHUB_ENV echo "$prev_sha" echo "Writing prev_sha into GitHub Env" From 4eeba5d4362cb50a0bed6dc66647283d62f6d90c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:01:27 -0800 Subject: [PATCH 052/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index be22da3bb9c..85804227118 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -26,8 +26,9 @@ jobs: - name: Checkout head uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac with: - persist-credentials: false + persist-credentials: true ref: main + fetch-depth: 0 # Fetch the entire repo for the below git operations path: head - name: Get previous update SHA From a486546b836ea55a711b065646bf5f0c491b0c08 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:02:08 -0800 Subject: [PATCH 053/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 515a8d9cdcb..a96cf2279cb 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -kkeirstead/StackFrameExceptions +407ddc5 From ace309cdd65639f392ae4c73193db52ff7e3e992 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:02:44 -0800 Subject: [PATCH 054/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 85804227118..a256d8ad245 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -36,12 +36,8 @@ jobs: working-directory: ./head run: | cd .github - prev_branch_name=$(cat learning-path-sha.txt) - echo "prev_branch_name=$prev_branch_name" >> $GITHUB_ENV - echo "Writing prev_branch_name into GitHub Env" - echo "prev_sha=$(git rev-parse kkeirstead/kkeirstead/StackFrameExceptions)" - echo "prev_sha=$prev_sha" >> $GITHUB_ENV - echo "$prev_sha" + prev_sha=$(cat learning-path-sha.txt) + echo "prev_sha=$prev_branch_name" >> $GITHUB_ENV echo "Writing prev_sha into GitHub Env" cd ../ From 465dce9bdd7a13508d318261966ee660530fd1fa Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:10:23 -0800 Subject: [PATCH 055/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a256d8ad245..e8e09200e67 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -37,8 +37,8 @@ jobs: run: | cd .github prev_sha=$(cat learning-path-sha.txt) - echo "prev_sha=$prev_branch_name" >> $GITHUB_ENV - echo "Writing prev_sha into GitHub Env" + echo "prev_sha=$prev_sha" >> $GITHUB_ENV + echo "Writing prev_sha into GitHub Env: $prev_sha" cd ../ - name: Checkout previous update @@ -67,7 +67,7 @@ jobs: sourceDirectoryName: 'src' - name: Generate artifacts (Comment) - working-directory: ./merge + working-directory: ./head run: | mkdir -p ./learning-path-review echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles From 2111e606eaf0e74cba23a99ff9fdb6297ed7a8a0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 07:48:02 -0800 Subject: [PATCH 056/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index e8e09200e67..4481ffe9359 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout head - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + uses: actions/checkout@v4 with: persist-credentials: true ref: main @@ -42,7 +42,7 @@ jobs: cd ../ - name: Checkout previous update - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac + uses: actions/checkout@v4 with: persist-credentials: false ref: ${{ env.prev_sha }} From a211c7db55ac86e30a88d3eed402ce24b998245d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 07:50:41 -0800 Subject: [PATCH 057/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index a96cf2279cb..6c8dd556549 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -407ddc5 +701008b3ef073de94e05773a4a41a9006985d455 From c7c3b3abe7c6c3bc219d1cb8dcb89852fe0bc343 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:05:17 -0800 Subject: [PATCH 058/352] Create submit-stale-learning-path-issue.yml --- .../submit-stale-learning-path-issue.yml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/submit-stale-learning-path-issue.yml diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml new file mode 100644 index 00000000000..1ab7cfde9c8 --- /dev/null +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -0,0 +1,51 @@ +name: 'Stale Learning Path Issue' + +on: + workflow_run: + workflows: ["Check Learning Path Links"] + types: + - completed + +permissions: {} + +jobs: + submit-learning-path-issue: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + id: check-user + with: + script: | + await github.rest.repos.checkCollaborator({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.workflow_run.triggering_actor.login + }); + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + persist-credentials: false + + # Download the artifact from the workflow that kicked off this one. + # The default artifact download action doesn't support cross-workflow + # artifacts, so use a 3rd party one. + - name: 'Download linting results' + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d + with: + workflow: ${{env.workflow_name}} + run_id: ${{github.event.workflow_run.id }} + name: learning-path-review + path: ./learning-path-review + - name: Submit Issue + run: | + title=$(cat ./learning-path-review/issue-title) + user=$(cat ./learning-path-review/issue-user) + recommendations=$(cat ./learning-path-review/issue-recommendations) + gh issue create --label "todo" --assignee "$user" --title "$title" --body "$recommendations" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 190a505e7b6f1bc0e96d3d65b870ee727f970f71 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:07:42 -0800 Subject: [PATCH 059/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 4481ffe9359..cbfec6f4fd9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -73,6 +73,7 @@ jobs: echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions + echo -n "Potential Stale Learning Path" > ./learning-path-review/issue-title - name: Upload artifacts (Comment) uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 From 23049eadf36684f3ff1790112cf2cf7c0dd8878f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:12:33 -0800 Subject: [PATCH 060/352] Update submit-stale-learning-path-issue.yml --- .../submit-stale-learning-path-issue.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 1ab7cfde9c8..c29e1695262 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -41,11 +41,23 @@ jobs: run_id: ${{github.event.workflow_run.id }} name: learning-path-review path: ./learning-path-review + + - name: Set Env Vars + run: | + modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + manuallyReview=$(cat ./learning-path-review/manuallyReview) + suggestions=$(cat ./learning-path-review/suggestions) + echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV + echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV + echo "suggestions=$suggestions" >> $GITHUB_ENV + - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - user=$(cat ./learning-path-review/issue-user) - recommendations=$(cat ./learning-path-review/issue-recommendations) - gh issue create --label "todo" --assignee "$user" --title "$title" --body "$recommendations" + comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); + gh issue create --label "todo" --title "$title" --body "$comment_body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MODIFIED_FILES: ${{ env.modifiedFiles }} + MANUALLY_REVIEW: ${{ env.manuallyReview }} + SUGGESTIONS: ${{ env.suggestions }} From 6e9e510dfd38b5a72190d0ef367c31c9141f5d43 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:14:09 -0800 Subject: [PATCH 061/352] Update EgressHelper.cs --- .../EgressHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..1ede5458be2 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +// Just adding some comments... + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 9a5d1f262c8bce313554b239bef869b38640eaf0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:16:07 -0800 Subject: [PATCH 062/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index cbfec6f4fd9..ddb9f5044e1 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -79,4 +79,4 @@ jobs: uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: name: learning-path-review - path: merge/learning-path-review/ + path: head/learning-path-review/ From 7f5ff7b97831ab6d6d014be77f270c636fc355a5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:21:23 -0800 Subject: [PATCH 063/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index c29e1695262..449e089d012 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -54,7 +54,7 @@ jobs: - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); + comment_body = $(cat ./learning-path-review/manuallyReview) gh issue create --label "todo" --title "$title" --body "$comment_body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6033ca9997ae335ae186b564f0cf5c196ada87e4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:23:39 -0800 Subject: [PATCH 064/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 449e089d012..0f3d1a30cdb 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -54,8 +54,8 @@ jobs: - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - comment_body = $(cat ./learning-path-review/manuallyReview) - gh issue create --label "todo" --title "$title" --body "$comment_body" + body = $(cat ./learning-path-review/manuallyReview) + gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} From c72f5d4d46403164189a046868ba648a582adcf1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:25:03 -0800 Subject: [PATCH 065/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 0f3d1a30cdb..32ea61552c9 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -54,7 +54,7 @@ jobs: - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - body = $(cat ./learning-path-review/manuallyReview) + body=$(cat ./learning-path-review/manuallyReview) gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f8a6fae7a3eb518f797c15e2805352e58f5e7921 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:41:42 -0800 Subject: [PATCH 066/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 32ea61552c9..89192714381 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -54,8 +54,13 @@ jobs: - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - body=$(cat ./learning-path-review/manuallyReview) - gh issue create --label "todo" --title "$title" --body "$body" + comma="," + newline="\n" + manuallyReview=$(cat ./learning-path-review/manuallyReview) + manuallyReview=${manuallyReview//comma/newline} + suggestions=$(cat ./learning-path-review/suggestions) + modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + gh issue create --label "todo" --title "$title" --body "$manuallyReview" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} From cfebc7c87673b9ce0f9465f0dd338261a6848ff4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:46:59 -0800 Subject: [PATCH 067/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 89192714381..316e8df35c2 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -54,10 +54,8 @@ jobs: - name: Submit Issue run: | title=$(cat ./learning-path-review/issue-title) - comma="," - newline="\n" manuallyReview=$(cat ./learning-path-review/manuallyReview) - manuallyReview=${manuallyReview//comma/newline} + manuallyReview=${manuallyReview//,/\\n} suggestions=$(cat ./learning-path-review/suggestions) modifiedFiles=$(cat ./learning-path-review/modifiedFiles) gh issue create --label "todo" --title "$title" --body "$manuallyReview" From 1cc3da571558d8928154a36f3b3c82b0ed3efeae Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:49:01 -0800 Subject: [PATCH 068/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 316e8df35c2..7d6237555eb 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -55,7 +55,7 @@ jobs: run: | title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) - manuallyReview=${manuallyReview//,/\\n} + manuallyReview=${manuallyReview//,/
} suggestions=$(cat ./learning-path-review/suggestions) modifiedFiles=$(cat ./learning-path-review/modifiedFiles) gh issue create --label "todo" --title "$title" --body "$manuallyReview" From 54a681276d3b31a0733995eb32a3ffcc1a449641 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 08:56:56 -0800 Subject: [PATCH 069/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 7d6237555eb..217178c814f 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -57,7 +57,10 @@ jobs: manuallyReview=$(cat ./learning-path-review/manuallyReview) manuallyReview=${manuallyReview//,/
} suggestions=$(cat ./learning-path-review/suggestions) + suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + modifiedFiles=${modifiedFiles//,/
} + comment_body="### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n${modifiedFiles}\n\n---------\n\n #### Manually Review:\n\n${manuallyReview}\n\n---------\n\n #### Suggestions:\n\n${suggestions}" gh issue create --label "todo" --title "$title" --body "$manuallyReview" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 274db2746224dc261a0398149b129d29b0368417 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:00:24 -0800 Subject: [PATCH 070/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 217178c814f..660a43fc4db 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,8 +60,8 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - comment_body="### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n${modifiedFiles}\n\n---------\n\n #### Manually Review:\n\n${manuallyReview}\n\n---------\n\n #### Suggestions:\n\n${suggestions}" - gh issue create --label "todo" --title "$title" --body "$manuallyReview" + body="### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n${modifiedFiles}\n\n---------\n\n #### Manually Review:\n\n${manuallyReview}\n\n---------\n\n #### Suggestions:\n\n${suggestions}" + gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} From 823f7582a501b0a839f9457006ab2037cf658848 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:07:05 -0800 Subject: [PATCH 071/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 660a43fc4db..d1b65fe93c3 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,7 +60,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n${modifiedFiles}\n\n---------\n\n #### Manually Review:\n\n${manuallyReview}\n\n---------\n\n #### Suggestions:\n\n${suggestions}" + body="### Learning Paths Staleness Check
#### Impacted Paths:\n\n${modifiedFiles}
---------
#### Manually Review:
${manuallyReview}
---------
#### Suggestions:
${suggestions}" gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 5eae2614898d312e0594ebd4cd618833591cd9f7 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:09:04 -0800 Subject: [PATCH 072/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index d1b65fe93c3..9aaed57d1a6 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,7 +60,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="### Learning Paths Staleness Check
#### Impacted Paths:\n\n${modifiedFiles}
---------
#### Manually Review:
${manuallyReview}
---------
#### Suggestions:
${suggestions}" + body="### Learning Paths Staleness Check
#### Impacted Paths:
${modifiedFiles}
---------
#### Manually Review:
${manuallyReview}
---------
#### Suggestions:
${suggestions}" gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 17cd018266bb34863b0acdbe454601724619130a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:11:12 -0800 Subject: [PATCH 073/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 9aaed57d1a6..e31966f55cf 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,7 +60,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="### Learning Paths Staleness Check
#### Impacted Paths:
${modifiedFiles}
---------
#### Manually Review:
${manuallyReview}
---------
#### Suggestions:
${suggestions}" + body="

Learning Paths Staleness Check


Impacted Paths

:
${modifiedFiles}
---------

Manually Review:


${manuallyReview}
---------

Suggestions:


${suggestions}" gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f2a7e2c0f3686f0a388c8d94695d9cc5ca5f008c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:13:57 -0800 Subject: [PATCH 074/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index e31966f55cf..a4fe584acb1 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,7 +60,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="

Learning Paths Staleness Check


Impacted Paths

:
${modifiedFiles}
---------

Manually Review:


${manuallyReview}
---------

Suggestions:


${suggestions}" + body="

Learning Paths Staleness Check


Impacted Paths:


${modifiedFiles}


---------

Manually Review:


${manuallyReview}


---------

Suggestions:


${suggestions}

" gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 386d6a2599c1ea6d99410c04a7f1878503fb0e95 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:21:14 -0800 Subject: [PATCH 075/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index a4fe584acb1..d325108b336 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -60,7 +60,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="

Learning Paths Staleness Check


Impacted Paths:


${modifiedFiles}


---------

Manually Review:


${manuallyReview}


---------

Suggestions:


${suggestions}

" + body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:


${manuallyReview}

Suggestions:


${suggestions}" gh issue create --label "todo" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 58e9bc03e9ec8b9b84cab6fc39b466a95fae93a2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:39:57 -0800 Subject: [PATCH 076/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 6c8dd556549..2a9e6ba2e73 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -701008b3ef073de94e05773a4a41a9006985d455 +386d6a2599c1ea6d99410c04a7f1878503fb0e95 From a5d0c5969abec29fe54e43bd8adacad750229444 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:40:31 -0800 Subject: [PATCH 077/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 1ede5458be2..ae485eb61b4 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // Just adding some comments... +// And a few more... using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; From 44d2f2968b44d9a4e40c01e9e2fd056623399e09 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:54:43 -0800 Subject: [PATCH 078/352] Create scan-for-learning-path-update-comments.yml --- ...scan-for-learning-path-update-comments.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/scan-for-learning-path-update-comments.yml diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml new file mode 100644 index 00000000000..889c7f1ac3d --- /dev/null +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -0,0 +1,33 @@ +name: Scan For Learning Path Update Comments +on: + pull_request_review_comment: + types: [created] + issue_comment: + types: [created] + +permissions: + pull-requests: read + issues: read + +jobs: + scan-for-todo-issue: + if: startsWith(github.event.comment.body, '/LEARNINGPATHUPDATE') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + runs-on: ubuntu-latest + steps: + - name: Generate artifacts + run: | + trimmed_comment=$(echo "$COMMENT_BODY" | sed 's|/TODO ||I') + mkdir -p ./issue + echo -n "$trimmed_comment" > ./issue/issue-title + echo -n "$COMMENT_URL" > ./issue/issue-url + echo -n "$COMMENT_AUTHOR" > ./issue/issue-user + env: + COMMENT_BODY: ${{ github.event.comment.body }} + COMMENT_URL: ${{ github.event.comment.html_url }} + COMMENT_AUTHOR: ${{ github.event.comment.user.login }} + + - name: Upload artifacts + uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 + with: + name: issue-learning-path-update + path: issue/ From acaaf35e5929569932a7c845e97403b8b16bb71a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:55:35 -0800 Subject: [PATCH 079/352] Create create_learning_path_update_pr.yml --- .github/workflows/create_learning_path_update_pr.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/workflows/create_learning_path_update_pr.yml diff --git a/.github/workflows/create_learning_path_update_pr.yml b/.github/workflows/create_learning_path_update_pr.yml new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/.github/workflows/create_learning_path_update_pr.yml @@ -0,0 +1 @@ + From 3a240d7853173fa583bb466818be5f959ccd3164 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:01:09 -0800 Subject: [PATCH 080/352] Update and rename create_learning_path_update_pr.yml to create-learning-path-update.yml --- .../workflows/create-learning-path-update.yml | 91 +++++++++++++++++++ .../create_learning_path_update_pr.yml | 1 - 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/create-learning-path-update.yml delete mode 100644 .github/workflows/create_learning_path_update_pr.yml diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml new file mode 100644 index 00000000000..d4c06bcb164 --- /dev/null +++ b/.github/workflows/create-learning-path-update.yml @@ -0,0 +1,91 @@ +name: 'Create Learning Path Update' +run-name: '[${{ github.ref_name }}] Create Learning Path Update' + +on: + workflow_dispatch: + inputs: + baselineTag: + description: 'Baseline Release Tag Override' + required: false + type: string + +permissions: {} + +jobs: + create-learning-path-update-pr: + name: 'Create Learning Path Update' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout release branch + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + persist-credentials: false + fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + + - name: Calculate release information + run: | + git fetch --tags + + # Grab the latest tag from the current branch unless overridden. If it doesn't exist, grab the latest tag across all branches. + last_release_tag=$BASELINE_TAG + if [[ -z "$BASELINE_TAG" ]]; then + last_release_tag=$(git describe --tags --abbrev=0 || git describe --tags $(git rev-list --tags --max-count=1)) + fi + + echo "Using tag: $last_release_tag" + last_release_date=$(git log -1 --format=%aI "$last_release_tag") + echo "last_release_date=$last_release_date" >> $GITHUB_ENV + + versionFile="./eng/Versions.props" + release_version=$(perl -ne '/([^<]*)/ && print $1' $versionFile) + release_version_label=$(perl -ne '/([^<]*)/ && print $1' $versionFile) + release_version_iteration=$(perl -ne '/([^<]*)/ && print $1' $versionFile) + + friendly_release_name="" + qualified_release_version="$release_version-$release_version_label.$release_version_iteration" + + if [ "$release_version_label" == "rtm" ] || [ "$release_version_label" == "servicing" ]; then + friendly_release_name="$release_version build" + qualified_release_version="$release_version" + elif [ "$release_version_label" == "rc" ]; then + friendly_release_name="official $release_version Release Candidate" + else + friendly_release_name="next official preview version" + fi + + release_note_path="./documentation/releaseNotes/releaseNotes.v${qualified_release_version}.md" + echo "release_note_path=$release_note_path" >> $GITHUB_ENV + echo "friendly_release_name=$friendly_release_name" >> $GITHUB_ENV + echo "qualified_release_version=$qualified_release_version" >> $GITHUB_ENV + env: + BASELINE_TAG: ${{ inputs.baselineTag }} + + - name: Checkout main + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + persist-credentials: true # We need to persist credentials to push the resulting changes upstream. + ref: main + + - name: Generate release notes + uses: ./.github/actions/generate-release-notes + with: + output: ${{ env.release_note_path }} + last_release_date: ${{ env.last_release_date }} + build_description: ${{ env.friendly_release_name }} + auth_token: ${{ secrets.GITHUB_TOKEN }} + branch_name: ${{ github.ref_name }} + + - name: Open PR + uses: ./.github/actions/open-pr + with: + files_to_commit: ${{ env.release_note_path }} + title: "Update Learning Path Links" + commit_message: Update Learning Path Links + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed. + branch_name: releaseNotes/${{ env.qualified_release_version }} + fail_if_files_unchanged: true + auth_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create_learning_path_update_pr.yml b/.github/workflows/create_learning_path_update_pr.yml deleted file mode 100644 index 8b137891791..00000000000 --- a/.github/workflows/create_learning_path_update_pr.yml +++ /dev/null @@ -1 +0,0 @@ - From 90fcc49b20db0b6475fd03b6ed1acf497e25d36e Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:02:02 -0800 Subject: [PATCH 081/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index d4c06bcb164..fee90e71378 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -2,12 +2,10 @@ name: 'Create Learning Path Update' run-name: '[${{ github.ref_name }}] Create Learning Path Update' on: - workflow_dispatch: - inputs: - baselineTag: - description: 'Baseline Release Tag Override' - required: false - type: string + workflow_run: + workflows: ["Scan For To Do Comments"] + types: + - completed permissions: {} From 2473eaa02d8d50a5d8a7ff51a42405ef0469ba5d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:25:32 -0800 Subject: [PATCH 082/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index fee90e71378..0b8bd5550f8 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -24,6 +24,14 @@ jobs: persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + - name: Update Learning Path Hashes + id: check-links + uses: kkeirstead/LearningPathFileChecks@main + with: + learningPathsDirectory: 'documentation/learningPath' + oldHash: "def" + newHash: "abc" + - name: Calculate release information run: | git fetch --tags From 3bd654ff86137ddef15c1577fc886450889de598 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:25:58 -0800 Subject: [PATCH 083/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 0b8bd5550f8..6c26712e962 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -26,7 +26,7 @@ jobs: - name: Update Learning Path Hashes id: check-links - uses: kkeirstead/LearningPathFileChecks@main + uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' oldHash: "def" From 7fb1f7b8d7901ee6461c506eb3bdafdb28a436a1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:29:02 -0800 Subject: [PATCH 084/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 6c26712e962..7c9e5a9ceb0 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -24,12 +24,22 @@ jobs: persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + - name: Get previous update SHA + id: get_sha + working-directory: ./head + run: | + cd .github + prev_sha=$(cat learning-path-sha.txt) + echo "prev_sha=$prev_sha" >> $GITHUB_ENV + echo "Writing prev_sha into GitHub Env: $prev_sha" + cd ../ + - name: Update Learning Path Hashes id: check-links uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' - oldHash: "def" + oldHash: ${{ env.prev_sha }} newHash: "abc" - name: Calculate release information From c83582b6634b9fdd43fe7c4a9f5693ad27cbf4ab Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:30:24 -0800 Subject: [PATCH 085/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 7c9e5a9ceb0..ee5d6307397 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -18,15 +18,15 @@ jobs: pull-requests: write steps: - - name: Checkout release branch - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Checkout head + uses: actions/checkout@v4 with: - persist-credentials: false - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + persist-credentials: true + ref: main + fetch-depth: 0 # Fetch the entire repo for the below git operations - name: Get previous update SHA id: get_sha - working-directory: ./head run: | cd .github prev_sha=$(cat learning-path-sha.txt) From 1ba6f86555d4f90a028d3ef92e641221e6bc3be5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:30:50 -0800 Subject: [PATCH 086/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index ee5d6307397..76d26487c54 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -3,7 +3,7 @@ run-name: '[${{ github.ref_name }}] Create Learning Path Update' on: workflow_run: - workflows: ["Scan For To Do Comments"] + workflows: ["Scan For Learning Path Update Comments"] types: - completed From 8da66d5faa955622acccc730383a131e232c26cb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:33:36 -0800 Subject: [PATCH 087/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 76d26487c54..1ad7b638651 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -39,6 +39,7 @@ jobs: uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' + learningPathHashFile: '.github/learning-path-sha.txt' oldHash: ${{ env.prev_sha }} newHash: "abc" From 8e1a8d6a735633135ab1b3b62783e0bdd3d7af98 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:41:37 -0800 Subject: [PATCH 088/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index 889c7f1ac3d..83c1993d093 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -10,13 +10,13 @@ permissions: issues: read jobs: - scan-for-todo-issue: + scan-for-learning-path-update-comments: if: startsWith(github.event.comment.body, '/LEARNINGPATHUPDATE') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts run: | - trimmed_comment=$(echo "$COMMENT_BODY" | sed 's|/TODO ||I') + trimmed_comment=$(echo "$COMMENT_BODY" | sed 's|/LEARNINGPATHUPDATE ||I') mkdir -p ./issue echo -n "$trimmed_comment" > ./issue/issue-title echo -n "$COMMENT_URL" > ./issue/issue-url From c482b96ef3865cd2524d0a3790b5982fb8f3b90d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 12:44:21 -0800 Subject: [PATCH 089/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 1ad7b638651..0bb473048a2 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -2,10 +2,17 @@ name: 'Create Learning Path Update' run-name: '[${{ github.ref_name }}] Create Learning Path Update' on: - workflow_run: - workflows: ["Scan For Learning Path Update Comments"] - types: - - completed + workflow_dispatch: + inputs: + baselineTag: + description: 'Baseline Release Tag Override' + required: false + type: string + + # workflow_run: + # workflows: ["Scan For Learning Path Update Comments"] + # types: + # - completed permissions: {} From e7dec347c4964f90d37df6cefa5b8693218a65b6 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:10:22 -0800 Subject: [PATCH 090/352] Update create-learning-path-update.yml --- .../workflows/create-learning-path-update.yml | 53 ++----------------- 1 file changed, 3 insertions(+), 50 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 0bb473048a2..30a13d41a6b 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -42,7 +42,7 @@ jobs: cd ../ - name: Update Learning Path Hashes - id: check-links + id: update-links uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' @@ -50,66 +50,19 @@ jobs: oldHash: ${{ env.prev_sha }} newHash: "abc" - - name: Calculate release information - run: | - git fetch --tags - - # Grab the latest tag from the current branch unless overridden. If it doesn't exist, grab the latest tag across all branches. - last_release_tag=$BASELINE_TAG - if [[ -z "$BASELINE_TAG" ]]; then - last_release_tag=$(git describe --tags --abbrev=0 || git describe --tags $(git rev-list --tags --max-count=1)) - fi - - echo "Using tag: $last_release_tag" - last_release_date=$(git log -1 --format=%aI "$last_release_tag") - echo "last_release_date=$last_release_date" >> $GITHUB_ENV - - versionFile="./eng/Versions.props" - release_version=$(perl -ne '/([^<]*)/ && print $1' $versionFile) - release_version_label=$(perl -ne '/([^<]*)/ && print $1' $versionFile) - release_version_iteration=$(perl -ne '/([^<]*)/ && print $1' $versionFile) - - friendly_release_name="" - qualified_release_version="$release_version-$release_version_label.$release_version_iteration" - - if [ "$release_version_label" == "rtm" ] || [ "$release_version_label" == "servicing" ]; then - friendly_release_name="$release_version build" - qualified_release_version="$release_version" - elif [ "$release_version_label" == "rc" ]; then - friendly_release_name="official $release_version Release Candidate" - else - friendly_release_name="next official preview version" - fi - - release_note_path="./documentation/releaseNotes/releaseNotes.v${qualified_release_version}.md" - echo "release_note_path=$release_note_path" >> $GITHUB_ENV - echo "friendly_release_name=$friendly_release_name" >> $GITHUB_ENV - echo "qualified_release_version=$qualified_release_version" >> $GITHUB_ENV - env: - BASELINE_TAG: ${{ inputs.baselineTag }} - - name: Checkout main uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: persist-credentials: true # We need to persist credentials to push the resulting changes upstream. ref: main - - name: Generate release notes - uses: ./.github/actions/generate-release-notes - with: - output: ${{ env.release_note_path }} - last_release_date: ${{ env.last_release_date }} - build_description: ${{ env.friendly_release_name }} - auth_token: ${{ secrets.GITHUB_TOKEN }} - branch_name: ${{ github.ref_name }} - - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ env.release_note_path }} + files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed. - branch_name: releaseNotes/${{ env.qualified_release_version }} + branch_name: learningPathUpdates/${{ env.prev_sha }} # should probably update this to new sha once we determine that fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 0136c87278a86672be03e1af52ad293a8a6d1eb2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:15:06 -0800 Subject: [PATCH 091/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 30a13d41a6b..cf608aa5d1e 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -25,12 +25,11 @@ jobs: pull-requests: write steps: - - name: Checkout head - uses: actions/checkout@v4 + - name: Checkout main + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: - persist-credentials: true + persist-credentials: true # We need to persist credentials to push the resulting changes upstream. ref: main - fetch-depth: 0 # Fetch the entire repo for the below git operations - name: Get previous update SHA id: get_sha @@ -50,12 +49,6 @@ jobs: oldHash: ${{ env.prev_sha }} newHash: "abc" - - name: Checkout main - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - persist-credentials: true # We need to persist credentials to push the resulting changes upstream. - ref: main - - name: Open PR uses: ./.github/actions/open-pr with: From ccecf7b4f31afe773bd40f1a7fefed11e56a92c8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:20:45 -0800 Subject: [PATCH 092/352] Update egress.md --- documentation/learningPath/egress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index db4d712c490..290100d2bcb 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -26,7 +26,7 @@ graph LR class ide2 altColor ``` -1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L49) +1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L49) 1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) 1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) 1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L35) From 8ac1b8f7a4f90a723e73fd569abb1630cb929daf Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:20:58 -0800 Subject: [PATCH 093/352] Update configuration.md --- documentation/learningPath/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 4b96afd97f8..f7031a4bbf5 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -13,7 +13,7 @@ To see the merged configuration, the user can run the `config show` command (see Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L80)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: -* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/ba8c36235943562581b666e74ef07954313eda56/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project +* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path * Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/ba8c36235943562581b666e74ef07954313eda56/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) From 6a2e424dc580f10b9a5ec207acfbe370becd3e6a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 13:25:39 -0800 Subject: [PATCH 094/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index cf608aa5d1e..39e2140cdce 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -31,8 +31,15 @@ jobs: persist-credentials: true # We need to persist credentials to push the resulting changes upstream. ref: main + - name: Get current SHA + id: get_new_sha + run: | + new_sha=$(git rev-parse HEAD) + echo "new_sha=$new_sha" >> $GITHUB_ENV + echo "Writing new_sha into GitHub Env: $new_sha" + - name: Get previous update SHA - id: get_sha + id: get_prev_sha run: | cd .github prev_sha=$(cat learning-path-sha.txt) @@ -47,7 +54,7 @@ jobs: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' oldHash: ${{ env.prev_sha }} - newHash: "abc" + newHash: ${{ env.new_sha }} - name: Open PR uses: ./.github/actions/open-pr @@ -56,6 +63,6 @@ jobs: title: "Update Learning Path Links" commit_message: Update Learning Path Links body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed. - branch_name: learningPathUpdates/${{ env.prev_sha }} # should probably update this to new sha once we determine that + branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From cb9567f88caa3ba40d0e5ca44be9ec15aec85bcc Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:22:48 -0800 Subject: [PATCH 095/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index d325108b336..36f86babbc4 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -52,6 +52,7 @@ jobs: echo "suggestions=$suggestions" >> $GITHUB_ENV - name: Submit Issue + if: ${{ env.modifiedFiles != '' }} run: | title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) @@ -61,7 +62,7 @@ jobs: modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:


${manuallyReview}

Suggestions:


${suggestions}" - gh issue create --label "todo" --title "$title" --body "$body" + gh issue create --label "learning-path" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} From e97654dc36502597ba47d8a51c3417d7a1dec133 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:36:45 -0800 Subject: [PATCH 096/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 36f86babbc4..d89060c3790 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -62,7 +62,7 @@ jobs: modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:


${manuallyReview}

Suggestions:


${suggestions}" - gh issue create --label "learning-path" --title "$title" --body "$body" + gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} From aa0e81307b1610201a0cb0ebc1a99ef58960b839 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Tue, 23 Jan 2024 14:39:26 -0800 Subject: [PATCH 097/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index d89060c3790..cf8f733f7df 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -61,7 +61,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:


${manuallyReview}

Suggestions:


${suggestions}" + body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}" gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1d56135e55f8162d35eb718a409d4e2ef9400b8f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:12:23 -0800 Subject: [PATCH 098/352] Update api.md --- documentation/learningPath/api.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/learningPath/api.md b/documentation/learningPath/api.md index de42e4e36d4..591bb9a0e62 100644 --- a/documentation/learningPath/api.md +++ b/documentation/learningPath/api.md @@ -7,15 +7,15 @@ dotnet-monitor exposes functionality through both [collection rules](./collectio ## Adding New APIs -The web API surface is defined by a series of controllers [here](../../src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). +The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). -If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](../../src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). +If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). When adding a new API, it's important to also update the [`openapi.json`](../openapi.json) spec which describes the API surface. There are CI tests that will ensure this file has been updated to reflect any API changes. Learn more about updating `openapi.json` [here](./testing.md#openapi-generation). ### Adding Tests -Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). +Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). ## Notable Controller Attributes @@ -35,6 +35,6 @@ dotnet-monitor supports multiple different [authentication modes](../authenticat ### Determining Authentication Mode -When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](../../src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. +When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. -After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](../../src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](../../src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. +After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. From 41885de39a4e177d2a08a945265e01e3e0716594 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:19:44 -0800 Subject: [PATCH 099/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 414eff16a1b..559d339e59e 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,49 +32,49 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L100). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. -* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). -* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). -* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). +* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). +* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters -Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L189); if so, the collection rule starts. +Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L117). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates -Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). +Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). ### Collection Rule Defaults -Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. +Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. ### Collection Rule API Endpoint -The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L532) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L557). **This API is solely for viewing the current state of rules, not altering state**. +The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. -Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/main/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). +Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/main/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/collectionrules). From 9637669dc409d43956f19061ef195408309b1608 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:26:15 -0800 Subject: [PATCH 100/352] Update configuration.md --- documentation/learningPath/configuration.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index f7031a4bbf5..36ef2483b55 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -8,20 +8,20 @@ `dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. -To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). +To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). -Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L80)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. +Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. -Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: +Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: * Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path * Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/ba8c36235943562581b666e74ef07954313eda56/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) ## Keeping Documentation Up-To-Date -Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/main/documentation/configuration). Sections are typically comprised of: +Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/configuration). Sections are typically comprised of: * A brief overview of the feature that is being configured * Configuration samples in all supported formats * A list of properties with descriptions, types, and whether a property is required -Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/main/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). +Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). From 312bb91315ea4fa8aece23d30d2e617509a0ad61 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:33:39 -0800 Subject: [PATCH 101/352] Update testing.md --- documentation/learningPath/testing.md | 56 +++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index 24153c55a7d..b12017d0771 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -7,81 +7,81 @@ Tests can be executed with the command line (via [build.cmd](../../Build.cmd) -test), as part of the PR build, or in Visual Studio. Note that because of limited resources in the build pool, tests ran from the command line or in the build pool are serialized. This avoids test failures associated with parallel testing. Visual Studio does not have such restrictions and is best used for individual tests and test investigations. When running from the command line, using the `-testgroup` parameter can be used to limit the amount of tests executed. For example `build.cmd -test -testgroup PR` will run the same tests as the PR build. -The framework of the test assemblies is controlled by [TestTargetFrameworks](../../eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](../../src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). +The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). ## Unit Tests -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) -- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) -- [CollectionRuleActions.UnitTests](../../src/Tests/CollectionRuleActions.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) +- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) +- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/CollectionRuleActions.UnitTests/) Unit test assemblies directly reference types from various dotnet-monitor assemblies. However, since most of dotnet-monitor heavily relies on code injection, there are utility classes to simplify unit test creation. -- [TestHostHelper](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. -- [CollectionRuleOptionsExtensions](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. +- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. +- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. ## Functional Tests -- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) -- [Microsoft.Diagnostics.Monitoring.UnitTestApp](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) +- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) Functional tests are composed of 3 main parts: 1. The test itself, which sets up and validates the results. 1. An instance of dotnet-monitor 1. An instance of an application that is being monitored (from the UnitTestApp assembly) -* [ScenarioRunner](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. -* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). -* New scenarios can be added [here](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). -* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/main/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. -* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](../../src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](../../src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. +* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. +* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). +* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). +* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. +* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. ## Native/Profiler Tests -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](../../src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) This test assembly provides a test to make sure the dotnet-monitor profiler can load into a target app. ## Schema Generation -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](../../src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) -- [Microsoft.Diagnostics.Monitoring.Options](../../src/Microsoft.Diagnostics.Monitoring.Options) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) +- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options) -Dotnet-monitor generates [schema.json](../../documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. -Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](../../src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. +Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. +Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. ## OpenAPI generation -- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.OpenApiGen](../../src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) -These assemblies and tests are used to generate the [OpenAPI spec](../../documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. +These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. If using VSCode or Codespaces, you can also use the `Regenerate openapi.json` task. ## Startup hooks / hosting startup -- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) This assembly is injected into a dotnet-monitor runner (using `DOTNET_STARTUP_HOOKS`) to facilitate Assembly resolution during test runs. -- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) Uses `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` to inject a service into dotnet-monitor during test time. This allows tests to locate files that are not normally part of the test deployment, such as the native profiler. -- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](../../src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) Unit tests around features that are injected via `DOTNET_STARTUP_HOOKS` into the target application. This currently includes the Exceptions History feature. ## Misc test assemblies -- [Microsoft.Diagnostics.Monitoring.TestCommon](../../src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) +- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) Utility classes that are shared between Unit Tests and Functional Tests. -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](../../src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. From b7d04ca1664b1e11f3e3696501776f2bfa3ec142 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:42:49 -0800 Subject: [PATCH 102/352] Update egress.md --- documentation/learningPath/egress.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index 290100d2bcb..7854d407045 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -26,11 +26,11 @@ graph LR class ide2 altColor ``` -1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L49) -1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) -1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) -1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L35) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) +1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) +1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) +1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) +1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) ## Distribution and Acquisition Model @@ -41,7 +41,7 @@ There are two versions of the `dotnet-monitor` image being offered: `monitor` an ### Well Known Egress Provider Locations -There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L260) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): +There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): - Next to the executing `dotnet-monitor` assembly - SharedConfigDirectory - On Windows, `%ProgramData%\dotnet-monitor` @@ -59,23 +59,23 @@ The distribution/acquisition model for third-party egress providers is determine ### Extension Manifest -All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. +All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. | Name | Required | Type | Description | |---|---|---|---| | `Name` | true | string | The name of the extension (e.g. AzureBlobStorage) that users will use when writing configuration for the egress provider. | | `ExecutableFileName` | false | string | If specified, the executable file (without extension) to be launched when executing the extension; either `AssemblyFileName` or `ExecutableFileName` must be specified. | | `AssemblyFileName` | false | string | If specified, executes the extension using the shared .NET host (e.g. dotnet.exe) with the specified entry point assembly (without extension); either `AssemblyFileName` or `ExecutableFileName` must be specified. | -| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | +| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | ### Configuration Extensions are designed to receive all user configuration through `dotnet monitor` - the extension itself should not rely on any additional configuration sources. -In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. +In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. ### Communicating With Dotnet-Monitor -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L139). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L141). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** -All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/289105261537f3977f7d1886f936d19bb3639d46/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L53); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. +All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L71); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. From 53a0afba3762318db4f943a8ae120be7f36ccb68 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:44:56 -0800 Subject: [PATCH 103/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 2a9e6ba2e73..3164c68c877 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -386d6a2599c1ea6d99410c04a7f1878503fb0e95 +542a6873d1e7e4e572496a62b7a7315a612dc63c From c88b42713115d2c9f2664ee06095b8c23062f9af Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:49:22 -0800 Subject: [PATCH 104/352] Update EgressHelper.cs --- .../EgressHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index ae485eb61b4..6a37b82d8fb 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -4,6 +4,8 @@ // Just adding some comments... // And a few more... +// Trying another comment. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 8d114855478634e3c666410cfd15f2ebdda167dd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:54:47 -0800 Subject: [PATCH 105/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index ddb9f5044e1..24ae1ceb547 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -62,7 +62,6 @@ jobs: with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' - paths: ${{ env.updated_files }} changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' From 9136b9953f6780ae49918f121dbf6f8a1467277c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 11:56:25 -0800 Subject: [PATCH 106/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 6a37b82d8fb..6a4528c5c38 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -5,6 +5,7 @@ // And a few more... // Trying another comment. +// ... using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; From 52adc14dfe6ea0b388b92bc8c8739a489a2beb06 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:06:41 -0800 Subject: [PATCH 107/352] Update EgressHelper.cs --- .../EgressHelper.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 6a4528c5c38..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,12 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// Just adding some comments... -// And a few more... - -// Trying another comment. -// ... - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 69d76b60fc66cd0e6d124c381be91fdcd009baba Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:07:28 -0800 Subject: [PATCH 108/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 3164c68c877..2a9e6ba2e73 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -542a6873d1e7e4e572496a62b7a7315a612dc63c +386d6a2599c1ea6d99410c04a7f1878503fb0e95 From 6a8b650ef797cb8aab4d80787dbdce12b1b22fc4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:15:28 -0800 Subject: [PATCH 109/352] Update create-learning-path-update.yml --- .../workflows/create-learning-path-update.yml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 39e2140cdce..b626c36f88e 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -2,17 +2,17 @@ name: 'Create Learning Path Update' run-name: '[${{ github.ref_name }}] Create Learning Path Update' on: - workflow_dispatch: - inputs: - baselineTag: - description: 'Baseline Release Tag Override' - required: false - type: string + workflow_run: + workflows: ["Scan For Learning Path Update Comments"] + types: + - completed - # workflow_run: - # workflows: ["Scan For Learning Path Update Comments"] - # types: - # - completed + # workflow_dispatch: + # inputs: + # baselineTag: + # description: 'Baseline Release Tag Override' + # required: false + # type: string permissions: {} From 77af0ae67477d5c5a88f356eb13f6d80e7634c54 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:27:58 -0800 Subject: [PATCH 110/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 24ae1ceb547..a42d0c97de9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -72,7 +72,7 @@ jobs: echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions - echo -n "Potential Stale Learning Path" > ./learning-path-review/issue-title + echo -n "[BOT] Learning Path Update" > ./learning-path-review/issue-title - name: Upload artifacts (Comment) uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 From f27a24b34172476cc653fdf29522bda1cabfc936 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:38:54 -0800 Subject: [PATCH 111/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index 83c1993d093..f4af96efc7f 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -11,14 +11,12 @@ permissions: jobs: scan-for-learning-path-update-comments: - if: startsWith(github.event.comment.body, '/LEARNINGPATHUPDATE') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + if: startsWith(github.event.comment.body, '👍') && equals(github.event.issue.title, "[BOT] Learning Path Update" && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts run: | - trimmed_comment=$(echo "$COMMENT_BODY" | sed 's|/LEARNINGPATHUPDATE ||I') mkdir -p ./issue - echo -n "$trimmed_comment" > ./issue/issue-title echo -n "$COMMENT_URL" > ./issue/issue-url echo -n "$COMMENT_AUTHOR" > ./issue/issue-user env: From e37e25a16f43662e78fbc630ee8a0103fd57d946 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:41:22 -0800 Subject: [PATCH 112/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index b626c36f88e..1ea83e28ee0 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -62,7 +62,7 @@ jobs: files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #123456789. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From e7e08c0d85378a190a81b57cf79f1623e514740b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:44:04 -0800 Subject: [PATCH 113/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index f4af96efc7f..e263ce8a078 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -19,13 +19,15 @@ jobs: mkdir -p ./issue echo -n "$COMMENT_URL" > ./issue/issue-url echo -n "$COMMENT_AUTHOR" > ./issue/issue-user + echo -n "$ISSUE_NUMBER" > ./issue/issue-number env: COMMENT_BODY: ${{ github.event.comment.body }} COMMENT_URL: ${{ github.event.comment.html_url }} COMMENT_AUTHOR: ${{ github.event.comment.user.login }} + ISSUE_NUMBER: ${{ github.event.issue.number }} - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 with: - name: issue-learning-path-update + name: issue-update path: issue/ From 8546a5b0e046ac2900578217e946e6b124513847 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:46:08 -0800 Subject: [PATCH 114/352] Update scan-for-to-do-comments.yml --- .github/workflows/scan-for-to-do-comments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scan-for-to-do-comments.yml b/.github/workflows/scan-for-to-do-comments.yml index 10d90cb7a59..44c1db88fb5 100644 --- a/.github/workflows/scan-for-to-do-comments.yml +++ b/.github/workflows/scan-for-to-do-comments.yml @@ -29,5 +29,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 with: - name: issue-todo - path: issue/ + name: learning-path-update + path: learning-path-update/ From 1cd92ec9c34b7c9d0c5bf68fe59466f70c556aac Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:46:57 -0800 Subject: [PATCH 115/352] Update scan-for-to-do-comments.yml --- .github/workflows/scan-for-to-do-comments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scan-for-to-do-comments.yml b/.github/workflows/scan-for-to-do-comments.yml index 44c1db88fb5..10d90cb7a59 100644 --- a/.github/workflows/scan-for-to-do-comments.yml +++ b/.github/workflows/scan-for-to-do-comments.yml @@ -29,5 +29,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 with: - name: learning-path-update - path: learning-path-update/ + name: issue-todo + path: issue/ From 71914d80698989a5645c530f4a6f752705b1a1ff Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:47:13 -0800 Subject: [PATCH 116/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index e263ce8a078..c48b3d4ff5c 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -29,5 +29,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 with: - name: issue-update - path: issue/ + name: learning-path-update + path: learning-path-update/ From 8015caaa814ec0bf8c6be5382b314f3f1f02a170 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:52:09 -0800 Subject: [PATCH 117/352] Update create-learning-path-update.yml --- .../workflows/create-learning-path-update.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 1ea83e28ee0..24468c44667 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -56,13 +56,29 @@ jobs: oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} + # Download the artifact from the workflow that kicked off this one. + # The default artifact download action doesn't support cross-workflow + # artifacts, so use a 3rd party one. + - name: 'Download linting results' + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d + with: + workflow: ${{env.workflow_name}} + run_id: ${{github.event.workflow_run.id }} + name: learning-path-update + path: ./learning-path-update + + - name: Set Env Vars + run: | + issueNumber=$(cat ./learning-path-update/issue-number) + echo "issueNumber=$issueNumber" >> $GITHUB_ENV + - name: Open PR uses: ./.github/actions/open-pr with: files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #123456789. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #${{ env.new_sha }}. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From bd0b1714e9925e44d482cf35dbe131488e8c471c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:00:29 -0800 Subject: [PATCH 118/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index c48b3d4ff5c..2c0497b896a 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -11,7 +11,7 @@ permissions: jobs: scan-for-learning-path-update-comments: - if: startsWith(github.event.comment.body, '👍') && equals(github.event.issue.title, "[BOT] Learning Path Update" && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == "[BOT] Learning Path Update" && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts From 6ca7e20196673e96fd1aa527a22e59f6ab7f2e02 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:06:51 -0800 Subject: [PATCH 119/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index 2c0497b896a..584b63eb772 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -11,7 +11,7 @@ permissions: jobs: scan-for-learning-path-update-comments: - if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == "[BOT] Learning Path Update" && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts From de545b8bf07469e2eb8a65b005479f684ed6defd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:09:58 -0800 Subject: [PATCH 120/352] Update scan-for-learning-path-update-comments.yml --- .../workflows/scan-for-learning-path-update-comments.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index 584b63eb772..c4df069e3cd 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -16,10 +16,10 @@ jobs: steps: - name: Generate artifacts run: | - mkdir -p ./issue - echo -n "$COMMENT_URL" > ./issue/issue-url - echo -n "$COMMENT_AUTHOR" > ./issue/issue-user - echo -n "$ISSUE_NUMBER" > ./issue/issue-number + mkdir -p ./learning-path-update + echo -n "$COMMENT_URL" > ./learning-path-update/issue-url + echo -n "$COMMENT_AUTHOR" > ./learning-path-update/issue-user + echo -n "$ISSUE_NUMBER" > ./learning-path-update/issue-number env: COMMENT_BODY: ${{ github.event.comment.body }} COMMENT_URL: ${{ github.event.comment.html_url }} From 29e6db3771f9557ec0e1b7b738b6d83ee25cbf7c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:14:56 -0800 Subject: [PATCH 121/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 24468c44667..e919e8ac11b 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -78,7 +78,7 @@ jobs: files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #${{ env.new_sha }}. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #${{ env.issueNumber }}. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From dd8f585d425b187645fbfcd398f4af10f5d38733 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:31:07 -0800 Subject: [PATCH 122/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index e919e8ac11b..4010d6229af 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -69,8 +69,8 @@ jobs: - name: Set Env Vars run: | - issueNumber=$(cat ./learning-path-update/issue-number) - echo "issueNumber=$issueNumber" >> $GITHUB_ENV + issueUrl=$(cat ./learning-path-update/issueUrl) + echo "issueUrl=$issueUrl" >> $GITHUB_ENV - name: Open PR uses: ./.github/actions/open-pr @@ -78,7 +78,7 @@ jobs: files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes #${{ env.issueNumber }}. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes ${{ env.issueUrl }}. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 548473668b05f4decd50d2999708bbf8d231b6e9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:32:04 -0800 Subject: [PATCH 123/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index c4df069e3cd..94809af84b8 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -17,14 +17,13 @@ jobs: - name: Generate artifacts run: | mkdir -p ./learning-path-update - echo -n "$COMMENT_URL" > ./learning-path-update/issue-url echo -n "$COMMENT_AUTHOR" > ./learning-path-update/issue-user - echo -n "$ISSUE_NUMBER" > ./learning-path-update/issue-number + echo -n "$ISSUE_URL" > ./learning-path-update/issueUrl env: COMMENT_BODY: ${{ github.event.comment.body }} COMMENT_URL: ${{ github.event.comment.html_url }} COMMENT_AUTHOR: ${{ github.event.comment.user.login }} - ISSUE_NUMBER: ${{ github.event.issue.number }} + ISSUE_URL: ${{ github.event.issue.url }} - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 From bb2c28b140d34ed1873846dedea520ab2703119d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:35:07 -0800 Subject: [PATCH 124/352] Update create-learning-path-update.yml --- .github/workflows/create-learning-path-update.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/create-learning-path-update.yml index 4010d6229af..3b776f37f95 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/create-learning-path-update.yml @@ -69,8 +69,8 @@ jobs: - name: Set Env Vars run: | - issueUrl=$(cat ./learning-path-update/issueUrl) - echo "issueUrl=$issueUrl" >> $GITHUB_ENV + issueNumber=$(cat ./learning-path-update/issueNumber) + echo "issueNumber=$issueNumber" >> $GITHUB_ENV - name: Open PR uses: ./.github/actions/open-pr @@ -78,7 +78,7 @@ jobs: files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} title: "Update Learning Path Links" commit_message: Update Learning Path Links - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes ${{ env.issueUrl }}. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes ${{ env.issueNumber }}. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 13:36:02 -0800 Subject: [PATCH 125/352] Update scan-for-learning-path-update-comments.yml --- .github/workflows/scan-for-learning-path-update-comments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-update-comments.yml index 94809af84b8..3695be1fadc 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-update-comments.yml @@ -18,12 +18,12 @@ jobs: run: | mkdir -p ./learning-path-update echo -n "$COMMENT_AUTHOR" > ./learning-path-update/issue-user - echo -n "$ISSUE_URL" > ./learning-path-update/issueUrl + echo -n "#$ISSUE_NUMBER" > ./learning-path-update/issueNumber env: COMMENT_BODY: ${{ github.event.comment.body }} COMMENT_URL: ${{ github.event.comment.html_url }} COMMENT_AUTHOR: ${{ github.event.comment.user.login }} - ISSUE_URL: ${{ github.event.issue.url }} + ISSUE_NUMBER: ${{ github.event.issue.number }} - name: Upload artifacts uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 From c8d184e0290345d0b794f9bac7e5d113a1a15152 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 24 Jan 2024 21:37:13 +0000 Subject: [PATCH 126/352] Update Learning Path Links --- .github/learning-path-sha.txt | 2 +- documentation/learningPath/api.md | 10 ++-- documentation/learningPath/collectionrules.md | 30 +++++----- documentation/learningPath/configuration.md | 12 ++-- documentation/learningPath/egress.md | 22 ++++---- documentation/learningPath/testing.md | 56 +++++++++---------- 6 files changed, 66 insertions(+), 66 deletions(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 2a9e6ba2e73..41dd1024773 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -386d6a2599c1ea6d99410c04a7f1878503fb0e95 +7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0 \ No newline at end of file diff --git a/documentation/learningPath/api.md b/documentation/learningPath/api.md index 591bb9a0e62..1a3c2d103c1 100644 --- a/documentation/learningPath/api.md +++ b/documentation/learningPath/api.md @@ -7,15 +7,15 @@ dotnet-monitor exposes functionality through both [collection rules](./collectio ## Adding New APIs -The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). +The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). -If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). +If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). When adding a new API, it's important to also update the [`openapi.json`](../openapi.json) spec which describes the API surface. There are CI tests that will ensure this file has been updated to reflect any API changes. Learn more about updating `openapi.json` [here](./testing.md#openapi-generation). ### Adding Tests -Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). +Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). ## Notable Controller Attributes @@ -35,6 +35,6 @@ dotnet-monitor supports multiple different [authentication modes](../authenticat ### Determining Authentication Mode -When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. +When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. -After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. +After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 559d339e59e..eff6ab7282d 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,49 +32,49 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. -* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). -* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). -* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). +* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). +* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters -Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. +Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates -Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). +Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). ### Collection Rule Defaults -Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. +Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. ### Collection Rule API Endpoint -The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. +The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. -Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). +Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/collectionrules). diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 36ef2483b55..bf9867d61a7 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -8,20 +8,20 @@ `dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. -To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). +To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). -Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. +Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. -Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: -* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project +Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: +* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path * Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/ba8c36235943562581b666e74ef07954313eda56/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) ## Keeping Documentation Up-To-Date -Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/configuration). Sections are typically comprised of: +Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/configuration). Sections are typically comprised of: * A brief overview of the feature that is being configured * Configuration samples in all supported formats * A list of properties with descriptions, types, and whether a property is required -Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). +Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index 7854d407045..88c6e258f6e 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -26,11 +26,11 @@ graph LR class ide2 altColor ``` -1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) -1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) -1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) -1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) +1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) +1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) +1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) +1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) ## Distribution and Acquisition Model @@ -41,7 +41,7 @@ There are two versions of the `dotnet-monitor` image being offered: `monitor` an ### Well Known Egress Provider Locations -There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): +There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): - Next to the executing `dotnet-monitor` assembly - SharedConfigDirectory - On Windows, `%ProgramData%\dotnet-monitor` @@ -59,23 +59,23 @@ The distribution/acquisition model for third-party egress providers is determine ### Extension Manifest -All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. +All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. | Name | Required | Type | Description | |---|---|---|---| | `Name` | true | string | The name of the extension (e.g. AzureBlobStorage) that users will use when writing configuration for the egress provider. | | `ExecutableFileName` | false | string | If specified, the executable file (without extension) to be launched when executing the extension; either `AssemblyFileName` or `ExecutableFileName` must be specified. | | `AssemblyFileName` | false | string | If specified, executes the extension using the shared .NET host (e.g. dotnet.exe) with the specified entry point assembly (without extension); either `AssemblyFileName` or `ExecutableFileName` must be specified. | -| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | +| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | ### Configuration Extensions are designed to receive all user configuration through `dotnet monitor` - the extension itself should not rely on any additional configuration sources. -In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. +In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. ### Communicating With Dotnet-Monitor -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L141). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L141). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** -All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L71); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. +All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L71); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index b12017d0771..65e086ca533 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -7,81 +7,81 @@ Tests can be executed with the command line (via [build.cmd](../../Build.cmd) -test), as part of the PR build, or in Visual Studio. Note that because of limited resources in the build pool, tests ran from the command line or in the build pool are serialized. This avoids test failures associated with parallel testing. Visual Studio does not have such restrictions and is best used for individual tests and test investigations. When running from the command line, using the `-testgroup` parameter can be used to limit the amount of tests executed. For example `build.cmd -test -testgroup PR` will run the same tests as the PR build. -The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). +The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). ## Unit Tests -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) -- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) -- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/CollectionRuleActions.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) +- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) +- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/CollectionRuleActions.UnitTests/) Unit test assemblies directly reference types from various dotnet-monitor assemblies. However, since most of dotnet-monitor heavily relies on code injection, there are utility classes to simplify unit test creation. -- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. -- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. +- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. +- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. ## Functional Tests -- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) -- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) +- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) Functional tests are composed of 3 main parts: 1. The test itself, which sets up and validates the results. 1. An instance of dotnet-monitor 1. An instance of an application that is being monitored (from the UnitTestApp assembly) -* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. -* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). -* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). -* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. -* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. +* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. +* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). +* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). +* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. +* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. ## Native/Profiler Tests -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) This test assembly provides a test to make sure the dotnet-monitor profiler can load into a target app. ## Schema Generation -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) -- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Microsoft.Diagnostics.Monitoring.Options) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) +- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options) -Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. -Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. +Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. +Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. ## OpenAPI generation -- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) -These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. +These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. If using VSCode or Codespaces, you can also use the `Regenerate openapi.json` task. ## Startup hooks / hosting startup -- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) This assembly is injected into a dotnet-monitor runner (using `DOTNET_STARTUP_HOOKS`) to facilitate Assembly resolution during test runs. -- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) Uses `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` to inject a service into dotnet-monitor during test time. This allows tests to locate files that are not normally part of the test deployment, such as the native profiler. -- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) Unit tests around features that are injected via `DOTNET_STARTUP_HOOKS` into the target application. This currently includes the Exceptions History feature. ## Misc test assemblies -- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) +- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) Utility classes that are shared between Unit Tests and Functional Tests. -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/386d6a2599c1ea6d99410c04a7f1878503fb0e95/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. From 5071b6fcc7a2bfe0b211c4c839ef239e7e664465 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:20:00 -0800 Subject: [PATCH 127/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index cf8f733f7df..378493d6caa 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -61,7 +61,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Check

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}" + body="# Learning Paths Staleness Report
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manualy.

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}" gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 47685e769682c16ae91866e2bbede80e5081f921 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:25:47 -0800 Subject: [PATCH 128/352] Update EgressHelper.cs --- .../EgressHelper.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..8668882ba38 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -44,6 +44,10 @@ public static CliCommand CreateEgressCommand(Action Egress(Action configureServices, CancellationToken token) where TProvider : EgressProvider From 09fce4616c9aed63504e9e537120373a020f39a3 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:28:58 -0800 Subject: [PATCH 129/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 378493d6caa..5291ef4ba01 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -61,7 +61,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Report
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manualy.

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}" + body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From da10a90a4f946c3a50dd8d4d0070181953b0f6d5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:56:49 -0800 Subject: [PATCH 130/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a42d0c97de9..2e15622514b 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -31,6 +31,13 @@ jobs: fetch-depth: 0 # Fetch the entire repo for the below git operations path: head + - name: Get current SHA + id: get_new_sha + run: | + new_sha=$(git rev-parse HEAD) + echo "new_sha=$new_sha" >> $GITHUB_ENV + echo "Writing new_sha into GitHub Env: $new_sha" + - name: Get previous update SHA id: get_sha working-directory: ./head @@ -64,6 +71,8 @@ jobs: learningPathsDirectory: 'documentation/learningPath' changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' + oldHash: ${{ env.prev_sha }} + newHash: ${{ env.new_sha }} - name: Generate artifacts (Comment) working-directory: ./head From c3d2182f060fbcc793719d18aa77e161c31c2195 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:57:49 -0800 Subject: [PATCH 131/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 2e15622514b..496db5d3716 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -24,6 +24,7 @@ jobs: steps: - name: Checkout head + working-directory: ./head uses: actions/checkout@v4 with: persist-credentials: true From 8459ff7e12630f5a8ff136970666403fe57974b1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 24 Jan 2024 14:59:54 -0800 Subject: [PATCH 132/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 496db5d3716..0b43525e82c 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -24,7 +24,6 @@ jobs: steps: - name: Checkout head - working-directory: ./head uses: actions/checkout@v4 with: persist-credentials: true @@ -34,6 +33,7 @@ jobs: - name: Get current SHA id: get_new_sha + working-directory: ./head run: | new_sha=$(git rev-parse HEAD) echo "new_sha=$new_sha" >> $GITHUB_ENV From 333417e2a67854611e2b645066305e01c76e0465 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:34:48 -0800 Subject: [PATCH 133/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 5291ef4ba01..1076c55eeb6 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -61,7 +61,7 @@ jobs: suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." + body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}

Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 20959a2fe80f116dfece3b5ce222b7c2b5654419 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:07:40 -0800 Subject: [PATCH 134/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 0b43525e82c..9acbecd9331 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -82,6 +82,7 @@ jobs: echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions + echo -n "${{ steps.check-links.outputs.outOfSync }}" > ./learning-path-review/outOfSync echo -n "[BOT] Learning Path Update" > ./learning-path-review/issue-title - name: Upload artifacts (Comment) From 4af46e77a8ef28ba74836d9f8272bab916fdf181 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:09:34 -0800 Subject: [PATCH 135/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 1076c55eeb6..9e8552c1282 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -47,9 +47,11 @@ jobs: modifiedFiles=$(cat ./learning-path-review/modifiedFiles) manuallyReview=$(cat ./learning-path-review/manuallyReview) suggestions=$(cat ./learning-path-review/suggestions) + outOfSync=$(cat ./learning-path-review/outOfSync) echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV echo "suggestions=$suggestions" >> $GITHUB_ENV + echo "outOfSync=$outOfSync" >> $GITHUB_ENV - name: Submit Issue if: ${{ env.modifiedFiles != '' }} @@ -57,14 +59,17 @@ jobs: title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) manuallyReview=${manuallyReview//,/
} + outOfSync=$(cat ./learning-path-review/outOfSync) + outOfSync=${outOfSync//,/
} suggestions=$(cat ./learning-path-review/suggestions) suggestions=${suggestions//,/
} modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Suggestions:

${suggestions}

Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." + body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Out Of Sync:

${outOfSync}

Suggestions:

${suggestions}

Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MODIFIED_FILES: ${{ env.modifiedFiles }} MANUALLY_REVIEW: ${{ env.manuallyReview }} SUGGESTIONS: ${{ env.suggestions }} + OUTOFSYNC: ${{ env.outOfSync }} From bd48ba2b962eb1b8bbe485bcb83adc2165939368 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:11:16 -0800 Subject: [PATCH 136/352] Update configuration.md --- documentation/learningPath/configuration.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index bf9867d61a7..d3ee3b352d6 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -25,3 +25,7 @@ Our configuration is primarily documented [here](https://github.com/dotnet/dotne * A list of properties with descriptions, types, and whether a property is required Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). + +## TESTING ONLY + +This is a link that erroneously points to main, instead of the designated hash [here](https://github.com/dotnet/dotnet-monitor/tree/main/documentation/configuration). From 2005c6e5f17b3f9f34b36e308f00d039e3e2b3e4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:26:46 -0800 Subject: [PATCH 137/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 9acbecd9331..7f45e2bb40a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -74,6 +74,7 @@ jobs: sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} + excludeLinks: "documentation,samples,github.com/dotnet/dotnet-monitor/pull" - name: Generate artifacts (Comment) working-directory: ./head From 795d63ab22e2bcb5a4437c2ac36bceffaa4c70fa Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:46:09 -0800 Subject: [PATCH 138/352] Update architecture.md --- documentation/learningPath/architecture.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/documentation/learningPath/architecture.md b/documentation/learningPath/architecture.md index cdaa40cb3d4..38476ca861c 100644 --- a/documentation/learningPath/architecture.md +++ b/documentation/learningPath/architecture.md @@ -2,10 +2,3 @@ ### Was this documentation helpful? [Share feedback](https://www.research.net/r/DGDQWXH?src=documentation%2FlearningPath%2Farchitecture) # Architecture -This is a test of a deleted [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/OutputFormat.cs). - -This is a test of a shifted line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L20). - -This is a test of a removed line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L1). - -This is a test of an ambiguous line [file](https://github.com/dotnet/dotnet-monitor/blob/v7.0.1/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs#L16). From a9c2888cd036419ff550857f652c7d095e8d4c6b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:47:04 -0800 Subject: [PATCH 139/352] Update configuration.md --- documentation/learningPath/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index d3ee3b352d6..97cf6a220df 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -6,7 +6,7 @@ ## How Configuration Works -`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/ba8c36235943562581b666e74ef07954313eda56/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. +`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). From 0a6fbf874307aeafc1130a8dbe298e86fc40d1b8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:47:28 -0800 Subject: [PATCH 140/352] Update configuration.md --- documentation/learningPath/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 97cf6a220df..dbe2f8b5cde 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -15,7 +15,7 @@ Once configuration has been merged, any singletons that have been added to the ` Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: * Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path -* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/ba8c36235943562581b666e74ef07954313eda56/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) +* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) ## Keeping Documentation Up-To-Date From a9118706d8dfeffcd8a98555ff27415c642f7c85 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:48:28 -0800 Subject: [PATCH 141/352] Update aks.md --- documentation/learningPath/aks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/aks.md b/documentation/learningPath/aks.md index 0bb619da2e2..a7673374e06 100644 --- a/documentation/learningPath/aks.md +++ b/documentation/learningPath/aks.md @@ -9,7 +9,7 @@ In addition to its availability as a .NET CLI tool, the `dotnet monitor` tool is 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. +1. Open `pwsh` and run the [generate-dev-sln script](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/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. From 13fd70387594bbf4c5188e62c7ca0056b1ce5f9b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:52:59 -0800 Subject: [PATCH 142/352] Rename EgressHelper.cs to EgressHelperTEMP.cs --- .../{EgressHelper.cs => EgressHelperTEMP.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Microsoft.Diagnostics.Monitoring.Extension.Common/{EgressHelper.cs => EgressHelperTEMP.cs} (100%) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelperTEMP.cs similarity index 100% rename from src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs rename to src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelperTEMP.cs From 30b794e859cb34e4edc6fbd1ab18e9d1911a350c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:55:41 -0800 Subject: [PATCH 143/352] Rename EgressHelperTEMP.cs to EgressHelper.cs --- .../{EgressHelperTEMP.cs => EgressHelper.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/Microsoft.Diagnostics.Monitoring.Extension.Common/{EgressHelperTEMP.cs => EgressHelper.cs} (100%) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelperTEMP.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs similarity index 100% rename from src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelperTEMP.cs rename to src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs From 47e7c801724871d1a83dfbfe03428acf1e518a5d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:46:45 -0800 Subject: [PATCH 144/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 7f45e2bb40a..4f55ed4369a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,25 +1,19 @@ name: 'Check Learning Path Links' on: workflow_dispatch: - inputs: - baselineTag: - description: 'Baseline Release Tag Override' - required: false - type: string # schedule: # Run once a week. # - cron: '0 0 * * 1' # workflow_dispatch: -permissions: - contents: write - issues: write - pull-requests: write +permissions: {} jobs: check-learning-path-links: name: 'Check Learning Path Links' runs-on: ubuntu-latest + permissions: + issues: write steps: From 6b9d0617e07ff7374f62e2de97b42b2ed9395575 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:49:08 -0800 Subject: [PATCH 145/352] Update submit-stale-learning-path-issue.yml --- .../submit-stale-learning-path-issue.yml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index 9e8552c1282..ce3621ff8da 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -42,17 +42,6 @@ jobs: name: learning-path-review path: ./learning-path-review - - name: Set Env Vars - run: | - modifiedFiles=$(cat ./learning-path-review/modifiedFiles) - manuallyReview=$(cat ./learning-path-review/manuallyReview) - suggestions=$(cat ./learning-path-review/suggestions) - outOfSync=$(cat ./learning-path-review/outOfSync) - echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV - echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV - echo "suggestions=$suggestions" >> $GITHUB_ENV - echo "outOfSync=$outOfSync" >> $GITHUB_ENV - - name: Submit Issue if: ${{ env.modifiedFiles != '' }} run: | @@ -67,9 +56,3 @@ jobs: modifiedFiles=${modifiedFiles//,/
} body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Out Of Sync:

${outOfSync}

Suggestions:

${suggestions}

Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MODIFIED_FILES: ${{ env.modifiedFiles }} - MANUALLY_REVIEW: ${{ env.manuallyReview }} - SUGGESTIONS: ${{ env.suggestions }} - OUTOFSYNC: ${{ env.outOfSync }} From afdd7c07c4f8184113196c46328d1b570fbed2bc Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:52:08 -0800 Subject: [PATCH 146/352] Delete .github/workflows/submit-learning-paths-staleness-check.yml --- .../submit-learning-paths-staleness-check.yml | 101 ------------------ 1 file changed, 101 deletions(-) delete mode 100644 .github/workflows/submit-learning-paths-staleness-check.yml diff --git a/.github/workflows/submit-learning-paths-staleness-check.yml b/.github/workflows/submit-learning-paths-staleness-check.yml deleted file mode 100644 index 0b86cf3b144..00000000000 --- a/.github/workflows/submit-learning-paths-staleness-check.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: 'Submit Learning Paths Staleness Check' - -on: - workflow_run: - workflows: ["Check Learning Path Links"] - types: - - completed - -permissions: - contents: write - issues: write - pull-requests: write - -jobs: - submit-learning-paths-staleness-check: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - permissions: - contents: write - issues: write - pull-requests: write - - steps: - - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 - id: check-user - with: - script: | - await github.rest.repos.checkCollaborator({ - owner: context.repo.owner, - repo: context.repo.repo, - username: context.payload.workflow_run.triggering_actor.login - }); - - - name: Checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - with: - persist-credentials: true - - # Download the artifact from the workflow that kicked off this one. - # The default artifact download action doesn't support cross-workflow - # artifacts, so use a 3rd party one. - - name: 'Download linting results' - uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 - with: - workflow: ${{env.workflow_name}} - run_id: ${{github.event.workflow_run.id }} - name: learning-path-review - path: ./learning-path-review - - - name: Set Env Vars - run: | - modifiedFiles=$(cat ./learning-path-review/modifiedFiles) - manuallyReview=$(cat ./learning-path-review/manuallyReview) - suggestions=$(cat ./learning-path-review/suggestions) - echo "modifiedFiles=$modifiedFiles" >> $GITHUB_ENV - echo "manuallyReview=$manuallyReview" >> $GITHUB_ENV - echo "suggestions=$suggestions" >> $GITHUB_ENV - - - uses: actions/github-script@v6 - name: Check For Duplicate Before Creating Comment - if: ${{ env.modifiedFiles != '' }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MODIFIED_FILES: ${{ env.modifiedFiles }} - MANUALLY_REVIEW: ${{ env.manuallyReview }} - SUGGESTIONS: ${{ env.suggestions }} - with: - script: | - modifiedFiles = process.env.MODIFIED_FILES; - manuallyReview = process.env.MANUALLY_REVIEW; - suggestions = process.env.SUGGESTIONS; - comment_body = "### Learning Paths Staleness Check \n\n #### Impacted Paths:\n\n" + modifiedFiles.replaceAll(",", "\n") + "\n\n---------\n\n #### Manually Review:\n\n" + manuallyReview.replaceAll(",", "\n") + "\n\n---------\n\n #### Suggestions:\n\n" + suggestions.replaceAll(",", "\n"); - - const comments = await github.rest.issues.listComments({ - issue_number: context.payload.workflow_run.pull_requests[0].number, - owner: context.repo.owner, - repo: context.repo.repo - }) - - var commentExists = false; - - const new_comment_stripped = comment_body.replaceAll(/\s/g,'') - - for (const comment of comments.data) { - const old_comment_stripped = comment.body.replaceAll(/\s/g,'') - - if (old_comment_stripped === new_comment_stripped) { - commentExists = true; - console.log("Match!"); - } - } - - if (!commentExists) - { - github.rest.issues.createComment({ - issue_number: context.payload.workflow_run.pull_requests[0].number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment_body - }) - } From 7ee6f162bd062ecbf6dd87256b0aefd1e7e387e6 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:52:18 -0800 Subject: [PATCH 147/352] Delete .github/workflows/check-learning-path-links-anchor.yml --- .../check-learning-path-links-anchor.yml | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 .github/workflows/check-learning-path-links-anchor.yml diff --git a/.github/workflows/check-learning-path-links-anchor.yml b/.github/workflows/check-learning-path-links-anchor.yml deleted file mode 100644 index c40626e101a..00000000000 --- a/.github/workflows/check-learning-path-links-anchor.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: 'Check Learning Path Links' -on: - pull_request: - branches: ['main'] - -permissions: - pull-requests: read - -jobs: - check-learning-path-links: - if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) - name: 'Check Learning Path Links' - runs-on: ubuntu-latest - - steps: - - name: Checkout merge - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - with: - persist-credentials: false - path: merge - - - name: Checkout head - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac - with: - persist-credentials: false - ref: main - path: head - - - name: Get base commit for the PR - working-directory: ./merge - run: | - git fetch origin "$GITHUB_BASE_REF" - base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF") - echo "base_sha=$base_sha" >> $GITHUB_ENV - echo "Merging ${GITHUB_SHA} into ${GITHUB_BASE_REF}" - - - name: Get changed files - working-directory: ./merge - run: | - changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$base_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) - echo "Files to validate: '${changed_source_files}'" - - - name: Check Learning Path Links Anchor - id: check-links - uses: kkeirstead/LearningPathFileChecks-Anchor@master - with: - learningPathsDirectory: 'documentation/learningPath' From d74672e1df5fc47736a28c810b3bd4cdd83cf822 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:54:00 -0800 Subject: [PATCH 148/352] Update submit-stale-learning-path-issue.yml --- .github/workflows/submit-stale-learning-path-issue.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index ce3621ff8da..e09f84f5482 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -43,7 +43,6 @@ jobs: path: ./learning-path-review - name: Submit Issue - if: ${{ env.modifiedFiles != '' }} run: | title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) From 17808f2f99f3dbc562dbf7b86df86b6bb12b2c0f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:02:45 -0800 Subject: [PATCH 149/352] Update submit-stale-learning-path-issue.yml --- .../submit-stale-learning-path-issue.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-stale-learning-path-issue.yml index e09f84f5482..dee7d971843 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-stale-learning-path-issue.yml @@ -47,11 +47,27 @@ jobs: title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) manuallyReview=${manuallyReview//,/
} + manuallyReviewSection="

Manually Review:

${manuallyReview}
" + if test -z "$manuallyReview"; then + manuallyReviewSection="" + fi outOfSync=$(cat ./learning-path-review/outOfSync) outOfSync=${outOfSync//,/
} + outOfSyncSection="

Out Of Sync:

${outOfSync}
" + if test -z "$outOfSync"; then + outOfSyncSection="" + fi suggestions=$(cat ./learning-path-review/suggestions) suggestions=${suggestions//,/
} + suggestionsSection="

Suggestions:

${suggestions}
" + if test -z "$suggestions"; then + suggestionsSection="" + fi modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - body="# Learning Paths Staleness Report

Impacted Paths:

${modifiedFiles}

Manually Review:

${manuallyReview}

Out Of Sync:

${outOfSync}

Suggestions:

${suggestions}

Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." + modifiedFilesSection="

Suggestions:

${modifiedFiles}
" + if test -z "$modifiedFiles"; then + modifiedFilesSection="" + fi + body="# Learning Paths Staleness Report
${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" From b32edc14eef9564b2fbe94c48fec8430a1a9cfb9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:07:03 -0800 Subject: [PATCH 150/352] Update and rename submit-stale-learning-path-issue.yml to submit-learning-path-issue.yml --- ...learning-path-issue.yml => submit-learning-path-issue.yml} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename .github/workflows/{submit-stale-learning-path-issue.yml => submit-learning-path-issue.yml} (96%) diff --git a/.github/workflows/submit-stale-learning-path-issue.yml b/.github/workflows/submit-learning-path-issue.yml similarity index 96% rename from .github/workflows/submit-stale-learning-path-issue.yml rename to .github/workflows/submit-learning-path-issue.yml index dee7d971843..8cebf2494d2 100644 --- a/.github/workflows/submit-stale-learning-path-issue.yml +++ b/.github/workflows/submit-learning-path-issue.yml @@ -1,4 +1,4 @@ -name: 'Stale Learning Path Issue' +name: 'Submit Learning Path Issue' on: workflow_run: @@ -71,3 +71,5 @@ jobs: fi body="# Learning Paths Staleness Report
${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." gh issue create --label "learning-path-update" --title "$title" --body "$body" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3a74409e483dadb01400d356cf359274f4eafb2a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:11:21 -0800 Subject: [PATCH 151/352] Update and rename scan-for-learning-path-update-comments.yml to scan-for-learning-path-comments.yml --- ...pdate-comments.yml => scan-for-learning-path-comments.yml} | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename .github/workflows/{scan-for-learning-path-update-comments.yml => scan-for-learning-path-comments.yml} (71%) diff --git a/.github/workflows/scan-for-learning-path-update-comments.yml b/.github/workflows/scan-for-learning-path-comments.yml similarity index 71% rename from .github/workflows/scan-for-learning-path-update-comments.yml rename to .github/workflows/scan-for-learning-path-comments.yml index 3695be1fadc..57e7b438cb5 100644 --- a/.github/workflows/scan-for-learning-path-update-comments.yml +++ b/.github/workflows/scan-for-learning-path-comments.yml @@ -11,7 +11,7 @@ permissions: jobs: scan-for-learning-path-update-comments: - if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + if: github.event.comment.body == '👍' && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts @@ -20,8 +20,6 @@ jobs: echo -n "$COMMENT_AUTHOR" > ./learning-path-update/issue-user echo -n "#$ISSUE_NUMBER" > ./learning-path-update/issueNumber env: - COMMENT_BODY: ${{ github.event.comment.body }} - COMMENT_URL: ${{ github.event.comment.html_url }} COMMENT_AUTHOR: ${{ github.event.comment.user.login }} ISSUE_NUMBER: ${{ github.event.issue.number }} From e343e69d658841a333b9f3af79217b1864433d45 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:11:40 -0800 Subject: [PATCH 152/352] Update scan-for-learning-path-comments.yml --- .github/workflows/scan-for-learning-path-comments.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan-for-learning-path-comments.yml b/.github/workflows/scan-for-learning-path-comments.yml index 57e7b438cb5..68a58e65da8 100644 --- a/.github/workflows/scan-for-learning-path-comments.yml +++ b/.github/workflows/scan-for-learning-path-comments.yml @@ -1,4 +1,4 @@ -name: Scan For Learning Path Update Comments +name: Scan For Learning Path Comments on: pull_request_review_comment: types: [created] From 6656e648bea6f6c55330dd15eb71b4984507acb9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:14:41 -0800 Subject: [PATCH 153/352] Update and rename create-learning-path-update.yml to submit-learning-path-pr.yml --- ...update.yml => submit-learning-path-pr.yml} | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) rename .github/workflows/{create-learning-path-update.yml => submit-learning-path-pr.yml} (79%) diff --git a/.github/workflows/create-learning-path-update.yml b/.github/workflows/submit-learning-path-pr.yml similarity index 79% rename from .github/workflows/create-learning-path-update.yml rename to .github/workflows/submit-learning-path-pr.yml index 3b776f37f95..3440e6d5789 100644 --- a/.github/workflows/create-learning-path-update.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -1,24 +1,17 @@ -name: 'Create Learning Path Update' -run-name: '[${{ github.ref_name }}] Create Learning Path Update' +name: 'Submit Learning Path PR' +run-name: '[${{ github.ref_name }}] Submit Learning Path PR' on: workflow_run: - workflows: ["Scan For Learning Path Update Comments"] + workflows: ["Scan For Learning Path Comments"] types: - completed - # workflow_dispatch: - # inputs: - # baselineTag: - # description: 'Baseline Release Tag Override' - # required: false - # type: string - permissions: {} jobs: - create-learning-path-update-pr: - name: 'Create Learning Path Update' + submit-learning-path-pr: + name: 'Submit Learning Path PR' runs-on: ubuntu-latest permissions: contents: write @@ -48,7 +41,7 @@ jobs: cd ../ - name: Update Learning Path Hashes - id: update-links + id: update-hashes uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' @@ -75,9 +68,9 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.update-links.outputs.modifiedFiles }} - title: "Update Learning Path Links" - commit_message: Update Learning Path Links + files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} + title: "Update Learning Paths" + commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes ${{ env.issueNumber }}. branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true From 944656cc5fb33bb59318e32026a92d3c5eb6a6a5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:15:02 -0800 Subject: [PATCH 154/352] Update scan-for-learning-path-comments.yml --- .github/workflows/scan-for-learning-path-comments.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/scan-for-learning-path-comments.yml b/.github/workflows/scan-for-learning-path-comments.yml index 68a58e65da8..7724a3296cf 100644 --- a/.github/workflows/scan-for-learning-path-comments.yml +++ b/.github/workflows/scan-for-learning-path-comments.yml @@ -17,10 +17,8 @@ jobs: - name: Generate artifacts run: | mkdir -p ./learning-path-update - echo -n "$COMMENT_AUTHOR" > ./learning-path-update/issue-user echo -n "#$ISSUE_NUMBER" > ./learning-path-update/issueNumber env: - COMMENT_AUTHOR: ${{ github.event.comment.user.login }} ISSUE_NUMBER: ${{ github.event.issue.number }} - name: Upload artifacts From 90551b9d81cd8c1e686ea8d0de510782e0aadb06 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:15:47 -0800 Subject: [PATCH 155/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index 3440e6d5789..a9e7323ed62 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -29,7 +29,6 @@ jobs: run: | new_sha=$(git rev-parse HEAD) echo "new_sha=$new_sha" >> $GITHUB_ENV - echo "Writing new_sha into GitHub Env: $new_sha" - name: Get previous update SHA id: get_prev_sha @@ -37,7 +36,6 @@ jobs: cd .github prev_sha=$(cat learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV - echo "Writing prev_sha into GitHub Env: $prev_sha" cd ../ - name: Update Learning Path Hashes From 3e4b077866ae99e092109c5f70920d5834f5be59 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:17:30 -0800 Subject: [PATCH 156/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 4f55ed4369a..689eabe041d 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -31,7 +31,6 @@ jobs: run: | new_sha=$(git rev-parse HEAD) echo "new_sha=$new_sha" >> $GITHUB_ENV - echo "Writing new_sha into GitHub Env: $new_sha" - name: Get previous update SHA id: get_sha @@ -40,7 +39,6 @@ jobs: cd .github prev_sha=$(cat learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV - echo "Writing prev_sha into GitHub Env: $prev_sha" cd ../ - name: Checkout previous update From 404b484a459ce775e729285cb083d0212218c93d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:19:19 -0800 Subject: [PATCH 157/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 689eabe041d..8c5828279ba 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -66,7 +66,6 @@ jobs: sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} - excludeLinks: "documentation,samples,github.com/dotnet/dotnet-monitor/pull" - name: Generate artifacts (Comment) working-directory: ./head From f45983f595d91bb588b7fac08b6dafa93fbb84f0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:26:35 -0800 Subject: [PATCH 158/352] Update configuration.md --- documentation/learningPath/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index dbe2f8b5cde..bf05c6dbbf1 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -28,4 +28,4 @@ Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/b ## TESTING ONLY -This is a link that erroneously points to main, instead of the designated hash [here](https://github.com/dotnet/dotnet-monitor/tree/main/documentation/configuration). +This is a link that erroneously points to main, instead of the designated hash [here]((https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L8). From da4874b1d685cb1c371c9152a33329a2ff97dc50 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:29:20 -0800 Subject: [PATCH 159/352] Update submit-learning-path-issue.yml --- .github/workflows/submit-learning-path-issue.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/submit-learning-path-issue.yml b/.github/workflows/submit-learning-path-issue.yml index 8cebf2494d2..f1f581042d1 100644 --- a/.github/workflows/submit-learning-path-issue.yml +++ b/.github/workflows/submit-learning-path-issue.yml @@ -53,7 +53,7 @@ jobs: fi outOfSync=$(cat ./learning-path-review/outOfSync) outOfSync=${outOfSync//,/
} - outOfSyncSection="

Out Of Sync:

${outOfSync}
" + outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" if test -z "$outOfSync"; then outOfSyncSection="" fi @@ -65,7 +65,7 @@ jobs: fi modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} - modifiedFilesSection="

Suggestions:

${modifiedFiles}
" + modifiedFilesSection="

Modified Files:

${modifiedFiles}
" if test -z "$modifiedFiles"; then modifiedFilesSection="" fi From c8e72b6804c8218e0d9f8a8a5c14705d73fefacb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:42:53 -0800 Subject: [PATCH 160/352] Update scan-for-learning-path-comments.yml --- .github/workflows/scan-for-learning-path-comments.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scan-for-learning-path-comments.yml b/.github/workflows/scan-for-learning-path-comments.yml index 7724a3296cf..3cace5f1df1 100644 --- a/.github/workflows/scan-for-learning-path-comments.yml +++ b/.github/workflows/scan-for-learning-path-comments.yml @@ -11,7 +11,7 @@ permissions: jobs: scan-for-learning-path-update-comments: - if: github.event.comment.body == '👍' && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) runs-on: ubuntu-latest steps: - name: Generate artifacts From 96dcc63b02b30380c1dd567bc2174864c4412032 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 12:49:38 -0800 Subject: [PATCH 161/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 71 ++++++++++++++----- 1 file changed, 54 insertions(+), 17 deletions(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index a9e7323ed62..d105ee26c00 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -3,7 +3,7 @@ run-name: '[${{ github.ref_name }}] Submit Learning Path PR' on: workflow_run: - workflows: ["Scan For Learning Path Comments"] + workflows: ["Check Learning Path Links"] types: - completed @@ -18,6 +18,16 @@ jobs: pull-requests: write steps: + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + id: check-user + with: + script: | + await github.rest.repos.checkCollaborator({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.workflow_run.triggering_actor.login + }); + - name: Checkout main uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: @@ -38,15 +48,6 @@ jobs: echo "prev_sha=$prev_sha" >> $GITHUB_ENV cd ../ - - name: Update Learning Path Hashes - id: update-hashes - uses: kkeirstead/UpdateLearningPathCommitHashes@main - with: - learningPathsDirectory: 'documentation/learningPath' - learningPathHashFile: '.github/learning-path-sha.txt' - oldHash: ${{ env.prev_sha }} - newHash: ${{ env.new_sha }} - # Download the artifact from the workflow that kicked off this one. # The default artifact download action doesn't support cross-workflow # artifacts, so use a 3rd party one. @@ -55,21 +56,57 @@ jobs: with: workflow: ${{env.workflow_name}} run_id: ${{github.event.workflow_run.id }} - name: learning-path-update - path: ./learning-path-update + name: learning-path-review + path: ./learning-path-review + + - name: Update Learning Path Hashes + id: update-hashes + uses: kkeirstead/UpdateLearningPathCommitHashes@main + with: + learningPathsDirectory: 'documentation/learningPath' + learningPathHashFile: '.github/learning-path-sha.txt' + oldHash: ${{ env.prev_sha }} + newHash: ${{ env.new_sha }} - - name: Set Env Vars + - name: Create PR Body run: | - issueNumber=$(cat ./learning-path-update/issueNumber) - echo "issueNumber=$issueNumber" >> $GITHUB_ENV + title=$(cat ./learning-path-review/issue-title) + manuallyReview=$(cat ./learning-path-review/manuallyReview) + manuallyReview=${manuallyReview//,/
} + manuallyReviewSection="

Manually Review:

${manuallyReview}
" + if test -z "$manuallyReview"; then + manuallyReviewSection="" + fi + outOfSync=$(cat ./learning-path-review/outOfSync) + outOfSync=${outOfSync//,/
} + outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" + if test -z "$outOfSync"; then + outOfSyncSection="" + fi + suggestions=$(cat ./learning-path-review/suggestions) + suggestions=${suggestions//,/
} + suggestionsSection="

Suggestions:

${suggestions}
" + if test -z "$suggestions"; then + suggestionsSection="" + fi + modifiedFiles=$(cat ./learning-path-review/modifiedFiles) + modifiedFiles=${modifiedFiles//,/
} + modifiedFilesSection="

Modified Files:

${modifiedFiles}
" + if test -z "$modifiedFiles"; then + modifiedFilesSection="" + fi + body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." + echo "body=$body" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Open PR uses: ./.github/actions/open-pr with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} - title: "Update Learning Paths" + title: "[DO NOT MERGE WITHOUT MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
Closes ${{ env.issueNumber }}. + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.

${{ env.body }} branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 885ade7c4b6f06a5fa06d0b6cbd1de4c3fa2056a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 12:58:27 -0800 Subject: [PATCH 162/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index d105ee26c00..8ec59c9dc43 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -59,12 +59,18 @@ jobs: name: learning-path-review path: ./learning-path-review + - name: Put Suggestions In Env Var + run: | + suggestions=$(cat ./learning-path-review/suggestions) + echo "suggestions=$suggestions" >> $GITHUB_ENV + - name: Update Learning Path Hashes id: update-hashes uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' + suggestions: ${{ env.suggestions }} oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} From e4a746565fa91107e91197ff9e61f2e5ff111f10 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:31:33 -0800 Subject: [PATCH 163/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index 8ec59c9dc43..9be194e9373 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -91,7 +91,7 @@ jobs: fi suggestions=$(cat ./learning-path-review/suggestions) suggestions=${suggestions//,/
} - suggestionsSection="

Suggestions:

${suggestions}
" + suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" if test -z "$suggestions"; then suggestionsSection="" fi @@ -101,7 +101,7 @@ jobs: if test -z "$modifiedFiles"; then modifiedFilesSection="" fi - body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." + body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" echo "body=$body" >> $GITHUB_ENV env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -110,9 +110,9 @@ jobs: uses: ./.github/actions/open-pr with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} - title: "[DO NOT MERGE WITHOUT MANUAL REVIEW] Update Learning Paths" + title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.

${{ env.body }} + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 63a4315847374580ea0f266a52c5fa97ae98f4e2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:39:39 -0800 Subject: [PATCH 164/352] Delete .github/workflows/submit-to-do-issue.yml --- .github/workflows/submit-to-do-issue.yml | 51 ------------------------ 1 file changed, 51 deletions(-) delete mode 100644 .github/workflows/submit-to-do-issue.yml diff --git a/.github/workflows/submit-to-do-issue.yml b/.github/workflows/submit-to-do-issue.yml deleted file mode 100644 index 4732a600536..00000000000 --- a/.github/workflows/submit-to-do-issue.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: 'Submit To Do Issue' - -on: - workflow_run: - workflows: ["Scan For To Do Comments"] - types: - - completed - -permissions: {} - -jobs: - submit-todo-issue: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - permissions: - issues: write - - steps: - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - id: check-user - with: - script: | - await github.rest.repos.checkCollaborator({ - owner: context.repo.owner, - repo: context.repo.repo, - username: context.payload.workflow_run.triggering_actor.login - }); - - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - persist-credentials: false - - # Download the artifact from the workflow that kicked off this one. - # The default artifact download action doesn't support cross-workflow - # artifacts, so use a 3rd party one. - - name: 'Download linting results' - uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d - with: - workflow: ${{env.workflow_name}} - run_id: ${{github.event.workflow_run.id }} - name: issue-todo - path: ./issue-todo - - name: Submit Issue - run: | - title=$(cat ./issue-todo/issue-title) - user=$(cat ./issue-todo/issue-user) - url=$(cat ./issue-todo/issue-url) - gh issue create --label "todo" --assignee "$user" --title "$title" --body "$url" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8a6c1edbaf4a7ea5fe2815d1faf6ac581c0f3dde Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:43:52 -0800 Subject: [PATCH 165/352] Create submit-to-do-issue.yml --- .github/workflows/submit-to-do-issue.yml | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/submit-to-do-issue.yml diff --git a/.github/workflows/submit-to-do-issue.yml b/.github/workflows/submit-to-do-issue.yml new file mode 100644 index 00000000000..2de9ebfe6ac --- /dev/null +++ b/.github/workflows/submit-to-do-issue.yml @@ -0,0 +1,50 @@ +name: 'Submit To Do Issue' + +on: + workflow_run: + workflows: ["Scan For To Do Comments"] + types: + - completed + +permissions: {} + +jobs: + submit-todo-issue: + if: github.event.workflow_run.conclusion == 'success' + runs-on: ubuntu-latest + permissions: + issues: write + + steps: + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea + id: check-user + with: + script: | + await github.rest.repos.checkCollaborator({ + owner: context.repo.owner, + repo: context.repo.repo, + username: context.payload.workflow_run.triggering_actor.login + }); + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + with: + persist-credentials: false + + # Download the artifact from the workflow that kicked off this one. + # The default artifact download action doesn't support cross-workflow + # artifacts, so use a 3rd party one. + - name: 'Download linting results' + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d + with: + workflow: ${{env.workflow_name}} + run_id: ${{github.event.workflow_run.id }} + name: issue-todo + path: ./issue-todo + - name: Submit Issue + run: | + title=$(cat ./issue-todo/issue-title) + user=$(cat ./issue-todo/issue-user) + url=$(cat ./issue-todo/issue-url) + gh issue create --label "todo" --assignee "$user" --title "$title" --body "$url" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 820b7ddfda60f61c0e466b3bf6b7a57cc7188e66 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:44:03 -0800 Subject: [PATCH 166/352] Delete .github/workflows/submit-learning-path-issue.yml --- .../workflows/submit-learning-path-issue.yml | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 .github/workflows/submit-learning-path-issue.yml diff --git a/.github/workflows/submit-learning-path-issue.yml b/.github/workflows/submit-learning-path-issue.yml deleted file mode 100644 index f1f581042d1..00000000000 --- a/.github/workflows/submit-learning-path-issue.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: 'Submit Learning Path Issue' - -on: - workflow_run: - workflows: ["Check Learning Path Links"] - types: - - completed - -permissions: {} - -jobs: - submit-learning-path-issue: - if: github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - permissions: - issues: write - - steps: - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - id: check-user - with: - script: | - await github.rest.repos.checkCollaborator({ - owner: context.repo.owner, - repo: context.repo.repo, - username: context.payload.workflow_run.triggering_actor.login - }); - - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - persist-credentials: false - - # Download the artifact from the workflow that kicked off this one. - # The default artifact download action doesn't support cross-workflow - # artifacts, so use a 3rd party one. - - name: 'Download linting results' - uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d - with: - workflow: ${{env.workflow_name}} - run_id: ${{github.event.workflow_run.id }} - name: learning-path-review - path: ./learning-path-review - - - name: Submit Issue - run: | - title=$(cat ./learning-path-review/issue-title) - manuallyReview=$(cat ./learning-path-review/manuallyReview) - manuallyReview=${manuallyReview//,/
} - manuallyReviewSection="

Manually Review:

${manuallyReview}
" - if test -z "$manuallyReview"; then - manuallyReviewSection="" - fi - outOfSync=$(cat ./learning-path-review/outOfSync) - outOfSync=${outOfSync//,/
} - outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" - if test -z "$outOfSync"; then - outOfSyncSection="" - fi - suggestions=$(cat ./learning-path-review/suggestions) - suggestions=${suggestions//,/
} - suggestionsSection="

Suggestions:

${suggestions}
" - if test -z "$suggestions"; then - suggestionsSection="" - fi - modifiedFiles=$(cat ./learning-path-review/modifiedFiles) - modifiedFiles=${modifiedFiles//,/
} - modifiedFilesSection="

Modified Files:

${modifiedFiles}
" - if test -z "$modifiedFiles"; then - modifiedFilesSection="" - fi - body="# Learning Paths Staleness Report
${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}
Comment a 👍 to open a new PR - commit hashes will be updated automatically, but any other updates must be made manually." - gh issue create --label "learning-path-update" --title "$title" --body "$body" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b2aafd44cb69b554a741625c68f0544f35ee2760 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:04:21 -0800 Subject: [PATCH 167/352] Delete .github/workflows/scan-for-learning-path-comments.yml --- .../scan-for-learning-path-comments.yml | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/scan-for-learning-path-comments.yml diff --git a/.github/workflows/scan-for-learning-path-comments.yml b/.github/workflows/scan-for-learning-path-comments.yml deleted file mode 100644 index 3cace5f1df1..00000000000 --- a/.github/workflows/scan-for-learning-path-comments.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Scan For Learning Path Comments -on: - pull_request_review_comment: - types: [created] - issue_comment: - types: [created] - -permissions: - pull-requests: read - issues: read - -jobs: - scan-for-learning-path-update-comments: - if: startsWith(github.event.comment.body, '👍') && github.event.issue.title == '[BOT] Learning Path Update' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) - runs-on: ubuntu-latest - steps: - - name: Generate artifacts - run: | - mkdir -p ./learning-path-update - echo -n "#$ISSUE_NUMBER" > ./learning-path-update/issueNumber - env: - ISSUE_NUMBER: ${{ github.event.issue.number }} - - - name: Upload artifacts - uses: actions/upload-artifact@694cdabd8bdb0f10b2cea11669e1bf5453eed0a6 - with: - name: learning-path-update - path: learning-path-update/ From c198c7227a4bf9c26f80f79965356e23110b02ec Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:06:57 -0800 Subject: [PATCH 168/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 8c5828279ba..448eb91d419 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,11 +1,9 @@ name: 'Check Learning Path Links' on: + schedule: # Run once a week. + - cron: '0/10 * * * *' workflow_dispatch: - # schedule: # Run once a week. - # - cron: '0 0 * * 1' - # workflow_dispatch: - permissions: {} jobs: From e33dfb5bee16a0586cc9cb201253e57231202dad Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:25:18 -0800 Subject: [PATCH 169/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 448eb91d419..b7b870833b9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,8 +1,7 @@ name: 'Check Learning Path Links' on: schedule: # Run once a week. - - cron: '0/10 * * * *' - workflow_dispatch: + - cron: '0/5 * * * *' permissions: {} From e7604005393058330b88552b0087ace27ea15e26 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:31:03 -0800 Subject: [PATCH 170/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index b7b870833b9..bb78ff53e6a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,7 +1,8 @@ name: 'Check Learning Path Links' on: - schedule: # Run once a week. - - cron: '0/5 * * * *' + schedule: # Run once a week + - cron: '0 0 * * 1' + workflow_dispatch: permissions: {} From 8b93d30e5416242218f731861db1884cb6aafbf5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 26 Jan 2024 22:41:48 +0000 Subject: [PATCH 171/352] Update Learning Paths --- .github/learning-path-sha.txt | 2 +- documentation/learningPath/aks.md | 2 +- documentation/learningPath/api.md | 10 ++-- documentation/learningPath/collectionrules.md | 30 +++++----- documentation/learningPath/configuration.md | 16 +++--- documentation/learningPath/egress.md | 22 ++++---- documentation/learningPath/testing.md | 56 +++++++++---------- 7 files changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 41dd1024773..15e6aee04b7 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0 \ No newline at end of file +e7604005393058330b88552b0087ace27ea15e26 \ No newline at end of file diff --git a/documentation/learningPath/aks.md b/documentation/learningPath/aks.md index a7673374e06..fbdab7974b1 100644 --- a/documentation/learningPath/aks.md +++ b/documentation/learningPath/aks.md @@ -9,7 +9,7 @@ In addition to its availability as a .NET CLI tool, the `dotnet monitor` tool is 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/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/generate-dev-sln.ps1), providing a path to your local copy of the diagnostics repo. +1. Open `pwsh` and run the [generate-dev-sln script](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/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. diff --git a/documentation/learningPath/api.md b/documentation/learningPath/api.md index 1a3c2d103c1..3e53b2d8fd2 100644 --- a/documentation/learningPath/api.md +++ b/documentation/learningPath/api.md @@ -7,15 +7,15 @@ dotnet-monitor exposes functionality through both [collection rules](./collectio ## Adding New APIs -The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). +The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). -If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). +If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). When adding a new API, it's important to also update the [`openapi.json`](../openapi.json) spec which describes the API surface. There are CI tests that will ensure this file has been updated to reflect any API changes. Learn more about updating `openapi.json` [here](./testing.md#openapi-generation). ### Adding Tests -Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). +Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). ## Notable Controller Attributes @@ -35,6 +35,6 @@ dotnet-monitor supports multiple different [authentication modes](../authenticat ### Determining Authentication Mode -When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. +When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. -After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. +After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index eff6ab7282d..c41b2e8761e 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,49 +32,49 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. -* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). -* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). -* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). +* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). +* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters -Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. +Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates -Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). +Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). ### Collection Rule Defaults -Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. +Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. ### Collection Rule API Endpoint -The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. +The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. -Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). +Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/documentation/collectionrules). diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index bf05c6dbbf1..0b74a1a4678 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -6,25 +6,25 @@ ## How Configuration Works -`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. +`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. -To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). +To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). -Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. +Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. -Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: -* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project +Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: +* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path -* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) +* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) ## Keeping Documentation Up-To-Date -Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/configuration). Sections are typically comprised of: +Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/documentation/configuration). Sections are typically comprised of: * A brief overview of the feature that is being configured * Configuration samples in all supported formats * A list of properties with descriptions, types, and whether a property is required -Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). +Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). ## TESTING ONLY diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index 88c6e258f6e..5afa4330497 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -26,11 +26,11 @@ graph LR class ide2 altColor ``` -1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) -1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) -1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) -1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) +1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) +1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) +1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) +1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) ## Distribution and Acquisition Model @@ -41,7 +41,7 @@ There are two versions of the `dotnet-monitor` image being offered: `monitor` an ### Well Known Egress Provider Locations -There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): +There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): - Next to the executing `dotnet-monitor` assembly - SharedConfigDirectory - On Windows, `%ProgramData%\dotnet-monitor` @@ -59,23 +59,23 @@ The distribution/acquisition model for third-party egress providers is determine ### Extension Manifest -All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. +All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. | Name | Required | Type | Description | |---|---|---|---| | `Name` | true | string | The name of the extension (e.g. AzureBlobStorage) that users will use when writing configuration for the egress provider. | | `ExecutableFileName` | false | string | If specified, the executable file (without extension) to be launched when executing the extension; either `AssemblyFileName` or `ExecutableFileName` must be specified. | | `AssemblyFileName` | false | string | If specified, executes the extension using the shared .NET host (e.g. dotnet.exe) with the specified entry point assembly (without extension); either `AssemblyFileName` or `ExecutableFileName` must be specified. | -| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | +| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L84)). | ### Configuration Extensions are designed to receive all user configuration through `dotnet monitor` - the extension itself should not rely on any additional configuration sources. -In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. +In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. ### Communicating With Dotnet-Monitor -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L141). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** -All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L71); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. +All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L75); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index 65e086ca533..1b69aebf491 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -7,81 +7,81 @@ Tests can be executed with the command line (via [build.cmd](../../Build.cmd) -test), as part of the PR build, or in Visual Studio. Note that because of limited resources in the build pool, tests ran from the command line or in the build pool are serialized. This avoids test failures associated with parallel testing. Visual Studio does not have such restrictions and is best used for individual tests and test investigations. When running from the command line, using the `-testgroup` parameter can be used to limit the amount of tests executed. For example `build.cmd -test -testgroup PR` will run the same tests as the PR build. -The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). +The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). ## Unit Tests -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) -- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) -- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/CollectionRuleActions.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) +- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) +- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/CollectionRuleActions.UnitTests/) Unit test assemblies directly reference types from various dotnet-monitor assemblies. However, since most of dotnet-monitor heavily relies on code injection, there are utility classes to simplify unit test creation. -- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. -- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. +- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. +- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. ## Functional Tests -- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) -- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) +- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) Functional tests are composed of 3 main parts: 1. The test itself, which sets up and validates the results. 1. An instance of dotnet-monitor 1. An instance of an application that is being monitored (from the UnitTestApp assembly) -* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. -* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). -* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). -* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. -* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. +* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. +* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). +* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). +* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. +* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. ## Native/Profiler Tests -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) This test assembly provides a test to make sure the dotnet-monitor profiler can load into a target app. ## Schema Generation -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) -- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Microsoft.Diagnostics.Monitoring.Options) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) +- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options) -Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. -Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. +Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. +Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. ## OpenAPI generation -- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) -These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. +These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. If using VSCode or Codespaces, you can also use the `Regenerate openapi.json` task. ## Startup hooks / hosting startup -- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) This assembly is injected into a dotnet-monitor runner (using `DOTNET_STARTUP_HOOKS`) to facilitate Assembly resolution during test runs. -- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) Uses `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` to inject a service into dotnet-monitor during test time. This allows tests to locate files that are not normally part of the test deployment, such as the native profiler. -- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) Unit tests around features that are injected via `DOTNET_STARTUP_HOOKS` into the target application. This currently includes the Exceptions History feature. ## Misc test assemblies -- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) +- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) Utility classes that are shared between Unit Tests and Functional Tests. -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/7eff2fd94ac2c05455a935d3b38beb5ca38d2ed0/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. From 3b4d5e142ddd1582caf6d4c3fcda09a2eea23815 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:43:25 -0800 Subject: [PATCH 172/352] Update egress.md --- documentation/learningPath/egress.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index 5afa4330497..f5fd7f30f73 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -30,7 +30,7 @@ graph LR 1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) 1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) 1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L81) ## Distribution and Acquisition Model From 88f8a4d2022533f53fc77fa8142f02facc5e72d5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:46:48 -0800 Subject: [PATCH 173/352] Update CollectionRuleOptions.cs --- .../CollectionRules/Options/CollectionRuleOptions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs index 95b8f9562a6..f670f595b97 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs @@ -34,5 +34,7 @@ internal sealed partial class CollectionRuleOptions public CollectionRuleLimitsOptions Limits { get; set; } internal List ErrorList { get; } = new List(); + + public int number = 5; // TESTING ONLY } } From 5d36cc1ac6ad8160ead605343c7a102d2fd20190 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:47:51 -0800 Subject: [PATCH 174/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index c41b2e8761e..733fbfb593e 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,7 +32,7 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L135). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L140). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. * Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). * Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. * The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). From 0ccb077aa77f42bcde0b89d22da606355acdbb1b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:48:15 -0800 Subject: [PATCH 175/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..9ad606d6ed2 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; @@ -139,6 +138,7 @@ public static AuthenticationBuilder ConfigureMonitorApiKeyAuthentication(this IS public static IServiceCollection ConfigureCollectionRules(this IServiceCollection services) { + // TESTING SOME CHANGES services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectDump); services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectExceptions); services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectGCDump); From 508030e444f9873be3387330548d0f70ac822200 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:49:13 -0800 Subject: [PATCH 176/352] Update and rename ConfigShowCommandHandler.cs to ConfigShowCommandHandlerTEST.cs --- ...figShowCommandHandler.cs => ConfigShowCommandHandlerTEST.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/Tools/dotnet-monitor/Commands/{ConfigShowCommandHandler.cs => ConfigShowCommandHandlerTEST.cs} (97%) diff --git a/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs b/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs similarity index 97% rename from src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs rename to src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs index 36954321130..f2973b538ff 100644 --- a/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs +++ b/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs @@ -11,7 +11,7 @@ namespace Microsoft.Diagnostics.Tools.Monitor.Commands { - internal sealed class ConfigShowCommandHandler + internal sealed class ConfigShowCommandHandlerTEST { // Although the "noHttpEgress" parameter is unused, it keeps the entire command parameter set a superset // of the "collect" command so that users can take the same arguments from "collect" and use it on "config show" From be02c3d36d5d4fd7a1a8484449984448df3e3491 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:49:43 -0800 Subject: [PATCH 177/352] Update CollectCommandHandler.cs --- src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs index 6107a1a8eb6..4c8410a4de3 100644 --- a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs +++ b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +// SOME TEST COMMENTS + using Microsoft.AspNetCore.Hosting; using Microsoft.Diagnostics.Monitoring; using Microsoft.Diagnostics.Monitoring.WebApi; From 5dd67fbf15a93b68a775f4e7e12928e7c79dfbb9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:51:16 -0800 Subject: [PATCH 178/352] Update TargetFrameworkMonikerTraitAttribute.cs --- .../TargetFrameworkMonikerTraitAttribute.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs index 9384fe53168..4e17e916413 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs @@ -14,6 +14,7 @@ public class TargetFrameworkMonikerTraitAttribute : { public TargetFrameworkMonikerTraitAttribute(TargetFrameworkMoniker targetFrameworkMoniker) { + int number = 5; // TESTING ONLY } } } From f9510055374c9394805f8fa442ea26c73da9d45d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:53:00 -0800 Subject: [PATCH 179/352] Update testing.md --- documentation/learningPath/testing.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index 1b69aebf491..eff815e7e22 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -85,3 +85,9 @@ Utility classes that are shared between Unit Tests and Functional Tests. - [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. + +TESTING + + +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** + From 47a07b619ce78703ac451d2e64eecde2028fdd8d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:53:54 -0800 Subject: [PATCH 180/352] Update EgressHelper.cs --- .../EgressHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 8668882ba38..0111af69ae1 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -81,6 +81,8 @@ private static async Task Egress(Action Validate(Action configureServices, CancellationToken token) where TProvider : EgressProvider where TOptions : class, new() From 17b1017f72086c874079f7c27f63e270e73b975f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:55:08 -0800 Subject: [PATCH 181/352] Update EgressExtension.cs --- .../dotnet-monitor/Egress/Extension/EgressExtension.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs b/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs index d9f4dcbcd37..b5748c78caf 100644 --- a/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs +++ b/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs @@ -52,6 +52,12 @@ public void AddEnvironmentVariable(string key, string value) _processEnvironmentVariables[key] = value; } + public void MyImportantMethod() + { + // Very important stuff in here. + + } + /// public Task EgressArtifact( string providerName, From df4ec823ba514fb44b9b8c6d46d693ab75d113e7 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:41:14 -0800 Subject: [PATCH 182/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 9ad606d6ed2..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; @@ -138,7 +139,6 @@ public static AuthenticationBuilder ConfigureMonitorApiKeyAuthentication(this IS public static IServiceCollection ConfigureCollectionRules(this IServiceCollection services) { - // TESTING SOME CHANGES services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectDump); services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectExceptions); services.RegisterCollectionRuleAction(KnownCollectionRuleActions.CollectGCDump); From 9da2478fb5dfe0a189e861c11a69b47c4210d5c2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:41:43 -0800 Subject: [PATCH 183/352] Update EgressExtension.cs --- .../dotnet-monitor/Egress/Extension/EgressExtension.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs b/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs index b5748c78caf..d9f4dcbcd37 100644 --- a/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs +++ b/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs @@ -52,12 +52,6 @@ public void AddEnvironmentVariable(string key, string value) _processEnvironmentVariables[key] = value; } - public void MyImportantMethod() - { - // Very important stuff in here. - - } - /// public Task EgressArtifact( string providerName, From b4fb1d61037ed6d6b82653adb1b646e5cca23fd8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:42:13 -0800 Subject: [PATCH 184/352] Update and rename ConfigShowCommandHandlerTEST.cs to ConfigShowCommandHandler.cs --- ...figShowCommandHandlerTEST.cs => ConfigShowCommandHandler.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/Tools/dotnet-monitor/Commands/{ConfigShowCommandHandlerTEST.cs => ConfigShowCommandHandler.cs} (97%) diff --git a/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs b/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs similarity index 97% rename from src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs rename to src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs index f2973b538ff..36954321130 100644 --- a/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandlerTEST.cs +++ b/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs @@ -11,7 +11,7 @@ namespace Microsoft.Diagnostics.Tools.Monitor.Commands { - internal sealed class ConfigShowCommandHandlerTEST + internal sealed class ConfigShowCommandHandler { // Although the "noHttpEgress" parameter is unused, it keeps the entire command parameter set a superset // of the "collect" command so that users can take the same arguments from "collect" and use it on "config show" From 458f303123c0a7660a174652b0a96356d3ece592 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:42:25 -0800 Subject: [PATCH 185/352] Update CollectCommandHandler.cs --- src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs index 4c8410a4de3..6107a1a8eb6 100644 --- a/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs +++ b/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// SOME TEST COMMENTS - using Microsoft.AspNetCore.Hosting; using Microsoft.Diagnostics.Monitoring; using Microsoft.Diagnostics.Monitoring.WebApi; From 9f83714f4f66972add0d0371ef5eab70aa74d6d4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:43:01 -0800 Subject: [PATCH 186/352] Update TargetFrameworkMonikerTraitAttribute.cs --- .../TargetFrameworkMonikerTraitAttribute.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs b/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs index 4e17e916413..9384fe53168 100644 --- a/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs +++ b/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs @@ -14,7 +14,6 @@ public class TargetFrameworkMonikerTraitAttribute : { public TargetFrameworkMonikerTraitAttribute(TargetFrameworkMoniker targetFrameworkMoniker) { - int number = 5; // TESTING ONLY } } } From 0182113664e74059134c87d8a0c37a5b8e58d86b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:49:53 -0800 Subject: [PATCH 187/352] Update CollectionRuleOptions.cs --- .../CollectionRules/Options/CollectionRuleOptions.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs index f670f595b97..95b8f9562a6 100644 --- a/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs +++ b/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs @@ -34,7 +34,5 @@ internal sealed partial class CollectionRuleOptions public CollectionRuleLimitsOptions Limits { get; set; } internal List ErrorList { get; } = new List(); - - public int number = 5; // TESTING ONLY } } From 151a7308ed1bbc85009fe1a57a3463f35d3bf335 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:50:26 -0800 Subject: [PATCH 188/352] Update CollectionRulePipelineState.cs --- .../CollectionRulePipelineState.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs b/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs index ead12b79546..6eea50bc2b0 100644 --- a/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs +++ b/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs @@ -231,7 +231,6 @@ private static void DequeueOldTimestamps(Queue executionTimestamps, Ti } } - # LP 5d8697c3-3ded-43df-a349-4b21207010a6 private static bool CheckForThrottling(int actionCountLimit, TimeSpan? actionCountSWD, int executionTimestampsCount) { return actionCountSWD.HasValue && actionCountLimit <= executionTimestampsCount; From f076b0f63e005ee6cd795f900d250f007b952138 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:51:05 -0800 Subject: [PATCH 189/352] Update EgressHelper.cs --- .../EgressHelper.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 0111af69ae1..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -44,10 +44,6 @@ public static CliCommand CreateEgressCommand(Action Egress(Action configureServices, CancellationToken token) where TProvider : EgressProvider @@ -81,8 +77,6 @@ private static async Task Egress(Action Validate(Action configureServices, CancellationToken token) where TProvider : EgressProvider where TOptions : class, new() From 5e4d90fe221a19b6c0c11ab86341aa590e6139c8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:51:51 -0800 Subject: [PATCH 190/352] Update submit-linter-suggestions.yml --- .github/workflows/submit-linter-suggestions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/submit-linter-suggestions.yml b/.github/workflows/submit-linter-suggestions.yml index 42872d35f42..3dfff591640 100644 --- a/.github/workflows/submit-linter-suggestions.yml +++ b/.github/workflows/submit-linter-suggestions.yml @@ -45,7 +45,6 @@ jobs: run: | echo 'reporter_name=Add Markdown Feedback' >> $GITHUB_ENV echo 'workflow_name=add-markdown-feedback.yml' >> $GITHUB_ENV - # Download the artifact from the workflow that kicked off this one. # The default artifact download action doesn't support cross-workflow # artifacts, so use a 3rd party one. @@ -79,7 +78,7 @@ jobs: -f.diff.strip=1 \ -reporter="github-pr-review" \ -filter-mode="diff_context" \ - -fail-on-error="true" \ + -fail-on-error="false" \ -level="warning" \ < "./pr-linter/linter.diff" env: From 74be50b37bf7cf2274c22f44bb2dbb05a95bb584 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:52:19 -0800 Subject: [PATCH 191/352] Update submit-to-do-issue.yml --- .github/workflows/submit-to-do-issue.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/submit-to-do-issue.yml b/.github/workflows/submit-to-do-issue.yml index 2de9ebfe6ac..4732a600536 100644 --- a/.github/workflows/submit-to-do-issue.yml +++ b/.github/workflows/submit-to-do-issue.yml @@ -25,6 +25,7 @@ jobs: repo: context.repo.repo, username: context.payload.workflow_run.triggering_actor.login }); + - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: From e55607fa0b5265e3ed7ea530dbbfcd86e3294a78 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 07:53:10 -0800 Subject: [PATCH 192/352] Update testing.md --- documentation/learningPath/testing.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index eff815e7e22..1b69aebf491 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -85,9 +85,3 @@ Utility classes that are shared between Unit Tests and Functional Tests. - [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. - -TESTING - - -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** - From c8c2de511b05c4253bae3ab4020230634d402fed Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:18:19 -0800 Subject: [PATCH 193/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index bb78ff53e6a..f0a2d568371 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -14,13 +14,11 @@ jobs: issues: write steps: - - name: Checkout head uses: actions/checkout@v4 with: persist-credentials: true ref: main - fetch-depth: 0 # Fetch the entire repo for the below git operations path: head - name: Get current SHA @@ -49,7 +47,6 @@ jobs: - name: Get changed files working-directory: ./head run: | - # changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV @@ -73,7 +70,6 @@ jobs: echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions echo -n "${{ steps.check-links.outputs.outOfSync }}" > ./learning-path-review/outOfSync - echo -n "[BOT] Learning Path Update" > ./learning-path-review/issue-title - name: Upload artifacts (Comment) uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 From 241194b729269085c0dcc5909454bd3d42753f2d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:26:21 -0800 Subject: [PATCH 194/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index 9be194e9373..9a439f7e43e 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -76,7 +76,6 @@ jobs: - name: Create PR Body run: | - title=$(cat ./learning-path-review/issue-title) manuallyReview=$(cat ./learning-path-review/manuallyReview) manuallyReview=${manuallyReview//,/
} manuallyReviewSection="

Manually Review:

${manuallyReview}
" From dfbe2947910c62decd0f0fcd2cb62a5bb176fc0a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:37:46 -0800 Subject: [PATCH 195/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 733fbfb593e..425b2d9fb12 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -32,49 +32,49 @@ graph LR ### Key Areas Of The Code -* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L140). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. -* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). -* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. -* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). -* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). +* Collection rules are registered [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L140). When adding a new trigger or action, these types need to be added here to take effect. This section is also responsible for making sure options get configured and validated. +* Options for collection rules can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleOptions.cs). +* Rules are applied, removed, and restarted in response to configuration changes [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleService.cs). This is also responsible for generating a description of each collection rule's state for the `/collectionrules` API Endpoint. +* The pipeline responsible for the lifetime of a single executing collection rule can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L54). +* To run collection rules, `dotnet monitor` must be in `Listen` mode - this is set via [DiagnosticPortOptions](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Options/DiagnosticPortOptions.cs). * For each type of trigger, the [dotnet diagnostics repo](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/ITraceEventTrigger.cs#L29) is responsible for determining whether the triggering conditions have been satisfied. ### Triggers -A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. +A trigger will monitor for a specific condition in the target application and raise a notification when that condition has been observed. Options for triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleTriggerOptions.cs); the type of `Settings` is determined by which trigger is being used (possible trigger types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers)). The interface for all triggers can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Triggers/ICollectionRuleTrigger.cs) - this allows `dotnet monitor` to start and stop triggers, regardless of the trigger's properties. The collection rule pipeline creates instances of triggers [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L99) before waiting for the trigger to [satisfy its conditions](https://github.com/dotnet/diagnostics/blob/v6.0.351802/src/Microsoft.Diagnostics.Monitoring.EventPipe/Triggers/Pipelines/TraceEventTriggerPipeline.cs#L107) - each trigger has its own set of criteria that determines when a trigger has been satisfied. ### Actions -Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. +Actions allow executing an operation or an external executable in response to a trigger condition being satisfied. Options for actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleActionOptions.cs); the type of `Settings` is determined by which action is being used (possible action types can be found [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Actions)). The interface for all actions can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Actions/ICollectionRuleAction.cs) - this allows `dotnet monitor` to start an action, wait for it to complete, and get its output values regardless of the action's properties. The action list is [executed](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L149) once the triggering condition has been met (assuming the action list isn't throttled), with each action by default starting without waiting for prior actions to complete. ### Filters -Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. +Filters can optionally be applied to a collection rule to choose which processes can trigger the rule. This uses the same set of [options](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Options/ProcessFilterOptions.cs#L47) as setting the default process for `dotnet-monitor`. When starting a collection rule, [these filters are used to check if the current process should have the collection rule applied to it](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRuleContainer.cs#L187); if so, the collection rule starts. ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates -Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). +Templates allow users to design reusable collection rule components by associating a name with a piece of configuration. Options for templates can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/TemplateOptions.cs). Before collection rules undergo validation, `dotnet monitor` checks to see if any of the rule's components in configuration [list the name of a template](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Configuration/CollectionRulePostConfigureNamedOptions.cs) - if so, the collection rule's options are populated from the correspondingly named template. Note that templates undergo the same binding process for triggers/actions as collection rules; however, since templates are treated as separate parts of configuration, this binding instead happens [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Configuration/TemplatesConfigureNamedOptions.cs). ### Collection Rule Defaults -Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. +Defaults can be used to limit the verbosity of configuration, allowing frequently used values for collection rules to be assigned as defaults. Options for collection rule defaults can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleDefaultsOptions.cs). These defaults are merged with the user's provided configuration [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/DefaultCollectionRulePostConfigureOptions.cs) - any properties that the user hasn't set (that have corresponding default values) will be updated at this point to use the default values. This step occurs prior to `dotnet monitor` attempting to use its built-in defaults, which allows user defaults to take precedence. ### Collection Rule API Endpoint -The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. +The Collection Rule API Endpoint allows users to get information about the state of their collection rules, providing general information [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L525) and more specific information about a particular rule [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/DiagController.cs#L550). **This API is solely for viewing the current state of rules, not altering state**. -Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). +Each collection rule pipeline has a [state holder](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs) that keeps track of the rule's execution. By keeping track of the pipeline's state in real-time, this state doesn't need to be calculated in response to a user hitting the `/collectionrules` endpoint. However, other user-facing information, such as countdowns, are calculated on-demand - these values are solely for display purposes and not used by `dotnet-monitor` when determining when to change state (see [Limits](#limits) for more information). ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/collectionrules). From a59cc50fe4232dc7d1b02718cc651727109e1e83 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:38:16 -0800 Subject: [PATCH 196/352] Update api.md --- documentation/learningPath/api.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/learningPath/api.md b/documentation/learningPath/api.md index 3e53b2d8fd2..2b3aeb21d71 100644 --- a/documentation/learningPath/api.md +++ b/documentation/learningPath/api.md @@ -7,15 +7,15 @@ dotnet-monitor exposes functionality through both [collection rules](./collectio ## Adding New APIs -The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). +The web API surface is defined by a series of controllers [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/Controllers/). It's common for an API to expose functionality also available via [Actions](./collectionrules.md#actions) and so methods in these controllers are often wrappers around a shared implementation. Each controller may have one or more attributes that configure how and where it is exposed, you can learn more about the notable controller attributes [here](#notable-controller-attributes). -If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). +If the new API needs to either accept or return structured data, a dedicated model should be used. Models are defined [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/Models/). When adding a new API, it's important to also update the [`openapi.json`](../openapi.json) spec which describes the API surface. There are CI tests that will ensure this file has been updated to reflect any API changes. Learn more about updating `openapi.json` [here](./testing.md#openapi-generation). ### Adding Tests -Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). +Web APIs in dotnet-monitor are typically tested using functional tests that leverage the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs) to call a specific API. Learn more about how the functional tests are defined and operate [here](./testing.md#functional-tests). ## Notable Controller Attributes @@ -35,6 +35,6 @@ dotnet-monitor supports multiple different [authentication modes](../authenticat ### Determining Authentication Mode -When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. +When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. -After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. +After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. From 34aa1a329c464a07732f45054b13e15f1003df14 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:38:40 -0800 Subject: [PATCH 197/352] Update aks.md --- documentation/learningPath/aks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/aks.md b/documentation/learningPath/aks.md index fbdab7974b1..6990c075a32 100644 --- a/documentation/learningPath/aks.md +++ b/documentation/learningPath/aks.md @@ -9,7 +9,7 @@ In addition to its availability as a .NET CLI tool, the `dotnet monitor` tool is 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/e7604005393058330b88552b0087ace27ea15e26/generate-dev-sln.ps1), providing a path to your local copy of the diagnostics repo. +1. Open `pwsh` and run the [generate-dev-sln script](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/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. From 82da20ec953e0f57fde8482ea6bfe78693813963 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:39:03 -0800 Subject: [PATCH 198/352] Update configuration.md --- documentation/learningPath/configuration.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 0b74a1a4678..6126ad4861a 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -6,25 +6,25 @@ ## How Configuration Works -`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. +`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. -To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). +To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). -Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. +Once configuration has been merged, any singletons that have been added to the `IServiceCollection` (see [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs) and [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L85)), such as `IConfigureOptions`, `IPostConfigureOptions`, and `IValidateOptions`, are called when an object of that type is first used, **not on startup**. This step is often used to incorporate defaults for properties that were not explicitly set by configuration, or to validate that options were set correctly. -Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: -* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project +Any changes to the configuration need to be propagated to the [schema](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/schema.json). **The updated schema should be generated automatically; you should never need to manually edit the JSON.** To update the schema in Visual Studio: +* Set [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema) as the startup project * Build the project, with a single command-line argument for the schema's absolute path -* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) +* Validate that the schema was correctly updated using the tests in [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests) ## Keeping Documentation Up-To-Date -Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/e7604005393058330b88552b0087ace27ea15e26/documentation/configuration). Sections are typically comprised of: +Our configuration is primarily documented [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/configuration). Sections are typically comprised of: * A brief overview of the feature that is being configured * Configuration samples in all supported formats * A list of properties with descriptions, types, and whether a property is required -Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). +Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). ## TESTING ONLY From 090dd8c6723f545dc97bcd385d73136e32f71cec Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:39:37 -0800 Subject: [PATCH 199/352] Update egress.md --- documentation/learningPath/egress.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index f5fd7f30f73..d6aaa71e47d 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -26,11 +26,11 @@ graph LR class ide2 altColor ``` -1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) -1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) -1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) -1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L81) +1. [User initiates collection of artifact with a designated egress provider](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/Operation/EgressOperation.cs#L45) +1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) +1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) +1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L81) ## Distribution and Acquisition Model @@ -41,7 +41,7 @@ There are two versions of the `dotnet-monitor` image being offered: `monitor` an ### Well Known Egress Provider Locations -There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): +There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): - Next to the executing `dotnet-monitor` assembly - SharedConfigDirectory - On Windows, `%ProgramData%\dotnet-monitor` @@ -59,23 +59,23 @@ The distribution/acquisition model for third-party egress providers is determine ### Extension Manifest -All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. +All extensions must include a manifest titled [`extension.json`](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Extensions/AzureBlobStorage/extension.json) that provides `dotnet-monitor` with some basic information about the extension. | Name | Required | Type | Description | |---|---|---|---| | `Name` | true | string | The name of the extension (e.g. AzureBlobStorage) that users will use when writing configuration for the egress provider. | | `ExecutableFileName` | false | string | If specified, the executable file (without extension) to be launched when executing the extension; either `AssemblyFileName` or `ExecutableFileName` must be specified. | | `AssemblyFileName` | false | string | If specified, executes the extension using the shared .NET host (e.g. dotnet.exe) with the specified entry point assembly (without extension); either `AssemblyFileName` or `ExecutableFileName` must be specified. | -| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L84)). | +| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L84)). | ### Configuration Extensions are designed to receive all user configuration through `dotnet monitor` - the extension itself should not rely on any additional configuration sources. -In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. +In addition to the configuration provided specifically for your egress provider, `dotnet-monitor` also includes the values stored in [`Properties`](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Options/EgressOptions.cs#L21). Note that `Properties` may include information that is not relevant to the current egress provider, since it is a shared bucket between all configured egress providers. ### Communicating With Dotnet-Monitor -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** -All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L75); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. +All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L75); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. From b34294dac87d46ee26c75928d8289304d2645481 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:40:02 -0800 Subject: [PATCH 200/352] Update testing.md --- documentation/learningPath/testing.md | 56 +++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/documentation/learningPath/testing.md b/documentation/learningPath/testing.md index 1b69aebf491..0d7d0034ad6 100644 --- a/documentation/learningPath/testing.md +++ b/documentation/learningPath/testing.md @@ -7,81 +7,81 @@ Tests can be executed with the command line (via [build.cmd](../../Build.cmd) -test), as part of the PR build, or in Visual Studio. Note that because of limited resources in the build pool, tests ran from the command line or in the build pool are serialized. This avoids test failures associated with parallel testing. Visual Studio does not have such restrictions and is best used for individual tests and test investigations. When running from the command line, using the `-testgroup` parameter can be used to limit the amount of tests executed. For example `build.cmd -test -testgroup PR` will run the same tests as the PR build. -The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). +The framework of the test assemblies is controlled by [TestTargetFrameworks](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/eng/Versions.props). The test itself is attributed with a particular framework based on the [TargetFrameworkMonikerTraitAttribute](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/TargetFrameworkMonikerTraitAttribute.cs). ## Unit Tests -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) -- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) -- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/CollectionRuleActions.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTests) +- [Microsoft.Diagnostics.Monitoring.WebApi.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.WebApi.UnitTests/) +- [CollectionRuleActions.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/CollectionRuleActions.UnitTests/) Unit test assemblies directly reference types from various dotnet-monitor assemblies. However, since most of dotnet-monitor heavily relies on code injection, there are utility classes to simplify unit test creation. -- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. -- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. +- [TestHostHelper](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/TestHostHelper.cs) can be used to setup a basic unit test scenario using dependency injection. +- [CollectionRuleOptionsExtensions](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/Options/CollectionRuleOptionsExtensions.cs) can be used to easily create collection rules from configuration. ## Functional Tests -- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) -- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests) +- [Microsoft.Diagnostics.Monitoring.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/) Functional tests are composed of 3 main parts: 1. The test itself, which sets up and validates the results. 1. An instance of dotnet-monitor 1. An instance of an application that is being monitored (from the UnitTestApp assembly) -* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. -* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). -* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). -* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. -* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. +* [ScenarioRunner](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/Runners/ScenarioRunner.cs) is typically used to orchestrate test runs. The class will spawn both an instance of dotnet-monitor and an instance of test application. The app and the test communicate via stdio. The test communicates with dotnet-monitor via its Api surface. +* The dotnet-monitor Api surface can be accessed through the [ApiClient](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.FunctionalTests/HttpApi/ApiClient.cs). +* New scenarios can be added [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/). +* The [AsyncWaitScenario](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/Scenarios/AsyncWaitScenario.cs) is sufficient for most tests. +* Coordination of the scenario and the test is done via message passing (json over stdio) between the test and the app. To send messages to the app from the test, [AppRunner](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/Runners/AppRunner.cs)'s `SendCommandAsync` is used. In the scenario definition, [ScenarioHelpers](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.UnitTestApp/ScenarioHelpers.cs)'s `WaitForCommandAsync` is used. This can be used to synchronize various points of the test application with the execution of the dotnet-monitor Api from the test itself. ## Native/Profiler Tests -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Profiler.UnitTestApp/) This test assembly provides a test to make sure the dotnet-monitor profiler can load into a target app. ## Schema Generation -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) -- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Microsoft.Diagnostics.Monitoring.Options) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.ConfigurationSchema](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/) +- [Microsoft.Diagnostics.Monitoring.Options](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Options) -Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. -Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. +Dotnet-monitor generates [schema.json](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/schema.json) using unit tests. If dotnet-monitor's configuration changes, the schema.json file needs to be updated. +Note that it is possible to compile option classes directly into the `ConfigurationSchema` project. This may be necessary in order to attribute properties appropriately for schema generation. See [Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.ConfigurationSchema/Microsoft.Diagnostics.Monitoring.ConfigurationSchema.csproj). See the [Configuration](./configuration.md#how-configuration-works) learning path for more details. ## OpenAPI generation -- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) -- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.OpenApiGen](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.OpenApiGen/) -These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. +These assemblies and tests are used to generate the [OpenAPI spec](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/openapi.json) for the dotnet-monitor API. Changes to the dotnet-monitor api surface require updating `openapi.json`. If using VSCode or Codespaces, you can also use the `Regenerate openapi.json` task. ## Startup hooks / hosting startup -- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestStartupHook/) This assembly is injected into a dotnet-monitor runner (using `DOTNET_STARTUP_HOOKS`) to facilitate Assembly resolution during test runs. -- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) +- [Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.TestHostingStartup/) Uses `ASPNETCORE_HOSTINGSTARTUPASSEMBLIES` to inject a service into dotnet-monitor during test time. This allows tests to locate files that are not normally part of the test deployment, such as the native profiler. -- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) +- [Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.StartupHook.UnitTests/) Unit tests around features that are injected via `DOTNET_STARTUP_HOOKS` into the target application. This currently includes the Exceptions History feature. ## Misc test assemblies -- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) +- [Microsoft.Diagnostics.Monitoring.TestCommon](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.TestCommon/) Utility classes that are shared between Unit Tests and Functional Tests. -- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/e7604005393058330b88552b0087ace27ea15e26/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) +- [Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tests/Microsoft.Diagnostics.Monitoring.Tool.UnitTestCommon/) Utility classes shared between unit test assemblies. From e35fc7dde91b97a77bf22e15f89aeeaf71e3c673 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:40:57 -0800 Subject: [PATCH 201/352] Update learning-path-sha.txt --- .github/learning-path-sha.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/learning-path-sha.txt b/.github/learning-path-sha.txt index 15e6aee04b7..8a50ab94965 100644 --- a/.github/learning-path-sha.txt +++ b/.github/learning-path-sha.txt @@ -1 +1 @@ -e7604005393058330b88552b0087ace27ea15e26 \ No newline at end of file +341ff64a6097fe0bc66950e254e6160abcf77b84 From 8bdc20af9408848b98dca947d2c73c596f406b49 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:05:18 -0800 Subject: [PATCH 202/352] Create index.js --- .../actions/learning-path-staleness/index.js | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 .github/actions/learning-path-staleness/index.js diff --git a/.github/actions/learning-path-staleness/index.js b/.github/actions/learning-path-staleness/index.js new file mode 100644 index 00000000000..cd6eab5cdfe --- /dev/null +++ b/.github/actions/learning-path-staleness/index.js @@ -0,0 +1,226 @@ +const core = require('@actions/core'); +const fs = require('fs'); +const prevPathPrefix = "prev/"; +const headPathPrefix = "head/"; +const linePrefix = "#L"; +const separator = " | "; +const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); +const oldHash = core.getInput('oldHash', { required: true }); +const newHash = core.getInput('newHash', { required: true }); +const excludeLinks = core.getInput('excludeLinks', { required: false }); +const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : []; + +modifiedFilesDict = {}; +modifiedFilesUrlToFileName = {}; + +var outOfSync = new Set(); +var manuallyReview = new Set(); +var suggestions = new Set(); + +function UpdateModifiedFiles(fileName, path, learningPathFile) +{ + modifiedFilesUrlToFileName[path] = fileName; + + modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; + modifiedFilesDict[path].add(learningPathFile); + + var modifiedFiles = new Set(); + for (currPath in modifiedFilesDict) + { + const fileName = modifiedFilesUrlToFileName[currPath]; + modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); + } + + SetOutput('modifiedFiles', modifiedFiles) +} + +function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) +{ + return CreateLink(fileName, path, undefined) + separator + BoldedText(learningPathFiles.join(" ")); +} + +function BoldedText(text) +{ + return "**" + text + "**"; +} + +function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) +{ + manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) + SetOutput('manuallyReview', manuallyReview) +} + +function UpdateOutOfSync(link, learningPathFile) +{ + outOfSync.add(link + separator + BoldedText(learningPathFile)) + SetOutput('outOfSync', outOfSync) +} + +// Suggestions - A line reference has changed in this PR, and the PR Author should update the line accordingly. +// There are edge cases where this may make an incorrect recommendation, so the PR author should verify that +// this is the correct line to reference. +function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) +{ + suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) + SetOutput('suggestions', suggestions) +} + +function SetOutput(outputName, outputSet) +{ + core.setOutput(outputName, Array.from(outputSet).join(",")) +} + +function CreateLink(fileName, path, lineNumber) +{ + var codeFileLink = "[" + fileName + "]" + "(" + path + ")" + return AppendLineNumber(codeFileLink, lineNumber) +} + +function AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber) +{ + var codeFileLink = CreateLink(fileName, oldPath, oldLineNumber) + + if (newPath && newLineNumber) { + codeFileLink += " -> " + CreateLink(fileName, newPath, newLineNumber) + } + + return codeFileLink + separator + BoldedText(AppendLineNumber(learningPathFile, learningPathLineNumber, undefined)); +} + +function AppendLineNumber(text, lineNumber) +{ + if (!lineNumber) { return text } + + return text + " " + linePrefix + lineNumber +} + +function CheckForEndOfLink(str, startIndex) +{ + const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. "); // This regex isn't perfect, but should cover most cases. + return illegalCharIndex; +} + +function StripLineNumber(link, linePrefixIndex) +{ + return link.substring(0, linePrefixIndex); +} + +function GetContent(path) { + try { + return fs.readFileSync(path, "utf8") + } + catch (error) {} + + return undefined; +} + +function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile) +{ + // Get all indices where a link to the repo is found within the current learning path file + var linkIndices = []; + for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { + linkIndices.push(pos); + } + + for(let startOfLink of linkIndices) + { + // Clean up the link, determine if it has a line number suffix + const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + const link = learningPathContents.substring(startOfLink, endOfLink); + + if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } + + const pathStartIndex = link.indexOf(sourceDirectoryName); + if (pathStartIndex === -1) { continue } + + if (!link.includes(oldHash)) + { + UpdateOutOfSync(link, learningPathFile); + continue + } + + const linePrefixIndex = link.indexOf(linePrefix); + const linkHasLineNumber = linePrefixIndex !== -1; + const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink; + + // Check if the file being referenced by the link is one of the modified files in the PR + const linkFilePath = link.substring(pathStartIndex, pathEndIndex); + if (modifiedPRFiles.includes(linkFilePath)) + { + const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); + + UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); + + // This is the line number in the learning path file that contains the link - not the #L line number in the link itself + const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; + + var headContent = GetContent(headPathPrefix + linkFilePath) + if (!headContent) { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); + continue + } + const headContentLines = headContent.toString().split("\n"); + + if (!linkHasLineNumber) { continue; } + const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length)); + + var prevContent = GetContent(prevPathPrefix + linkFilePath) + if (!prevContent) { continue; } + const prevContentLines = prevContent.toString().split("\n"); + + if (prevContentLines.length < oldLineNumber) + { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + } + else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) + { + const newLineNumberLast = headContentLines.lastIndexOf(prevContentLines[oldLineNumber - 1]) + 1; + const newLineNumberFirst = headContentLines.indexOf(prevContentLines[oldLineNumber - 1]) + 1; + + if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file + { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + } + else + { + let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; + UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); + } + } + } + } +} + +const main = async () => { + + try { + const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); + const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); + const headLearningPathsDirectory = headPathPrefix + learningPathDirectory; + const changedFilePaths = core.getInput('changedFilePaths', {required: false}); + + if (changedFilePaths === null || changedFilePaths.trim() === "") { return } + + // Scan each file in the learningPaths directory + fs.readdir(headLearningPathsDirectory, (_, files) => { + files.forEach(learningPathFile => { + try { + const learningPathContents = fs.readFileSync(headLearningPathsDirectory + "/" + learningPathFile, "utf8") + if (learningPathContents) + { + ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile) + } + } catch (error) { + console.log("Error: " + error) + console.log("Could not find learning path file: " + learningPathFile) + } + }); + }); + + } catch (error) { + core.setFailed(error.message); + } +} + +// Call the main function to run the action +main(); From 8540f4c305cf18989c97e352f1a73ab2b7545c36 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:05:40 -0800 Subject: [PATCH 203/352] Create action.yml --- .../learning-path-staleness/action.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/actions/learning-path-staleness/action.yml diff --git a/.github/actions/learning-path-staleness/action.yml b/.github/actions/learning-path-staleness/action.yml new file mode 100644 index 00000000000..ed8bc8c1e68 --- /dev/null +++ b/.github/actions/learning-path-staleness/action.yml @@ -0,0 +1,27 @@ +name: 'CheckLearningPathLinks Action' +description: 'Checks the links in the learning paths for staleness' +inputs: + repoURLToSearch: + description: 'The repo referenced in the learning path docs (in URL form)' + required: true + learningPathsDirectory: + description: 'The directory where the learning paths reside (e.g. documentation/learningPath)' + required: true + changedFilePaths: + description: 'Paths to the changed files' + required: false + sourceDirectoryName: + description: 'The name of the top-level directory (e.g. src) - only files inside this directory will be included in the search' + required: true + oldHash: + description: 'The hash currently being used by the learning path' + required: true + newHash: + description: 'The hash to be inserted into the updated learning path' + required: true + excludeLinks: + description: 'Comma separated strings to exclude from processing' + required: false +runs: + using: 'node16' + main: 'index.js' From 6882f9c3521202d7cd5ba685fd9af34b49243b55 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:06:31 -0800 Subject: [PATCH 204/352] Rename action.yml to action.yml --- .../action.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/{learning-path-staleness => learning-path-staleness-check}/action.yml (100%) diff --git a/.github/actions/learning-path-staleness/action.yml b/.github/actions/learning-path-staleness-check/action.yml similarity index 100% rename from .github/actions/learning-path-staleness/action.yml rename to .github/actions/learning-path-staleness-check/action.yml From 952f10c2fba9dbe0eb5a408d78df611071a0cac1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:06:50 -0800 Subject: [PATCH 205/352] Rename index.js to index.js --- .../index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/{learning-path-staleness => learning-path-staleness-check}/index.js (100%) diff --git a/.github/actions/learning-path-staleness/index.js b/.github/actions/learning-path-staleness-check/index.js similarity index 100% rename from .github/actions/learning-path-staleness/index.js rename to .github/actions/learning-path-staleness-check/index.js From 1a348ba371aa4e7ccdc2e36bd6700d1e850d8f42 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:07:37 -0800 Subject: [PATCH 206/352] Create index.js --- .github/apply-learning-path-updates/index.js | 73 ++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/apply-learning-path-updates/index.js diff --git a/.github/apply-learning-path-updates/index.js b/.github/apply-learning-path-updates/index.js new file mode 100644 index 00000000000..80ba3e3a8c6 --- /dev/null +++ b/.github/apply-learning-path-updates/index.js @@ -0,0 +1,73 @@ +const core = require('@actions/core'); +const fs = require('fs'); +//const actionUtils = require('../action-utils.js'); + +const suggestionsSeparator = ','; +const oldNewLinkSeparator = ' -> '; +let modifiedFiles = []; + +function AppendModifiedFiles(path) +{ + modifiedFiles.push(path) + core.setOutput('modifiedFiles', modifiedFiles.join(' ')) +} + +function ReplaceOldWithNewText(content, oldText, newText) +{ + return content.replace(new RegExp(oldText, 'g'), newText); +} + +const main = async () => { + try { + const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); + const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); + const suggestions = core.getInput('suggestions', { required: false }); + const oldHash = core.getInput('oldHash', { required: true }); + const newHash = core.getInput('newHash', { required: true }); + + fs.writeFileSync(learningPathHashFile, newHash, "utf8"); + AppendModifiedFiles(learningPathHashFile) + + // Scan each file in the learningPaths directory + fs.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { + try { + const fullPath = learningPathDirectory + "/" + learningPathFile + const content = fs.readFileSync(fullPath, "utf8") + + var replacedContent = content + + if (suggestions !== null && suggestions.trim() !== "") { + const suggestionsArray = suggestions.split(suggestionsSeparator) + suggestionsArray.forEach(suggestion => { + const suggestionArray = suggestion.split(oldNewLinkSeparator) + var oldLink = suggestionArray[0] + var newLink = suggestionArray[1] + oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) + newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) + replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) + }) + } + + replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) + + fs.writeFileSync(learningPathDirectory + "/" + learningPathFile, replacedContent, "utf8"); + //actionUtils.writeFile(learningPathDirectory + "/" + learningPathFile, learningPathFileContentStr); + + if (content !== replacedContent) { + AppendModifiedFiles(fullPath) + } + } catch (error) { + console.log("Error: " + error) + console.log("Could not find learning path file: " + learningPathFile) + } + }); + }); + + } catch (error) { + core.setFailed(error.message); + } +} + +// Call the main function to run the action +main(); From ea1dd10e582dcb3dd0366ff55d48962df4cef697 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:08:02 -0800 Subject: [PATCH 207/352] Create action.yml --- .../apply-learning-path-updates/action.yml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/apply-learning-path-updates/action.yml diff --git a/.github/apply-learning-path-updates/action.yml b/.github/apply-learning-path-updates/action.yml new file mode 100644 index 00000000000..349797c7edc --- /dev/null +++ b/.github/apply-learning-path-updates/action.yml @@ -0,0 +1,22 @@ +name: 'UpdateLearningPathCommitHashes Action' +description: 'Checks the links in the learning paths for staleness' +inputs: + oldHash: + description: 'The commit hash to replace with the newHash in the learning path directory' + required: true + learningPathsDirectory: + description: 'The directory where the learning paths reside (e.g. documentation/learningPath)' + required: true + suggestions: + description: 'The auto-generated suggestions from the prior workflow' + required: false + learningPathHashFile: + description: 'The file where the commit hash being used for the learning paths is kept' + required: true + newHash: + description: 'The commit hash used to replace the oldHash in the learning path directory' + required: true + +runs: + using: 'node16' + main: 'index.js' From 02341c2464938b57df206b8da3e53a01e0619f48 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:08:31 -0800 Subject: [PATCH 208/352] Rename .github/apply-learning-path-updates/action.yml to .github/actions/apply-learning-path-updates/action.yml --- .github/{ => actions}/apply-learning-path-updates/action.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => actions}/apply-learning-path-updates/action.yml (100%) diff --git a/.github/apply-learning-path-updates/action.yml b/.github/actions/apply-learning-path-updates/action.yml similarity index 100% rename from .github/apply-learning-path-updates/action.yml rename to .github/actions/apply-learning-path-updates/action.yml From d427f0cae1a13abdf27a0a5d2b244cb285e0f037 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:08:51 -0800 Subject: [PATCH 209/352] Rename .github/apply-learning-path-updates/index.js to .github/actions/apply-learning-path-updates/index.js --- .github/{ => actions}/apply-learning-path-updates/index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => actions}/apply-learning-path-updates/index.js (100%) diff --git a/.github/apply-learning-path-updates/index.js b/.github/actions/apply-learning-path-updates/index.js similarity index 100% rename from .github/apply-learning-path-updates/index.js rename to .github/actions/apply-learning-path-updates/index.js From 19b027a565c6961c3e3e40e7818f7a3d1ccd04eb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:20:38 -0800 Subject: [PATCH 210/352] Update index.js --- .../actions/learning-path-staleness-check/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index cd6eab5cdfe..ac7262d012a 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,5 +1,4 @@ -const core = require('@actions/core'); -const fs = require('fs'); +const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; const headPathPrefix = "head/"; const linePrefix = "#L"; @@ -107,7 +106,7 @@ function StripLineNumber(link, linePrefixIndex) function GetContent(path) { try { - return fs.readFileSync(path, "utf8") + return actionUtils.readFileSync(path, "utf8") } catch (error) {} @@ -193,6 +192,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l const main = async () => { + const [core] = await actionUtils.installAndRequirePackages("@actions/core"); + try { const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); @@ -202,10 +203,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - fs.readdir(headLearningPathsDirectory, (_, files) => { + actionUtils.readdir(headLearningPathsDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = fs.readFileSync(headLearningPathsDirectory + "/" + learningPathFile, "utf8") + const learningPathContents = GetContent(headLearningPathsDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile) From 6e08498d1cdff65829cde0303ef16233740bf2d2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:23:07 -0800 Subject: [PATCH 211/352] Update index.js --- .../actions/apply-learning-path-updates/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/apply-learning-path-updates/index.js b/.github/actions/apply-learning-path-updates/index.js index 80ba3e3a8c6..9c4be2de318 100644 --- a/.github/actions/apply-learning-path-updates/index.js +++ b/.github/actions/apply-learning-path-updates/index.js @@ -1,6 +1,4 @@ -const core = require('@actions/core'); -const fs = require('fs'); -//const actionUtils = require('../action-utils.js'); +const actionUtils = require('../action-utils.js'); const suggestionsSeparator = ','; const oldNewLinkSeparator = ' -> '; @@ -18,6 +16,9 @@ function ReplaceOldWithNewText(content, oldText, newText) } const main = async () => { + + const [core] = await actionUtils.installAndRequirePackages("@actions/core"); + try { const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); @@ -25,15 +26,15 @@ const main = async () => { const oldHash = core.getInput('oldHash', { required: true }); const newHash = core.getInput('newHash', { required: true }); - fs.writeFileSync(learningPathHashFile, newHash, "utf8"); + actionUtils.writeFile(learningPathHashFile, newHash); AppendModifiedFiles(learningPathHashFile) // Scan each file in the learningPaths directory - fs.readdir(learningPathDirectory, (_, files) => { + actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = fs.readFileSync(fullPath, "utf8") + const content = actionUtils.readFileSync(fullPath, "utf8") var replacedContent = content @@ -51,8 +52,7 @@ const main = async () => { replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - fs.writeFileSync(learningPathDirectory + "/" + learningPathFile, replacedContent, "utf8"); - //actionUtils.writeFile(learningPathDirectory + "/" + learningPathFile, learningPathFileContentStr); + actionUtils.writeFile(learningPathDirectory + "/" + learningPathFile, replacedContent); if (content !== replacedContent) { AppendModifiedFiles(fullPath) From 033256f3dcff400ed3c457841776742f9369a5ef Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:37:40 -0800 Subject: [PATCH 212/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index 9a439f7e43e..2ce55145541 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -66,7 +66,7 @@ jobs: - name: Update Learning Path Hashes id: update-hashes - uses: kkeirstead/UpdateLearningPathCommitHashes@main + uses: ./.github/actions/apply-learning-path-updates with: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' From 8cf3318b6776476bd4b8ee6a2ac0b13c361fe9ae Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:38:23 -0800 Subject: [PATCH 213/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index f0a2d568371..dab31d6bf14 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -53,7 +53,7 @@ jobs: - name: Check Learning Path Links id: check-links - uses: kkeirstead/LearningPathFileChecks@main + uses: ./.github/actions/learning-path-staleness-check with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' From f886104c3c0107429a4e78694059ec566f104931 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:40:58 -0800 Subject: [PATCH 214/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 7fae97a49bdab672417c273a8f565c9a60988906 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:48:22 -0800 Subject: [PATCH 215/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 42c9dc3fd3958a724ce0c8cd8b0bee2a334c652c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:53:59 -0800 Subject: [PATCH 216/352] Update api.md --- documentation/learningPath/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/api.md b/documentation/learningPath/api.md index 2b3aeb21d71..333262d5f8f 100644 --- a/documentation/learningPath/api.md +++ b/documentation/learningPath/api.md @@ -35,6 +35,6 @@ dotnet-monitor supports multiple different [authentication modes](../authenticat ### Determining Authentication Mode -When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L27). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. +When dotnet-monitor starts, the command line arguments are first inspected to see if a specific authentication mode was set (such as `--no-auth`), referred to as the `StartupAuthenticationMode`, this is calculated [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L29). If no modes were explicitly set via a command line argument, dotnet-monitor will select `Deferred` as the `StartupAuthenticationMode`. This indicates that the user configuration should be looked at to determine the authentication mode later on in the startup process. After determining the `StartupAuthenticationMode` mode, the relevant [IAuthenticationConfigurator](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Auth/IAuthenticationConfigurator.cs) is created by the [AuthConfiguratorFactory](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Auth/AuthConfiguratorFactory.cs). This factory also handles deciding what authentication mode to use when `StartupAuthenticationMode` is `Deferred`. The selected configurator is used to configure various parts of dotnet-monitor that are specific to authentication, such as protecting the web APIs, add authentication-mode specific logging, and configuring the built-in Swagger UI. From b8b605f3f898c41bd0e39365c1206e29baf655d7 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:03:23 -0800 Subject: [PATCH 217/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 425b2d9fb12..497aeff6414 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -53,13 +53,13 @@ Filters can optionally be applied to a collection rule to choose which processes ### Limits -Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L212), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L195) or [throttle5d8697c3-3ded-43df-a349-4b21207010a6](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). +Limits can optionally be applied to a collection rule to constrain the lifetime of the rule and how often its actions can be run before being throttled. Options for limits can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/CollectionRuleLimitsOptions.cs). When provided (or when using default values), limits are evaluated in the collection rule pipeline while running. `RuleDuration` is used to [create a token](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/CollectionRulePipeline.cs#L79) that shuts down the pipeline. `ActionCountSlidingWindowDuration` does not rely on setting cancellation tokens; rather, the number of executions within the sliding window are checked on-demand [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L211), and `ActionCount` is referenced to determine whether the rule needs to [terminate](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L194) or [throttle](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.WebApi/CollectionRulePipelineState.cs#L234). ## Miscellaneous ### Trigger Shortcuts -Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L153). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. +Trigger Shortcuts provide improved defaults, range validation, and a simpler syntax for [several commonly used `EventCounter` triggers](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts). These shortcuts provide the same functionality as using the standard `EventCounter` syntax, but have fewer available options (since there is no need to specify the `ProviderName` or the `CounterName`) - as a result, shortcuts do not inherit from `EventCounterOptions`, but rather [IEventCounterShortcuts](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Options/Triggers/EventCounterShortcuts/IEventCounterShortcuts.cs). Each type of shortcut is registered independently [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L158). After binding with configuration and undergoing validation, shortcuts are then converted to be treated as `EventCounter` triggers [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/CollectionRules/Triggers/EventCounterTriggerFactory.cs), using their respective defaults instead of the generic ones. ### Templates From 214cbf48a926b0ee02d752a9e5c7ac70bc43dc6a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:06:54 -0800 Subject: [PATCH 218/352] Update configuration.md --- documentation/learningPath/configuration.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/documentation/learningPath/configuration.md b/documentation/learningPath/configuration.md index 6126ad4861a..728b4582255 100644 --- a/documentation/learningPath/configuration.md +++ b/documentation/learningPath/configuration.md @@ -6,7 +6,7 @@ ## How Configuration Works -`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L46). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. +`dotnet-monitor` accepts configuration from several different sources, and must [combine these sources for the host builder](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/HostBuilder/HostBuilderHelper.cs#L47). Configuration sources are added in the order of lowest to highest precedence - meaning that if there is a conflict between a property in two configuration sources, the property found in the latter configuration source will be used. To see the merged configuration, the user can run the `config show` command (see [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Program.cs#L68) and [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Commands/ConfigShowCommandHandler.cs)); the `--show-sources` flag can be used to reveal which configuration source is responsible for each property. The `config show` command's output is [written out as JSON](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ConfigurationJsonWriter.cs); this section must be manually updated whenever new options are added (or existing options are changed). @@ -25,7 +25,3 @@ Our configuration is primarily documented [here](https://github.com/dotnet/dotne * A list of properties with descriptions, types, and whether a property is required Types are defined in [definitions.md](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/api/definitions.md), and additional information about configuring collection rules can be found in the [collection rules](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/collectionrules) directory. Where appropriate, indicate if configuration only pertains to a specific version of `dotnet-monitor` (e.g. `7.0+`). - -## TESTING ONLY - -This is a link that erroneously points to main, instead of the designated hash [here]((https://github.com/dotnet/dotnet-monitor/blob/main/src/Tools/dotnet-monitor/Commands/CollectCommandHandler.cs#L8). From d353d8bef10d471d3d0c70579dbd74c80bc6b554 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:12:27 -0800 Subject: [PATCH 219/352] Update egress.md --- documentation/learningPath/egress.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documentation/learningPath/egress.md b/documentation/learningPath/egress.md index d6aaa71e47d..5d44d615f5b 100644 --- a/documentation/learningPath/egress.md +++ b/documentation/learningPath/egress.md @@ -30,7 +30,7 @@ graph LR 1. [Locate extension's executable and manifest](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Extensibility/ExtensionDiscoverer.cs#L28) 1. [Start extension and pass configuration/artifact via StdIn to the other process](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L102) 1. [Connect to egress provider using configuration and send artifact](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Extensions/AzureBlobStorage/AzureBlobEgressProvider.cs#L36) -1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L81) +1. [Provide success/failure information via StdOut to dotnet-monitor](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L77) ## Distribution and Acquisition Model @@ -41,7 +41,7 @@ There are two versions of the `dotnet-monitor` image being offered: `monitor` an ### Well Known Egress Provider Locations -There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L274) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): +There are 3 [locations](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs#L279) that `dotnet-monitor` scans when looking for the extensions directory (the highest priority location is listed first): - Next to the executing `dotnet-monitor` assembly - SharedConfigDirectory - On Windows, `%ProgramData%\dotnet-monitor` @@ -66,7 +66,7 @@ All extensions must include a manifest titled [`extension.json`](https://github. | `Name` | true | string | The name of the extension (e.g. AzureBlobStorage) that users will use when writing configuration for the egress provider. | | `ExecutableFileName` | false | string | If specified, the executable file (without extension) to be launched when executing the extension; either `AssemblyFileName` or `ExecutableFileName` must be specified. | | `AssemblyFileName` | false | string | If specified, executes the extension using the shared .NET host (e.g. dotnet.exe) with the specified entry point assembly (without extension); either `AssemblyFileName` or `ExecutableFileName` must be specified. | -| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L84)). | +| `Modes` | false | [[ExtensionMode](../api/definitions.md#extensionmode)] | Additional modes the extension can be configured to run in (see an example of Validation [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L80)). | ### Configuration @@ -76,6 +76,6 @@ In addition to the configuration provided specifically for your egress provider, ### Communicating With Dotnet-Monitor -[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L145). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** +[`dotnet monitor` will pass serialized configuration via `StdIn` to the extension](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.cs#L182); an example of how the `AzureBlobStorage` egress provider interprets the egress payload can be found [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L141). **It's important to validate the version number at the beginning of the stream; if an extension does not have the same version as `dotnet-monitor`, it should not attempt to continue reading from the stream, and users may need to update to a newer version of the extension.** -All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L75); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. +All output from the extension will be passed back to `dotnet-monitor`; this is logged [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L62). The contents of the `StandardOutput` and `StandardError` streams are handled and logged as seen [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressExtension.OutputParser.cs#L32), with the `StandardOutput` stream being logged at the `Info` level and the `StandardError` stream being logged at the `Warning` level. `Dotnet-Monitor` will continue reading output until it receives a [result](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Tools/dotnet-monitor/Egress/Extension/EgressArtifactResult.cs) from the extension via the `StandardOutput` stream, at which point the extension's process will be terminated and `dotnet-monitor` will display the appropriate log message depending on the success/failure of the operation. Exceptions thrown during the egress operation are caught [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs#L71); this allows the extension to report a failure message back to `dotnet-monitor` that will be displayed to the user. From 53da42fdb88105903d90d8bed8edd109e9ec5e27 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Mon, 29 Jan 2024 14:56:23 -0800 Subject: [PATCH 220/352] Update submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml index 2ce55145541..8d79f832ff3 100644 --- a/.github/workflows/submit-learning-path-pr.yml +++ b/.github/workflows/submit-learning-path-pr.yml @@ -79,26 +79,26 @@ jobs: manuallyReview=$(cat ./learning-path-review/manuallyReview) manuallyReview=${manuallyReview//,/
} manuallyReviewSection="

Manually Review:

${manuallyReview}
" - if test -z "$manuallyReview"; then - manuallyReviewSection="" + if [ -z "$manuallyReview" ]; then + manuallyReviewSection="" fi outOfSync=$(cat ./learning-path-review/outOfSync) outOfSync=${outOfSync//,/
} outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" - if test -z "$outOfSync"; then - outOfSyncSection="" + if [ -z "$outOfSync" ]; then + outOfSyncSection="" fi suggestions=$(cat ./learning-path-review/suggestions) suggestions=${suggestions//,/
} suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" - if test -z "$suggestions"; then - suggestionsSection="" + if [ -z "$suggestions" ]; then + suggestionsSection="" fi modifiedFiles=$(cat ./learning-path-review/modifiedFiles) modifiedFiles=${modifiedFiles//,/
} modifiedFilesSection="

Modified Files:

${modifiedFiles}
" - if test -z "$modifiedFiles"; then - modifiedFilesSection="" + if [ -z "$modifiedFiles" ]; then + modifiedFilesSection="" fi body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" echo "body=$body" >> $GITHUB_ENV From 48d09afe44aa7190275a0b13e11752ffe6821f3a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:22:37 -0800 Subject: [PATCH 221/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index dab31d6bf14..3f810a3a3a9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,7 +1,7 @@ name: 'Check Learning Path Links' on: - schedule: # Run once a week - - cron: '0 0 * * 1' + schedule: # Run once a month + - cron: '0 0 1 * *' workflow_dispatch: permissions: {} From ac34280ac0c37d4e2cf4d96050e45b2bfd7c7f5d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:24:32 -0800 Subject: [PATCH 222/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 3f810a3a3a9..5c62049d4f7 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -17,7 +17,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false ref: main path: head From 7cb22aebd25a89ebc555975b872ba8ae6e6e68b8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:31:29 -0800 Subject: [PATCH 223/352] Update check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 65 +++++++++++++++---- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 5c62049d4f7..ce0f8f6e0c5 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -12,6 +12,8 @@ jobs: runs-on: ubuntu-latest permissions: issues: write + contents: write + pull-requests: write steps: - name: Checkout head @@ -40,7 +42,7 @@ jobs: - name: Checkout previous update uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true ref: ${{ env.prev_sha }} path: prev @@ -61,18 +63,55 @@ jobs: sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} - - - name: Generate artifacts (Comment) - working-directory: ./head + + - name: Update Learning Path Hashes + id: update-hashes + uses: ./.github/actions/apply-learning-path-updates + with: + learningPathsDirectory: 'documentation/learningPath' + learningPathHashFile: '.github/learning-path-sha.txt' + suggestions: ${{ env.suggestions }} + oldHash: ${{ env.prev_sha }} + newHash: ${{ env.new_sha }} + + - name: Create PR Body run: | - mkdir -p ./learning-path-review - echo -n "${{ steps.check-links.outputs.modifiedFiles }}" > ./learning-path-review/modifiedFiles - echo -n "${{ steps.check-links.outputs.manuallyReview }}" > ./learning-path-review/manuallyReview - echo -n "${{ steps.check-links.outputs.suggestions }}" > ./learning-path-review/suggestions - echo -n "${{ steps.check-links.outputs.outOfSync }}" > ./learning-path-review/outOfSync + manuallyReview="${{steps.check-links.outputs.manuallyReview}}" + manuallyReview=${manuallyReview//,/
} + manuallyReviewSection="

Manually Review:

${manuallyReview}
" + if [ -z "$manuallyReview" ]; then + manuallyReviewSection="" + fi + outOfSync="${{steps.check-links.outputs.outOfSync}}" + outOfSync=${outOfSync//,/
} + outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" + if [ -z "$outOfSync" ]; then + outOfSyncSection="" + fi + suggestions="${{steps.check-links.outputs.suggestions}}" + suggestions=${suggestions//,/
} + suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" + if [ -z "$suggestions" ]; then + suggestionsSection="" + fi + modifiedFiles="${{steps.check-links.outputs.modifiedFiles}}" + modifiedFiles=${modifiedFiles//,/
} + modifiedFilesSection="

Modified Files:

${modifiedFiles}
" + if [ -z "$modifiedFiles" ]; then + modifiedFilesSection="" + fi + body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" + echo "body=$body" >> $GITHUB_ENV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload artifacts (Comment) - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 + - name: Open PR + uses: ./.github/actions/open-pr with: - name: learning-path-review - path: head/learning-path-review/ + files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} + title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" + commit_message: Update Learning Paths + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} + branch_name: learningPathUpdates/${{ env.new_sha }} + fail_if_files_unchanged: true + auth_token: ${{ secrets.GITHUB_TOKEN }} From ddf4b9de50aeb9a436fa3891f40b37a848ef9890 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:39:54 -0800 Subject: [PATCH 224/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index ce0f8f6e0c5..06f7b4e139a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -76,25 +76,25 @@ jobs: - name: Create PR Body run: | - manuallyReview="${{steps.check-links.outputs.manuallyReview}}" + manuallyReview=$MANUALLY_REVIEW manuallyReview=${manuallyReview//,/
} manuallyReviewSection="

Manually Review:

${manuallyReview}
" if [ -z "$manuallyReview" ]; then manuallyReviewSection="" fi - outOfSync="${{steps.check-links.outputs.outOfSync}}" + outOfSync=$OUT_OF_SYNC outOfSync=${outOfSync//,/
} outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" if [ -z "$outOfSync" ]; then outOfSyncSection="" fi - suggestions="${{steps.check-links.outputs.suggestions}}" + suggestions=$SUGGESTIONS suggestions=${suggestions//,/
} suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" if [ -z "$suggestions" ]; then suggestionsSection="" fi - modifiedFiles="${{steps.check-links.outputs.modifiedFiles}}" + modifiedFiles=$MODIFIED_FILES modifiedFiles=${modifiedFiles//,/
} modifiedFilesSection="

Modified Files:

${modifiedFiles}
" if [ -z "$modifiedFiles" ]; then @@ -104,6 +104,10 @@ jobs: echo "body=$body" >> $GITHUB_ENV env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MODIFIED_FILES: ${{ steps.check-links.outputs.modifiedFiles }} + MANUALLY_REVIEW: ${{ steps.check-links.outputs.manuallyReview }} + SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} + OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} - name: Open PR uses: ./.github/actions/open-pr From 48d4e8cc277194bacba6d94e505108375219ce3d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:40:09 -0800 Subject: [PATCH 225/352] Delete .github/workflows/submit-learning-path-pr.yml --- .github/workflows/submit-learning-path-pr.yml | 117 ------------------ 1 file changed, 117 deletions(-) delete mode 100644 .github/workflows/submit-learning-path-pr.yml diff --git a/.github/workflows/submit-learning-path-pr.yml b/.github/workflows/submit-learning-path-pr.yml deleted file mode 100644 index 8d79f832ff3..00000000000 --- a/.github/workflows/submit-learning-path-pr.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: 'Submit Learning Path PR' -run-name: '[${{ github.ref_name }}] Submit Learning Path PR' - -on: - workflow_run: - workflows: ["Check Learning Path Links"] - types: - - completed - -permissions: {} - -jobs: - submit-learning-path-pr: - name: 'Submit Learning Path PR' - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea - id: check-user - with: - script: | - await github.rest.repos.checkCollaborator({ - owner: context.repo.owner, - repo: context.repo.repo, - username: context.payload.workflow_run.triggering_actor.login - }); - - - name: Checkout main - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - persist-credentials: true # We need to persist credentials to push the resulting changes upstream. - ref: main - - - name: Get current SHA - id: get_new_sha - run: | - new_sha=$(git rev-parse HEAD) - echo "new_sha=$new_sha" >> $GITHUB_ENV - - - name: Get previous update SHA - id: get_prev_sha - run: | - cd .github - prev_sha=$(cat learning-path-sha.txt) - echo "prev_sha=$prev_sha" >> $GITHUB_ENV - cd ../ - - # Download the artifact from the workflow that kicked off this one. - # The default artifact download action doesn't support cross-workflow - # artifacts, so use a 3rd party one. - - name: 'Download linting results' - uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d - with: - workflow: ${{env.workflow_name}} - run_id: ${{github.event.workflow_run.id }} - name: learning-path-review - path: ./learning-path-review - - - name: Put Suggestions In Env Var - run: | - suggestions=$(cat ./learning-path-review/suggestions) - echo "suggestions=$suggestions" >> $GITHUB_ENV - - - name: Update Learning Path Hashes - id: update-hashes - uses: ./.github/actions/apply-learning-path-updates - with: - learningPathsDirectory: 'documentation/learningPath' - learningPathHashFile: '.github/learning-path-sha.txt' - suggestions: ${{ env.suggestions }} - oldHash: ${{ env.prev_sha }} - newHash: ${{ env.new_sha }} - - - name: Create PR Body - run: | - manuallyReview=$(cat ./learning-path-review/manuallyReview) - manuallyReview=${manuallyReview//,/
} - manuallyReviewSection="

Manually Review:

${manuallyReview}
" - if [ -z "$manuallyReview" ]; then - manuallyReviewSection="" - fi - outOfSync=$(cat ./learning-path-review/outOfSync) - outOfSync=${outOfSync//,/
} - outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" - if [ -z "$outOfSync" ]; then - outOfSyncSection="" - fi - suggestions=$(cat ./learning-path-review/suggestions) - suggestions=${suggestions//,/
} - suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" - if [ -z "$suggestions" ]; then - suggestionsSection="" - fi - modifiedFiles=$(cat ./learning-path-review/modifiedFiles) - modifiedFiles=${modifiedFiles//,/
} - modifiedFilesSection="

Modified Files:

${modifiedFiles}
" - if [ -z "$modifiedFiles" ]; then - modifiedFilesSection="" - fi - body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" - echo "body=$body" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Open PR - uses: ./.github/actions/open-pr - with: - files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} - title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" - commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} - branch_name: learningPathUpdates/${{ env.new_sha }} - fail_if_files_unchanged: true - auth_token: ${{ secrets.GITHUB_TOKEN }} From ede7c2f3f0b4c1ff9ec1560194985486c03fa697 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:44:40 -0800 Subject: [PATCH 226/352] Update index.js --- .github/actions/apply-learning-path-updates/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/apply-learning-path-updates/index.js b/.github/actions/apply-learning-path-updates/index.js index 9c4be2de318..c6ebe3f28c8 100644 --- a/.github/actions/apply-learning-path-updates/index.js +++ b/.github/actions/apply-learning-path-updates/index.js @@ -12,7 +12,7 @@ function AppendModifiedFiles(path) function ReplaceOldWithNewText(content, oldText, newText) { - return content.replace(new RegExp(oldText, 'g'), newText); + return content.replaceAll(oldText, newText); } const main = async () => { From 372686822a13aabd31cf098509d15fc38ce0c5f5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:48:16 -0800 Subject: [PATCH 227/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 06f7b4e139a..b67044d6ca9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -55,7 +55,7 @@ jobs: - name: Check Learning Path Links id: check-links - uses: ./.github/actions/learning-path-staleness-check + uses: kkeirstead/LearningPathFileChecks@main with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' @@ -66,13 +66,15 @@ jobs: - name: Update Learning Path Hashes id: update-hashes - uses: ./.github/actions/apply-learning-path-updates + uses: kkeirstead/UpdateLearningPathCommitHashes@main with: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' - suggestions: ${{ env.suggestions }} + suggestions: $SUGGESTIONS oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} + env: + SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} - name: Create PR Body run: | From 814013ae288759ef962b4b31ba728ca623e5ec05 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:55:36 -0800 Subject: [PATCH 228/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index b67044d6ca9..84334dff061 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true ref: main path: head @@ -42,7 +42,7 @@ jobs: - name: Checkout previous update uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false ref: ${{ env.prev_sha }} path: prev From a693f1d64dff63049d01af4ccdd9e3341a6d9c93 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:00:08 -0800 Subject: [PATCH 229/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 84334dff061..557fdf7bdec 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -113,6 +113,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr + working-directory: ./head with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" From d3f849c2015226fbcf9d40ebca4483c59b79e7c8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:11:49 -0800 Subject: [PATCH 230/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 557fdf7bdec..fdadaebce03 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -15,7 +15,14 @@ jobs: contents: write pull-requests: write - steps: + steps: + - name: Checkout previous update + uses: actions/checkout@v4 + with: + persist-credentials: false + ref: ${{ env.prev_sha }} + path: prev + - name: Checkout head uses: actions/checkout@v4 with: @@ -38,13 +45,6 @@ jobs: prev_sha=$(cat learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV cd ../ - - - name: Checkout previous update - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: ${{ env.prev_sha }} - path: prev - name: Get changed files working-directory: ./head @@ -113,7 +113,6 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr - working-directory: ./head with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" From 5795d66810b9aea7ff349ef2db0a3ecdfca64589 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:14:54 -0800 Subject: [PATCH 231/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index fdadaebce03..75d148e7a59 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false ref: main path: head @@ -111,6 +111,12 @@ jobs: SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + ref: main + - name: Open PR uses: ./.github/actions/open-pr with: From 684b455f3f2addc3769c3f3c64233a7eeb307fc4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:21:45 -0800 Subject: [PATCH 232/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 75d148e7a59..513f16bf94c 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true ref: main path: head @@ -111,14 +111,8 @@ jobs: SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - ref: main - - name: Open PR - uses: ./.github/actions/open-pr + uses: ./head/.github/actions/open-pr with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" From fddb21b4c2fab65caf2f499cde714d540b81d479 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:34:49 -0800 Subject: [PATCH 233/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 513f16bf94c..490bc185582 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -26,7 +26,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false ref: main path: head @@ -64,6 +64,12 @@ jobs: oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + ref: main + - name: Update Learning Path Hashes id: update-hashes uses: kkeirstead/UpdateLearningPathCommitHashes@main @@ -112,7 +118,7 @@ jobs: OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} - name: Open PR - uses: ./head/.github/actions/open-pr + uses: ./.github/actions/open-pr with: files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" From 371b29bbe2f8227bc069abfd93d07ef55c02c000 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:37:34 -0800 Subject: [PATCH 234/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From ce48f4674948cddbcf941aefc7294d26ca2958cb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:42:01 -0800 Subject: [PATCH 235/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 490bc185582..163173937ff 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -15,14 +15,7 @@ jobs: contents: write pull-requests: write - steps: - - name: Checkout previous update - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: ${{ env.prev_sha }} - path: prev - + steps: - name: Checkout head uses: actions/checkout@v4 with: @@ -46,6 +39,13 @@ jobs: echo "prev_sha=$prev_sha" >> $GITHUB_ENV cd ../ + - name: Checkout previous update + uses: actions/checkout@v4 + with: + persist-credentials: false + ref: ${{ env.prev_sha }} + path: prev + - name: Get changed files working-directory: ./head run: | From aa165a330362f74d5663bdea690140096edf716f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:48:24 -0800 Subject: [PATCH 236/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 163173937ff..2a8738cd951 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true ref: main path: head From 358a4f36b9233ac9a760342a91812a9c9ebc7555 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:57:21 -0800 Subject: [PATCH 237/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 2a8738cd951..c5ca9b9e541 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -19,7 +19,8 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false + fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main path: head From 394b8c90b5ca08b6d323cc4166d508d8820e3ad5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:10:18 -0800 Subject: [PATCH 238/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index c5ca9b9e541..4726550f3c5 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -77,11 +77,9 @@ jobs: with: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' - suggestions: $SUGGESTIONS + suggestions: ${{ steps.check-links.outputs.suggestions }} oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} - env: - SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} - name: Create PR Body run: | From c1a1c9e5e15734d8cff79a8e1563d41b35e418de Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:15:00 -0800 Subject: [PATCH 239/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 422d445fc4f635528cb21ea3538191f610de0641 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:16:38 -0800 Subject: [PATCH 240/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 4726550f3c5..e7defce4970 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -56,7 +56,7 @@ jobs: - name: Check Learning Path Links id: check-links - uses: kkeirstead/LearningPathFileChecks@main + uses: ./.github/actions/learning-path-staleness-check with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' @@ -73,7 +73,7 @@ jobs: - name: Update Learning Path Hashes id: update-hashes - uses: kkeirstead/UpdateLearningPathCommitHashes@main + uses: ./.github/actions/apply-learning-path-updates with: learningPathsDirectory: 'documentation/learningPath' learningPathHashFile: '.github/learning-path-sha.txt' From c1235a565d0389af18129a2f0c0a54e9230c34c8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:44:14 -0800 Subject: [PATCH 241/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index e7defce4970..fd6740d87f0 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -56,7 +56,7 @@ jobs: - name: Check Learning Path Links id: check-links - uses: ./.github/actions/learning-path-staleness-check + uses: kkeirstead/LearningPathFileChecks@main with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' @@ -64,6 +64,7 @@ jobs: sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} newHash: ${{ env.new_sha }} + learningPathHashFile: '.github/learning-path-sha.txt' - name: Checkout head uses: actions/checkout@v4 @@ -71,16 +72,6 @@ jobs: persist-credentials: true ref: main - - name: Update Learning Path Hashes - id: update-hashes - uses: ./.github/actions/apply-learning-path-updates - with: - learningPathsDirectory: 'documentation/learningPath' - learningPathHashFile: '.github/learning-path-sha.txt' - suggestions: ${{ steps.check-links.outputs.suggestions }} - oldHash: ${{ env.prev_sha }} - newHash: ${{ env.new_sha }} - - name: Create PR Body run: | manuallyReview=$MANUALLY_REVIEW From 50c6ce6379846c754b622ffdfa4314aa09fcfddf Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:47:42 -0800 Subject: [PATCH 242/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From b737674d1810fb60ddab4c974e60534cae968eaa Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:56:27 -0800 Subject: [PATCH 243/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index fd6740d87f0..bf09a50a65b 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -110,7 +110,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.update-hashes.outputs.modifiedFiles }} + files_to_commit: ${{ steps.check-links.outputs.modifiedFiles }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} From 757f0b7619310e8ecc7eda419cb734b6b534fbca Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:58:49 -0800 Subject: [PATCH 244/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index bf09a50a65b..318fceb8879 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -71,6 +71,7 @@ jobs: with: persist-credentials: true ref: main + path: head - name: Create PR Body run: | From 76b48778ab15cbb881011c4041a180fd4ec21b5b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:00:27 -0800 Subject: [PATCH 245/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 318fceb8879..2644b6bc009 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -22,18 +22,15 @@ jobs: persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main - path: head - name: Get current SHA id: get_new_sha - working-directory: ./head run: | new_sha=$(git rev-parse HEAD) echo "new_sha=$new_sha" >> $GITHUB_ENV - name: Get previous update SHA id: get_sha - working-directory: ./head run: | cd .github prev_sha=$(cat learning-path-sha.txt) @@ -48,7 +45,6 @@ jobs: path: prev - name: Get changed files - working-directory: ./head run: | changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) echo "Files to validate: '${changed_source_files}'" @@ -71,7 +67,6 @@ jobs: with: persist-credentials: true ref: main - path: head - name: Create PR Body run: | From 604aa410ea537355344297b875ffa636eaf9e34f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:04:32 -0800 Subject: [PATCH 246/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 2644b6bc009..71cf969cdce 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -50,6 +50,12 @@ jobs: echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + ref: main + - name: Check Learning Path Links id: check-links uses: kkeirstead/LearningPathFileChecks@main @@ -62,12 +68,6 @@ jobs: newHash: ${{ env.new_sha }} learningPathHashFile: '.github/learning-path-sha.txt' - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - ref: main - - name: Create PR Body run: | manuallyReview=$MANUALLY_REVIEW From e5dfdc54e41ceaeb39fd23891a1f75ea1bd157ce Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:37:22 -0800 Subject: [PATCH 247/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 71cf969cdce..953e77e0e1f 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -37,6 +37,12 @@ jobs: echo "prev_sha=$prev_sha" >> $GITHUB_ENV cd ../ + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + ref: main + - name: Checkout previous update uses: actions/checkout@v4 with: @@ -50,12 +56,6 @@ jobs: echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - ref: main - - name: Check Learning Path Links id: check-links uses: kkeirstead/LearningPathFileChecks@main From 2530d3a773be8e7e573aed69d10653e1e9ceb4cb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:40:31 -0800 Subject: [PATCH 248/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..93a0cbfd62e 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From bea5b0284c22cecb5edfa8e35ad353a54a6b8fe0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 10:50:27 -0800 Subject: [PATCH 249/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 953e77e0e1f..4961c2024f2 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -106,7 +106,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.check-links.outputs.modifiedFiles }} + files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} From bf7aef4ee537f83f8e4ac0a6396b4c8680cfbb57 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:22:36 -0800 Subject: [PATCH 250/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 48964a8ab6358d5975369a2298d1d6fc6d64371f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:25:01 -0800 Subject: [PATCH 251/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From d634733a7591658953dfd0a618f2e4a308f18b7d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:25:28 -0800 Subject: [PATCH 252/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 93a0cbfd62e..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From f7878f5726ebedb7e1fd5651d53b9f66c7f7a377 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:26:22 -0800 Subject: [PATCH 253/352] Update action.yml --- .github/actions/learning-path-staleness-check/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/learning-path-staleness-check/action.yml b/.github/actions/learning-path-staleness-check/action.yml index ed8bc8c1e68..4e651ad6ee8 100644 --- a/.github/actions/learning-path-staleness-check/action.yml +++ b/.github/actions/learning-path-staleness-check/action.yml @@ -19,6 +19,9 @@ inputs: newHash: description: 'The hash to be inserted into the updated learning path' required: true + learningPathHashFile: + description: 'The file where the commit hash being used for the learning paths is kept' + required: true excludeLinks: description: 'Comma separated strings to exclude from processing' required: false From 3ed44c6225f078b1b5f9a3a68bea1fcfe1c9c8ea Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:33:40 -0800 Subject: [PATCH 254/352] Update index.js --- .../learning-path-staleness-check/index.js | 73 ++++++++++++++++--- 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index ac7262d012a..1916f87df9b 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,6 +1,6 @@ +const core = require('@actions/core'); const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; -const headPathPrefix = "head/"; const linePrefix = "#L"; const separator = " | "; const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); @@ -16,6 +16,20 @@ var outOfSync = new Set(); var manuallyReview = new Set(); var suggestions = new Set(); +const oldNewLinkSeparator = ' -> '; +let modifiedFilesToCommit = []; + +function AppendModifiedFilesToCommit(path) +{ + modifiedFilesToCommit.push(path) + core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) +} + +function ReplaceOldWithNewText(content, oldText, newText) +{ + return content.replaceAll(oldText, newText); +} + function UpdateModifiedFiles(fileName, path, learningPathFile) { modifiedFilesUrlToFileName[path] = fileName; @@ -55,9 +69,6 @@ function UpdateOutOfSync(link, learningPathFile) SetOutput('outOfSync', outOfSync) } -// Suggestions - A line reference has changed in this PR, and the PR Author should update the line accordingly. -// There are edge cases where this may make an incorrect recommendation, so the PR author should verify that -// this is the correct line to reference. function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) { suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) @@ -80,7 +91,7 @@ function AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber var codeFileLink = CreateLink(fileName, oldPath, oldLineNumber) if (newPath && newLineNumber) { - codeFileLink += " -> " + CreateLink(fileName, newPath, newLineNumber) + codeFileLink += oldNewLinkSeparator + CreateLink(fileName, newPath, newLineNumber) } return codeFileLink + separator + BoldedText(AppendLineNumber(learningPathFile, learningPathLineNumber, undefined)); @@ -106,7 +117,7 @@ function StripLineNumber(link, linePrefixIndex) function GetContent(path) { try { - return actionUtils.readFileSync(path, "utf8") + return actionUtils.readFile(path) } catch (error) {} @@ -153,7 +164,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; - var headContent = GetContent(headPathPrefix + linkFilePath) + var headContent = GetContent(linkFilePath) if (!headContent) { UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); continue @@ -193,20 +204,20 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l const main = async () => { const [core] = await actionUtils.installAndRequirePackages("@actions/core"); - + try { const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); - const headLearningPathsDirectory = headPathPrefix + learningPathDirectory; const changedFilePaths = core.getInput('changedFilePaths', {required: false}); - + const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); + if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(headLearningPathsDirectory, (_, files) => { + actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = GetContent(headLearningPathsDirectory + "/" + learningPathFile) + const learningPathContents = actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile) @@ -218,6 +229,44 @@ const main = async () => { }); }); + actionUtils.writeFile(learningPathHashFile, newHash); + AppendModifiedFilesToCommit(learningPathHashFile) + + // Scan each file in the learningPaths directory + actionUtils.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { + try { + const fullPath = learningPathDirectory + "/" + learningPathFile + const content = actionUtils.readFile(fullPath) + + var replacedContent = content + + let suggestionsArray = Array.from(suggestions); + if (suggestionsArray && suggestionsArray.length > 0) { + suggestionsArray.forEach(suggestion => { + const suggestionArray = suggestion.split(oldNewLinkSeparator) + var oldLink = suggestionArray[0] + var newLink = suggestionArray[1] + oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) + newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) + replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) + }) + } + + replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) + + actionUtils.writeFile(fullPath, replacedContent); + + if (content !== replacedContent) { + AppendModifiedFilesToCommit(fullPath) + } + } catch (error) { + console.log("Error: " + error) + console.log("Could not find learning path file: " + learningPathFile) + } + }); + }); + } catch (error) { core.setFailed(error.message); } From 3f0ac615cd56bd5fb50a0058f62e68d3eaabd277 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:33:57 -0800 Subject: [PATCH 255/352] Delete .github/actions/apply-learning-path-updates directory --- .../apply-learning-path-updates/action.yml | 22 ------ .../apply-learning-path-updates/index.js | 73 ------------------- 2 files changed, 95 deletions(-) delete mode 100644 .github/actions/apply-learning-path-updates/action.yml delete mode 100644 .github/actions/apply-learning-path-updates/index.js diff --git a/.github/actions/apply-learning-path-updates/action.yml b/.github/actions/apply-learning-path-updates/action.yml deleted file mode 100644 index 349797c7edc..00000000000 --- a/.github/actions/apply-learning-path-updates/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: 'UpdateLearningPathCommitHashes Action' -description: 'Checks the links in the learning paths for staleness' -inputs: - oldHash: - description: 'The commit hash to replace with the newHash in the learning path directory' - required: true - learningPathsDirectory: - description: 'The directory where the learning paths reside (e.g. documentation/learningPath)' - required: true - suggestions: - description: 'The auto-generated suggestions from the prior workflow' - required: false - learningPathHashFile: - description: 'The file where the commit hash being used for the learning paths is kept' - required: true - newHash: - description: 'The commit hash used to replace the oldHash in the learning path directory' - required: true - -runs: - using: 'node16' - main: 'index.js' diff --git a/.github/actions/apply-learning-path-updates/index.js b/.github/actions/apply-learning-path-updates/index.js deleted file mode 100644 index c6ebe3f28c8..00000000000 --- a/.github/actions/apply-learning-path-updates/index.js +++ /dev/null @@ -1,73 +0,0 @@ -const actionUtils = require('../action-utils.js'); - -const suggestionsSeparator = ','; -const oldNewLinkSeparator = ' -> '; -let modifiedFiles = []; - -function AppendModifiedFiles(path) -{ - modifiedFiles.push(path) - core.setOutput('modifiedFiles', modifiedFiles.join(' ')) -} - -function ReplaceOldWithNewText(content, oldText, newText) -{ - return content.replaceAll(oldText, newText); -} - -const main = async () => { - - const [core] = await actionUtils.installAndRequirePackages("@actions/core"); - - try { - const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); - const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); - const suggestions = core.getInput('suggestions', { required: false }); - const oldHash = core.getInput('oldHash', { required: true }); - const newHash = core.getInput('newHash', { required: true }); - - actionUtils.writeFile(learningPathHashFile, newHash); - AppendModifiedFiles(learningPathHashFile) - - // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { - files.forEach(learningPathFile => { - try { - const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFileSync(fullPath, "utf8") - - var replacedContent = content - - if (suggestions !== null && suggestions.trim() !== "") { - const suggestionsArray = suggestions.split(suggestionsSeparator) - suggestionsArray.forEach(suggestion => { - const suggestionArray = suggestion.split(oldNewLinkSeparator) - var oldLink = suggestionArray[0] - var newLink = suggestionArray[1] - oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) - newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) - }) - } - - replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - - actionUtils.writeFile(learningPathDirectory + "/" + learningPathFile, replacedContent); - - if (content !== replacedContent) { - AppendModifiedFiles(fullPath) - } - } catch (error) { - console.log("Error: " + error) - console.log("Could not find learning path file: " + learningPathFile) - } - }); - }); - - } catch (error) { - core.setFailed(error.message); - } -} - -// Call the main function to run the action -main(); From d434c92a58f28e0a5254340bad758a42896bd944 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:35:20 -0800 Subject: [PATCH 256/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 4961c2024f2..c257b0c809f 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -58,7 +58,7 @@ jobs: - name: Check Learning Path Links id: check-links - uses: kkeirstead/LearningPathFileChecks@main + uses: ./.github/actions/learning-path-staleness-check with: repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' learningPathsDirectory: 'documentation/learningPath' From 64fb59122a4bc7b5c2649125c67d72c7d2a7a7bd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:41:49 -0800 Subject: [PATCH 257/352] Update collectionrules.md --- documentation/learningPath/collectionrules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/learningPath/collectionrules.md b/documentation/learningPath/collectionrules.md index 497aeff6414..e1d33904df7 100644 --- a/documentation/learningPath/collectionrules.md +++ b/documentation/learningPath/collectionrules.md @@ -77,4 +77,4 @@ Each collection rule pipeline has a [state holder](https://github.com/dotnet/dot ## Keeping Documentation Up-To-Date -When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/configuration.md#collection-rule-configuration). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/collectionrules). +When making changes to collection rules that require updates to configuration, these changes should be added [here](https://github.com/dotnet/dotnet-monitor/blob/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/configuration/collection-rule-configuration.md). Additional information on collection rules and examples can be provided [here](https://github.com/dotnet/dotnet-monitor/tree/341ff64a6097fe0bc66950e254e6160abcf77b84/documentation/collectionrules). From d4e2f16b609cee11a3fdfe9347d25f648eb4472d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 13:50:19 -0800 Subject: [PATCH 258/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 1916f87df9b..8039ce1c8d8 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,4 +1,3 @@ -const core = require('@actions/core'); const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; const linePrefix = "#L"; From d174dfd02a3059b9c04c9e6b406cdf5f64d94dfa Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:02:18 -0800 Subject: [PATCH 259/352] Update index.js --- .../learning-path-staleness-check/index.js | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 8039ce1c8d8..8d480e333c0 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -2,11 +2,6 @@ const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; const linePrefix = "#L"; const separator = " | "; -const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); -const oldHash = core.getInput('oldHash', { required: true }); -const newHash = core.getInput('newHash', { required: true }); -const excludeLinks = core.getInput('excludeLinks', { required: false }); -const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : []; modifiedFilesDict = {}; modifiedFilesUrlToFileName = {}; @@ -18,7 +13,7 @@ var suggestions = new Set(); const oldNewLinkSeparator = ' -> '; let modifiedFilesToCommit = []; -function AppendModifiedFilesToCommit(path) +function AppendModifiedFilesToCommit(path, core) { modifiedFilesToCommit.push(path) core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) @@ -29,7 +24,7 @@ function ReplaceOldWithNewText(content, oldText, newText) return content.replaceAll(oldText, newText); } -function UpdateModifiedFiles(fileName, path, learningPathFile) +function UpdateModifiedFiles(fileName, path, learningPathFile, core) { modifiedFilesUrlToFileName[path] = fileName; @@ -43,7 +38,7 @@ function UpdateModifiedFiles(fileName, path, learningPathFile) modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); } - SetOutput('modifiedFiles', modifiedFiles) + SetOutput('modifiedFiles', modifiedFiles, core) } function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) @@ -56,25 +51,25 @@ function BoldedText(text) return "**" + text + "**"; } -function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) +function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, core, lineNumber = undefined) { manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) - SetOutput('manuallyReview', manuallyReview) + SetOutput('manuallyReview', manuallyReview, core) } -function UpdateOutOfSync(link, learningPathFile) +function UpdateOutOfSync(link, learningPathFile, core) { outOfSync.add(link + separator + BoldedText(learningPathFile)) - SetOutput('outOfSync', outOfSync) + SetOutput('outOfSync', outOfSync, core) } -function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) +function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber, core) { suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) - SetOutput('suggestions', suggestions) + SetOutput('suggestions', suggestions, core) } -function SetOutput(outputName, outputSet) +function SetOutput(outputName, outputSet, core) { core.setOutput(outputName, Array.from(outputSet).join(",")) } @@ -123,7 +118,7 @@ function GetContent(path) { return undefined; } -function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile) +function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; @@ -144,7 +139,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (!link.includes(oldHash)) { - UpdateOutOfSync(link, learningPathFile); + UpdateOutOfSync(link, learningPathFile, core); continue } @@ -158,14 +153,14 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); - UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); + UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile, core); // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; var headContent = GetContent(linkFilePath) if (!headContent) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core); continue } const headContentLines = headContent.toString().split("\n"); @@ -179,7 +174,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (prevContentLines.length < oldLineNumber) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); } else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) { @@ -188,12 +183,12 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); } else { let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; - UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); + UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst, core); } } } @@ -209,7 +204,12 @@ const main = async () => { const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); const changedFilePaths = core.getInput('changedFilePaths', {required: false}); const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); - + const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); + const oldHash = core.getInput('oldHash', { required: true }); + const newHash = core.getInput('newHash', { required: true }); + const excludeLinks = core.getInput('excludeLinks', { required: false }); + const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : []; + if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory @@ -219,7 +219,7 @@ const main = async () => { const learningPathContents = actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { - ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile) + ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) } } catch (error) { console.log("Error: " + error) @@ -229,7 +229,7 @@ const main = async () => { }); actionUtils.writeFile(learningPathHashFile, newHash); - AppendModifiedFilesToCommit(learningPathHashFile) + AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { @@ -257,7 +257,7 @@ const main = async () => { actionUtils.writeFile(fullPath, replacedContent); if (content !== replacedContent) { - AppendModifiedFilesToCommit(fullPath) + AppendModifiedFilesToCommit(fullPath, core) } } catch (error) { console.log("Error: " + error) From 8ceb92785ba7ebcf082fb64ed5129f6fd94a8ecf Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:03:39 -0800 Subject: [PATCH 260/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 268d768d181175612dbf48c518c792ddfc4f5be4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:10:53 -0800 Subject: [PATCH 261/352] Update action-utils.js --- .github/actions/action-utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index 88491c7b226..da85b873f6d 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,4 +51,5 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); -module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); \ No newline at end of file +module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); +module.exports.readdir = (dirName, callback) => utils.promisify(fs.readdir)(dirName, callback); From 59cc2c7d6639b660fdde316ffbc230ad71adb81a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:12:41 -0800 Subject: [PATCH 262/352] Update action-utils.js --- .github/actions/action-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index da85b873f6d..1ff9ca7ea4e 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -52,4 +52,4 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); -module.exports.readdir = (dirName, callback) => utils.promisify(fs.readdir)(dirName, callback); +module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); From 36887429e02d5073c8e88c52a665eab8536ad824 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:21:56 -0800 Subject: [PATCH 263/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 8d480e333c0..89ab384a2f8 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -21,6 +21,7 @@ function AppendModifiedFilesToCommit(path, core) function ReplaceOldWithNewText(content, oldText, newText) { + console.log("Content: " + content); return content.replaceAll(oldText, newText); } @@ -122,6 +123,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; + console.log("learningPathContents: " + learningPathContents); for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { linkIndices.push(pos); } From 9846603582c56a39e0b6465abc720939e46b4265 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:25:17 -0800 Subject: [PATCH 264/352] Update index.js --- .../actions/learning-path-staleness-check/index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 89ab384a2f8..8aeac412219 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -21,7 +21,6 @@ function AppendModifiedFilesToCommit(path, core) function ReplaceOldWithNewText(content, oldText, newText) { - console.log("Content: " + content); return content.replaceAll(oldText, newText); } @@ -123,7 +122,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; - console.log("learningPathContents: " + learningPathContents); for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { linkIndices.push(pos); } @@ -215,10 +213,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { - files.forEach(learningPathFile => { + await actionUtils.readdir(learningPathDirectory, (_, files) => { + files.forEach(async learningPathFile => { try { - const learningPathContents = actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = await actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) @@ -234,11 +232,11 @@ const main = async () => { AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { - files.forEach(learningPathFile => { + await actionUtils.readdir(learningPathDirectory, (_, files) => { + files.forEach(async learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFile(fullPath) + const content = await actionUtils.readFile(fullPath) var replacedContent = content From 63bb41a2846184b7419ae857c71878ef8405558c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:28:30 -0800 Subject: [PATCH 265/352] Update action-utils.js --- .github/actions/action-utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index 1ff9ca7ea4e..6c023111e7f 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,5 +51,6 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); +module.exports.readFileSync = (fileName) => util.promisify(fs.readFileSync)(fileName, 'utf8'); module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); From 32dd3b2ef12603effb7a7942c1e21d67345ac181 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:29:12 -0800 Subject: [PATCH 266/352] Update index.js --- .../actions/learning-path-staleness-check/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 8aeac412219..8d480e333c0 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -213,10 +213,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - await actionUtils.readdir(learningPathDirectory, (_, files) => { - files.forEach(async learningPathFile => { + actionUtils.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { try { - const learningPathContents = await actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) @@ -232,11 +232,11 @@ const main = async () => { AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory - await actionUtils.readdir(learningPathDirectory, (_, files) => { - files.forEach(async learningPathFile => { + actionUtils.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = await actionUtils.readFile(fullPath) + const content = actionUtils.readFile(fullPath) var replacedContent = content From 60396d0524477f8631ba7fc051234e651a0c090b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:31:09 -0800 Subject: [PATCH 267/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 8d480e333c0..4b7c5c678f7 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -111,7 +111,7 @@ function StripLineNumber(link, linePrefixIndex) function GetContent(path) { try { - return actionUtils.readFile(path) + return actionUtils.readFileSync(path) } catch (error) {} @@ -216,7 +216,7 @@ const main = async () => { actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = actionUtils.readFile(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = actionUtils.readFileSync(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) @@ -236,7 +236,7 @@ const main = async () => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFile(fullPath) + const content = actionUtils.readFileSync(fullPath) var replacedContent = content From 11bc73f7419112ead152c351ed284168a49ed84d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:32:53 -0800 Subject: [PATCH 268/352] Update action-utils.js --- .github/actions/action-utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index 6c023111e7f..d8134927b75 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -53,4 +53,5 @@ module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); module.exports.readFileSync = (fileName) => util.promisify(fs.readFileSync)(fileName, 'utf8'); module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); +module.exports.writeFileSync = (fileName, contents) => util.promisify(fs.writeFileSync)(fileName, contents); module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); From 0feef6e8e879750077491532c53e6e43ad1e2f54 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:33:41 -0800 Subject: [PATCH 269/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 4b7c5c678f7..f2a452fc22c 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -228,7 +228,7 @@ const main = async () => { }); }); - actionUtils.writeFile(learningPathHashFile, newHash); + actionUtils.writeFileSync(learningPathHashFile, newHash); AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory @@ -254,7 +254,7 @@ const main = async () => { replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - actionUtils.writeFile(fullPath, replacedContent); + actionUtils.writeFileSync(fullPath, replacedContent); if (content !== replacedContent) { AppendModifiedFilesToCommit(fullPath, core) From 38df0a29eb12c65938ab0286717de48c87f27715 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:36:58 -0800 Subject: [PATCH 270/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index f2a452fc22c..1823950a9ef 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -21,6 +21,7 @@ function AppendModifiedFilesToCommit(path, core) function ReplaceOldWithNewText(content, oldText, newText) { + console.log("Content: " + content); return content.replaceAll(oldText, newText); } @@ -122,6 +123,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; + console.log("learningPathContents: " + learningPathContents); for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { linkIndices.push(pos); } From e51b987cbe545278ff5fb6213063b689be607237 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:39:39 -0800 Subject: [PATCH 271/352] Update action-utils.js --- .github/actions/action-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index d8134927b75..c42b23ffeb0 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,7 +51,7 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); -module.exports.readFileSync = (fileName) => util.promisify(fs.readFileSync)(fileName, 'utf8'); +module.exports.readFileSync = (fileName) => fs.readFileSync(fileName, 'utf8'); module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); -module.exports.writeFileSync = (fileName, contents) => util.promisify(fs.writeFileSync)(fileName, contents); +module.exports.writeFileSync = (fileName, contents) => fs.writeFileSync(fileName, contents); module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); From b972bd5817c571a404bfa65809728df7ed00b90a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:42:45 -0800 Subject: [PATCH 272/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 3b0cbaef077f0b0d06a5060841e547d58deba132 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:49:34 -0800 Subject: [PATCH 273/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From a41b4d36043ad66e022f37dc02f6728baa655ec3 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:49:52 -0800 Subject: [PATCH 274/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 1ae5b4b47a848476daed2d96763a7d708076f489 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:53:41 -0800 Subject: [PATCH 275/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 1823950a9ef..c0f543f61f6 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -21,7 +21,6 @@ function AppendModifiedFilesToCommit(path, core) function ReplaceOldWithNewText(content, oldText, newText) { - console.log("Content: " + content); return content.replaceAll(oldText, newText); } @@ -123,7 +122,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; - console.log("learningPathContents: " + learningPathContents); for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { linkIndices.push(pos); } @@ -218,7 +216,7 @@ const main = async () => { actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = actionUtils.readFileSync(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) From f60f7501e8a249ddd97c4d5a9ffc42c94118bf06 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:54:37 -0800 Subject: [PATCH 276/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From dcb8db8cb10c2b89eb4db031671ccab5e4d87f11 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:56:24 -0800 Subject: [PATCH 277/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 3f0a41edded5eae8db59c0d54921b709bdd03300 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:22:00 -0800 Subject: [PATCH 278/352] Update index.js --- .../learning-path-staleness-check/index.js | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index c0f543f61f6..b9014c00e96 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -9,36 +9,28 @@ modifiedFilesUrlToFileName = {}; var outOfSync = new Set(); var manuallyReview = new Set(); var suggestions = new Set(); +var modifiedFiles = new Set(); const oldNewLinkSeparator = ' -> '; -let modifiedFilesToCommit = []; - -function AppendModifiedFilesToCommit(path, core) -{ - modifiedFilesToCommit.push(path) - core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) -} function ReplaceOldWithNewText(content, oldText, newText) { return content.replaceAll(oldText, newText); } -function UpdateModifiedFiles(fileName, path, learningPathFile, core) +function UpdateModifiedFiles(fileName, path, learningPathFile) { modifiedFilesUrlToFileName[path] = fileName; modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; modifiedFilesDict[path].add(learningPathFile); - var modifiedFiles = new Set(); + modifiedFiles = new Set(); for (currPath in modifiedFilesDict) { const fileName = modifiedFilesUrlToFileName[currPath]; modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); } - - SetOutput('modifiedFiles', modifiedFiles, core) } function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) @@ -51,27 +43,19 @@ function BoldedText(text) return "**" + text + "**"; } -function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, core, lineNumber = undefined) +function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) { manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) - SetOutput('manuallyReview', manuallyReview, core) } -function UpdateOutOfSync(link, learningPathFile, core) +function UpdateOutOfSync(link, learningPathFile) { outOfSync.add(link + separator + BoldedText(learningPathFile)) - SetOutput('outOfSync', outOfSync, core) } -function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber, core) +function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) { suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) - SetOutput('suggestions', suggestions, core) -} - -function SetOutput(outputName, outputSet, core) -{ - core.setOutput(outputName, Array.from(outputSet).join(",")) } function CreateLink(fileName, path, lineNumber) @@ -118,7 +102,27 @@ function GetContent(path) { return undefined; } -function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) +function ConstructOutputText(core) +{ + var manuallyReviewSection = "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; + if (manuallyReview.size === 0) { manuallyReviewSection = ""; } + + var outOfSyncSection = "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; + if (outOfSync.size === 0) { outOfSyncSection = ""; } + + var suggestionsSection = "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; + if (suggestions.size === 0) { suggestionsSection = ""; } + + var modifiedFilesSection = "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; + if (modifiedFiles.size === 0) { modifiedFilesSection = ""; } + + var body = modifiedFilesSection + manuallyReviewSection + outOfSyncSection + suggestionsSection; + console.log("body=" + body); + + core.setOutput('outputText', body); +} + +function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; @@ -139,7 +143,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (!link.includes(oldHash)) { - UpdateOutOfSync(link, learningPathFile, core); + UpdateOutOfSync(link, learningPathFile); continue } @@ -153,14 +157,14 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); - UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile, core); + UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; var headContent = GetContent(linkFilePath) if (!headContent) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); continue } const headContentLines = headContent.toString().split("\n"); @@ -174,7 +178,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (prevContentLines.length < oldLineNumber) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); } else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) { @@ -183,12 +187,12 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); } else { let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; - UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst, core); + UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); } } } @@ -219,7 +223,7 @@ const main = async () => { const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { - ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) + ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) } } catch (error) { console.log("Error: " + error) @@ -229,16 +233,13 @@ const main = async () => { }); actionUtils.writeFileSync(learningPathHashFile, newHash); - AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFileSync(fullPath) - - var replacedContent = content + var content = actionUtils.readFileSync(fullPath) let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { @@ -248,17 +249,14 @@ const main = async () => { var newLink = suggestionArray[1] oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) + content = ReplaceOldWithNewText(content, oldLink, newLink) }) } - replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) + content = ReplaceOldWithNewText(content, oldHash, newHash) - actionUtils.writeFileSync(fullPath, replacedContent); + actionUtils.writeFileSync(fullPath, content); - if (content !== replacedContent) { - AppendModifiedFilesToCommit(fullPath, core) - } } catch (error) { console.log("Error: " + error) console.log("Could not find learning path file: " + learningPathFile) @@ -266,6 +264,8 @@ const main = async () => { }); }); + ConstructOutputText(core); + } catch (error) { core.setFailed(error.message); } From 9e441c0d4f1f7976c2b26628f305e3686054a8cd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:24:03 -0800 Subject: [PATCH 279/352] Update check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index c257b0c809f..5f5bfc436a5 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -68,48 +68,13 @@ jobs: newHash: ${{ env.new_sha }} learningPathHashFile: '.github/learning-path-sha.txt' - - name: Create PR Body - run: | - manuallyReview=$MANUALLY_REVIEW - manuallyReview=${manuallyReview//,/
} - manuallyReviewSection="

Manually Review:

${manuallyReview}
" - if [ -z "$manuallyReview" ]; then - manuallyReviewSection="" - fi - outOfSync=$OUT_OF_SYNC - outOfSync=${outOfSync//,/
} - outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" - if [ -z "$outOfSync" ]; then - outOfSyncSection="" - fi - suggestions=$SUGGESTIONS - suggestions=${suggestions//,/
} - suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" - if [ -z "$suggestions" ]; then - suggestionsSection="" - fi - modifiedFiles=$MODIFIED_FILES - modifiedFiles=${modifiedFiles//,/
} - modifiedFilesSection="

Modified Files:

${modifiedFiles}
" - if [ -z "$modifiedFiles" ]; then - modifiedFilesSection="" - fi - body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" - echo "body=$body" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MODIFIED_FILES: ${{ steps.check-links.outputs.modifiedFiles }} - MANUALLY_REVIEW: ${{ steps.check-links.outputs.manuallyReview }} - SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} - OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} - - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} + files_to_commit: "*" title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 8a963a949aeafee28393ef6d4fb2b72d2e8263ed Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:24:34 -0800 Subject: [PATCH 280/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 8ebfd99fb4f3fc8a42e7895b50e39dcefdb25809 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:28:36 -0800 Subject: [PATCH 281/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 5f5bfc436a5..ed2af7837e2 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -71,7 +71,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: "*" + files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} From bb78446fa493ea6887ae4afd67db50991ece4e98 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:29:12 -0800 Subject: [PATCH 282/352] Update index.js --- .../learning-path-staleness-check/index.js | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index b9014c00e96..52a7f4c6bd9 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -13,6 +13,14 @@ var modifiedFiles = new Set(); const oldNewLinkSeparator = ' -> '; +let modifiedFilesToCommit = []; + +function AppendModifiedFilesToCommit(path, core) +{ + modifiedFilesToCommit.push(path) + core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) +} + function ReplaceOldWithNewText(content, oldText, newText) { return content.replaceAll(oldText, newText); @@ -233,13 +241,16 @@ const main = async () => { }); actionUtils.writeFileSync(learningPathHashFile, newHash); + AppendModifiedFilesToCommit(learningPathHashFile, core) // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - var content = actionUtils.readFileSync(fullPath) + const content = actionUtils.readFileSync(fullPath) + + var replacedContent = content let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { @@ -249,14 +260,17 @@ const main = async () => { var newLink = suggestionArray[1] oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - content = ReplaceOldWithNewText(content, oldLink, newLink) + replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) }) } - content = ReplaceOldWithNewText(content, oldHash, newHash) + replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - actionUtils.writeFileSync(fullPath, content); + actionUtils.writeFileSync(fullPath, replacedContent); + if (content !== replacedContent) { + AppendModifiedFilesToCommit(fullPath, core) + } } catch (error) { console.log("Error: " + error) console.log("Could not find learning path file: " + learningPathFile) From e8bd6e6fb66ea88d2e792fd879f5d59f0ff721d8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:34:09 -0800 Subject: [PATCH 283/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 52a7f4c6bd9..5db4d1e7d33 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -232,6 +232,7 @@ const main = async () => { if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) + ConstructOutputText(core); } } catch (error) { console.log("Error: " + error) @@ -278,8 +279,6 @@ const main = async () => { }); }); - ConstructOutputText(core); - } catch (error) { core.setFailed(error.message); } From 7600fb759cb292efc748a83e735b6d0cd0f825e5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:40:48 -0800 Subject: [PATCH 284/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From d6e4f301ee51f34e34ab1386dc6b25afd992f629 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Thu, 1 Feb 2024 07:42:46 -0800 Subject: [PATCH 285/352] Flow changes from main to feature branch (#369) * Update index.js * Update check-learning-path-links.yml * Update EgressHelper.cs * Update check-learning-path-links.yml * Update index.js * Update index.js * Update EgressHelper.cs --- .../learning-path-staleness-check/index.js | 59 +++++++++++-------- .../workflows/check-learning-path-links.yml | 37 +----------- 2 files changed, 37 insertions(+), 59 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index c0f543f61f6..5db4d1e7d33 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -9,8 +9,10 @@ modifiedFilesUrlToFileName = {}; var outOfSync = new Set(); var manuallyReview = new Set(); var suggestions = new Set(); +var modifiedFiles = new Set(); const oldNewLinkSeparator = ' -> '; + let modifiedFilesToCommit = []; function AppendModifiedFilesToCommit(path, core) @@ -24,21 +26,19 @@ function ReplaceOldWithNewText(content, oldText, newText) return content.replaceAll(oldText, newText); } -function UpdateModifiedFiles(fileName, path, learningPathFile, core) +function UpdateModifiedFiles(fileName, path, learningPathFile) { modifiedFilesUrlToFileName[path] = fileName; modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; modifiedFilesDict[path].add(learningPathFile); - var modifiedFiles = new Set(); + modifiedFiles = new Set(); for (currPath in modifiedFilesDict) { const fileName = modifiedFilesUrlToFileName[currPath]; modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); } - - SetOutput('modifiedFiles', modifiedFiles, core) } function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) @@ -51,27 +51,19 @@ function BoldedText(text) return "**" + text + "**"; } -function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, core, lineNumber = undefined) +function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) { manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) - SetOutput('manuallyReview', manuallyReview, core) } -function UpdateOutOfSync(link, learningPathFile, core) +function UpdateOutOfSync(link, learningPathFile) { outOfSync.add(link + separator + BoldedText(learningPathFile)) - SetOutput('outOfSync', outOfSync, core) } -function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber, core) +function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) { suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) - SetOutput('suggestions', suggestions, core) -} - -function SetOutput(outputName, outputSet, core) -{ - core.setOutput(outputName, Array.from(outputSet).join(",")) } function CreateLink(fileName, path, lineNumber) @@ -118,7 +110,27 @@ function GetContent(path) { return undefined; } -function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) +function ConstructOutputText(core) +{ + var manuallyReviewSection = "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; + if (manuallyReview.size === 0) { manuallyReviewSection = ""; } + + var outOfSyncSection = "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; + if (outOfSync.size === 0) { outOfSyncSection = ""; } + + var suggestionsSection = "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; + if (suggestions.size === 0) { suggestionsSection = ""; } + + var modifiedFilesSection = "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; + if (modifiedFiles.size === 0) { modifiedFilesSection = ""; } + + var body = modifiedFilesSection + manuallyReviewSection + outOfSyncSection + suggestionsSection; + console.log("body=" + body); + + core.setOutput('outputText', body); +} + +function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) { // Get all indices where a link to the repo is found within the current learning path file var linkIndices = []; @@ -139,7 +151,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (!link.includes(oldHash)) { - UpdateOutOfSync(link, learningPathFile, core); + UpdateOutOfSync(link, learningPathFile); continue } @@ -153,14 +165,14 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); - UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile, core); + UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; var headContent = GetContent(linkFilePath) if (!headContent) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); continue } const headContentLines = headContent.toString().split("\n"); @@ -174,7 +186,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (prevContentLines.length < oldLineNumber) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); } else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) { @@ -183,12 +195,12 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, core, oldLineNumber); + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); } else { let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; - UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst, core); + UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); } } } @@ -219,7 +231,8 @@ const main = async () => { const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { - ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray, core) + ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) + ConstructOutputText(core); } } catch (error) { console.log("Error: " + error) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index c257b0c809f..ed2af7837e2 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -68,48 +68,13 @@ jobs: newHash: ${{ env.new_sha }} learningPathHashFile: '.github/learning-path-sha.txt' - - name: Create PR Body - run: | - manuallyReview=$MANUALLY_REVIEW - manuallyReview=${manuallyReview//,/
} - manuallyReviewSection="

Manually Review:

${manuallyReview}
" - if [ -z "$manuallyReview" ]; then - manuallyReviewSection="" - fi - outOfSync=$OUT_OF_SYNC - outOfSync=${outOfSync//,/
} - outOfSyncSection="

Links With Out Of Sync Commit Hashes:

${outOfSync}
" - if [ -z "$outOfSync" ]; then - outOfSyncSection="" - fi - suggestions=$SUGGESTIONS - suggestions=${suggestions//,/
} - suggestionsSection="

Auto-Applied Suggestions:

${suggestions}
" - if [ -z "$suggestions" ]; then - suggestionsSection="" - fi - modifiedFiles=$MODIFIED_FILES - modifiedFiles=${modifiedFiles//,/
} - modifiedFilesSection="

Modified Files:

${modifiedFiles}
" - if [ -z "$modifiedFiles" ]; then - modifiedFilesSection="" - fi - body="${modifiedFilesSection}${manuallyReviewSection}${outOfSyncSection}${suggestionsSection}" - echo "body=$body" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MODIFIED_FILES: ${{ steps.check-links.outputs.modifiedFiles }} - MANUALLY_REVIEW: ${{ steps.check-links.outputs.manuallyReview }} - SUGGESTIONS: ${{ steps.check-links.outputs.suggestions }} - OUT_OF_SYNC: ${{ steps.check-links.outputs.outOfSync }} - - name: Open PR uses: ./.github/actions/open-pr with: files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ env.body }} + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} branch_name: learningPathUpdates/${{ env.new_sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 58643ce60444a52048481ee2bf2f1b673ac1c03a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:23:07 -0800 Subject: [PATCH 286/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index ed2af7837e2..a7981c0c4eb 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -11,7 +11,6 @@ jobs: name: 'Check Learning Path Links' runs-on: ubuntu-latest permissions: - issues: write contents: write pull-requests: write From d51b6681dc58875237be57d6b0a2e114489443c0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:23:27 -0800 Subject: [PATCH 287/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From cfb17309aa152d42acb917f2146c1768d5130049 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:36:24 -0800 Subject: [PATCH 288/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 5db4d1e7d33..5a946111a35 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,5 +1,6 @@ const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; +const headPathPrefix = "head/"; const linePrefix = "#L"; const separator = " | "; @@ -170,7 +171,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; - var headContent = GetContent(linkFilePath) + var headContent = GetContent(headPathPrefix + linkFilePath) if (!headContent) { UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); continue @@ -212,7 +213,7 @@ const main = async () => { const [core] = await actionUtils.installAndRequirePackages("@actions/core"); try { - const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); + const learningPathDirectory = headPathPrefix + core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); const changedFilePaths = core.getInput('changedFilePaths', {required: false}); const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); From d6db61d5837e64bc1dcc38f7645ebcd2b8a22976 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:38:21 -0800 Subject: [PATCH 289/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a7981c0c4eb..56f64b13889 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -41,6 +41,7 @@ jobs: with: persist-credentials: true ref: main + path: head - name: Checkout previous update uses: actions/checkout@v4 @@ -70,6 +71,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: + path: head files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths From 1be03fb594b0386f3e9f475294ac1a280259aba2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:40:13 -0800 Subject: [PATCH 290/352] Update action.yml --- .github/actions/open-pr/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 565c0b17a4d..9e5c218c409 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -1,6 +1,9 @@ name: 'Open PR' description: 'Opens a PR targeting the currently checked out out branch.' inputs: + path: + description: 'The path for opening the PR' + required: false branch_name: description: 'The branch name to create. Will be prefixed with "bot/".' required: true @@ -40,6 +43,7 @@ runs: steps: - name: Open PR run: | + cd $path current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From 865322ac6e7984a78e78cc9c6e9d62953f9296e1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:44:51 -0800 Subject: [PATCH 291/352] Update action.yml --- .github/actions/open-pr/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 9e5c218c409..c9fe8877c93 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -42,8 +42,8 @@ runs: using: "composite" steps: - name: Open PR + working-directory: ./head run: | - cd $path current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From d2d5d256d1bcf38c42564a09c6292799baacbedd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:46:31 -0800 Subject: [PATCH 292/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 56f64b13889..b8adfbe1174 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -72,7 +72,7 @@ jobs: uses: ./.github/actions/open-pr with: path: head - files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} + files_to_commit: "*" title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} From f92dff2eb06fad23eb5e0a3de7ba33f92df9ca4d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:54:07 -0800 Subject: [PATCH 293/352] Update action.yml --- .github/actions/open-pr/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index c9fe8877c93..565c0b17a4d 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -1,9 +1,6 @@ name: 'Open PR' description: 'Opens a PR targeting the currently checked out out branch.' inputs: - path: - description: 'The path for opening the PR' - required: false branch_name: description: 'The branch name to create. Will be prefixed with "bot/".' required: true @@ -42,7 +39,6 @@ runs: using: "composite" steps: - name: Open PR - working-directory: ./head run: | current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From d0c9eb1df488e30592e85ec994f330212f5dde64 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:54:34 -0800 Subject: [PATCH 294/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index b8adfbe1174..62263063fc9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main @@ -71,7 +71,6 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - path: head files_to_commit: "*" title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths From a2bba1047ebc46388928032ea329e8141fa93bc2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:58:56 -0800 Subject: [PATCH 295/352] Update action.yml --- .github/actions/open-pr/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 565c0b17a4d..774f007e338 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -40,6 +40,8 @@ runs: steps: - name: Open PR run: | + cd ./head + pwd current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From 08cf0d440558da0511d53423b96f70515a517af8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:59:38 -0800 Subject: [PATCH 296/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 62263063fc9..45ecccb100b 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main From 3b4f5fbc164670fff37737088590ee5e7c21307b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:01:45 -0800 Subject: [PATCH 297/352] Update action.yml --- .github/actions/open-pr/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 774f007e338..524711499c5 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -40,7 +40,7 @@ runs: steps: - name: Open PR run: | - cd ./head + cd ../head/dotnet-monitor pwd current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From 70129cb5b5691fc08d32be891deed0c00dc37049 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:03:03 -0800 Subject: [PATCH 298/352] Update action.yml --- .github/actions/open-pr/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 524711499c5..aea1fabe77f 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -40,8 +40,8 @@ runs: steps: - name: Open PR run: | - cd ../head/dotnet-monitor pwd + ls current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From 97819ff546aae88642270bdb31a58e30bb6bc1fe Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:07:33 -0800 Subject: [PATCH 299/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 5a946111a35..a7b48d8768a 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -213,7 +213,7 @@ const main = async () => { const [core] = await actionUtils.installAndRequirePackages("@actions/core"); try { - const learningPathDirectory = headPathPrefix + core.getInput('learningPathsDirectory', { required: true }); + const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); const changedFilePaths = core.getInput('changedFilePaths', {required: false}); const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); @@ -226,10 +226,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { + actionUtils.readdir(headPathPrefix + learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = GetContent(headPathPrefix + learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) From 58e96f4b66f4d6406689a42b13fe6541b5d2ad2f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:12:54 -0800 Subject: [PATCH 300/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 45ecccb100b..3db9212d256 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main @@ -39,7 +39,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false ref: main path: head From d4521e420275eb4f101492253b8d1218053173f7 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:16:02 -0800 Subject: [PATCH 301/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 3db9212d256..5e0f679c60a 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main @@ -56,6 +56,13 @@ jobs: echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + ref: main + - name: Check Learning Path Links id: check-links uses: ./.github/actions/learning-path-staleness-check From a7329840912e345886c4f38c3228af1772ac21b0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:22:41 -0800 Subject: [PATCH 302/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 5e0f679c60a..441657c18ac 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -56,13 +56,6 @@ jobs: echo "Files to validate: '${changed_source_files}'" echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations - ref: main - - name: Check Learning Path Links id: check-links uses: ./.github/actions/learning-path-staleness-check @@ -75,6 +68,13 @@ jobs: newHash: ${{ env.new_sha }} learningPathHashFile: '.github/learning-path-sha.txt' + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true + fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + ref: main + - name: Open PR uses: ./.github/actions/open-pr with: From 12f15ab5cb3a325ba263edc3d4fbaf464d50fd77 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:23:42 -0800 Subject: [PATCH 303/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 441657c18ac..3db9212d256 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main @@ -68,13 +68,6 @@ jobs: newHash: ${{ env.new_sha }} learningPathHashFile: '.github/learning-path-sha.txt' - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations - ref: main - - name: Open PR uses: ./.github/actions/open-pr with: From 194989aa0785115f022d506f0bf7db985819abc2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:26:18 -0800 Subject: [PATCH 304/352] Update action.yml --- .github/actions/open-pr/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index aea1fabe77f..0d72bbc4452 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -39,6 +39,7 @@ runs: using: "composite" steps: - name: Open PR + working-directory: ./head run: | pwd ls From 21f1847afbae7e78c51782262428a420d80d2b71 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:29:22 -0800 Subject: [PATCH 305/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index a7b48d8768a..81d0a7caf90 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -171,7 +171,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l // This is the line number in the learning path file that contains the link - not the #L line number in the link itself const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; - var headContent = GetContent(headPathPrefix + linkFilePath) + var headContent = GetContent(linkFilePath) if (!headContent) { UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); continue @@ -213,10 +213,10 @@ const main = async () => { const [core] = await actionUtils.installAndRequirePackages("@actions/core"); try { - const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); + const learningPathDirectory = headPathPrefix + core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); const changedFilePaths = core.getInput('changedFilePaths', {required: false}); - const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); + const learningPathHashFile = headPathPrefix + core.getInput('learningPathHashFile', { required: true }); const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); const oldHash = core.getInput('oldHash', { required: true }); const newHash = core.getInput('newHash', { required: true }); @@ -226,10 +226,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(headPathPrefix + learningPathDirectory, (_, files) => { + actionUtils.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = GetContent(headPathPrefix + learningPathDirectory + "/" + learningPathFile) + const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) From cd897b168e615acf76cf777e74e923c84db27aeb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:37:42 -0800 Subject: [PATCH 306/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 3db9212d256..45ecccb100b 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,7 +18,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: true + persist-credentials: false fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main @@ -39,7 +39,7 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false + persist-credentials: true ref: main path: head From ac92422a99113d043a4aca3211e8024513638a8f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:43:16 -0800 Subject: [PATCH 307/352] Update index.js --- .../learning-path-staleness-check/index.js | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 81d0a7caf90..082ae055f21 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -14,14 +14,6 @@ var modifiedFiles = new Set(); const oldNewLinkSeparator = ' -> '; -let modifiedFilesToCommit = []; - -function AppendModifiedFilesToCommit(path, core) -{ - modifiedFilesToCommit.push(path) - core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) -} - function ReplaceOldWithNewText(content, oldText, newText) { return content.replaceAll(oldText, newText); @@ -242,18 +234,17 @@ const main = async () => { }); }); - actionUtils.writeFileSync(learningPathHashFile, newHash); - AppendModifiedFilesToCommit(learningPathHashFile, core) - // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { + + console.log("Writing new hash to file: " + learningPathHashFile); + actionUtils.writeFileSync(learningPathHashFile, newHash); + files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile const content = actionUtils.readFileSync(fullPath) - var replacedContent = content - let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { suggestionsArray.forEach(suggestion => { @@ -262,17 +253,13 @@ const main = async () => { var newLink = suggestionArray[1] oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) + content = ReplaceOldWithNewText(content, oldLink, newLink) }) } - replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - - actionUtils.writeFileSync(fullPath, replacedContent); - - if (content !== replacedContent) { - AppendModifiedFilesToCommit(fullPath, core) - } + console.log("Writing new content to file: " + fullPath); + content = ReplaceOldWithNewText(content, oldHash, newHash) + actionUtils.writeFileSync(fullPath, content); } catch (error) { console.log("Error: " + error) console.log("Could not find learning path file: " + learningPathFile) From 02b7e1367fdb4bf35f33f892cca702c3218231d3 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 08:45:28 -0800 Subject: [PATCH 308/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 082ae055f21..3468025195a 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -243,7 +243,7 @@ const main = async () => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFileSync(fullPath) + let content = actionUtils.readFileSync(fullPath) let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { From f17576861cdd038a64ca93b5e2829ef6debb37ab Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:01:43 -0800 Subject: [PATCH 309/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 3468025195a..1303cec33b6 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -236,9 +236,6 @@ const main = async () => { // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { - - console.log("Writing new hash to file: " + learningPathHashFile); - actionUtils.writeFileSync(learningPathHashFile, newHash); files.forEach(learningPathFile => { try { @@ -267,6 +264,9 @@ const main = async () => { }); }); + console.log("Writing new hash to file: " + learningPathHashFile); + actionUtils.writeFileSync(learningPathHashFile, newHash); + } catch (error) { core.setFailed(error.message); } From ed0d0ea392f46205f85fa07942f515945539e677 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:08:27 -0800 Subject: [PATCH 310/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 45ecccb100b..1352ebb7295 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -41,6 +41,7 @@ jobs: with: persist-credentials: true ref: main + fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations path: head - name: Checkout previous update From 384d33a64c4c7a58363207e9f5329f95aadf26fb Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:13:49 -0800 Subject: [PATCH 311/352] Update action.yml --- .github/actions/open-pr/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index 0d72bbc4452..aea1fabe77f 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -39,7 +39,6 @@ runs: using: "composite" steps: - name: Open PR - working-directory: ./head run: | pwd ls From 10f3c72a84e2c5aa1d34011cb7a2ca58eda6a7a9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:16:29 -0800 Subject: [PATCH 312/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index ed2af7837e2..a7981c0c4eb 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -11,7 +11,6 @@ jobs: name: 'Check Learning Path Links' runs-on: ubuntu-latest permissions: - issues: write contents: write pull-requests: write From 00a49a5eee060085317efb208007157e0019977a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:34:15 -0800 Subject: [PATCH 313/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 1352ebb7295..de5c7e609a9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -72,7 +72,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: "*" + files_to_commit: --all -- :!prev title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} From afb2c1f4e4ef3bb73e7a32433edd134a5a8083d0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:36:59 -0800 Subject: [PATCH 314/352] Update action.yml --- .github/actions/open-pr/action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/open-pr/action.yml b/.github/actions/open-pr/action.yml index aea1fabe77f..565c0b17a4d 100644 --- a/.github/actions/open-pr/action.yml +++ b/.github/actions/open-pr/action.yml @@ -40,8 +40,6 @@ runs: steps: - name: Open PR run: | - pwd - ls current_branch_name=$(git symbolic-ref --short HEAD) pr_branch_name="bot/$BRANCH_NAME" From d20cfa5fb5a1f35f0c90d869aab89ac1660d3540 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:48:18 -0800 Subject: [PATCH 315/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index de5c7e609a9..a7981c0c4eb 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -41,8 +41,6 @@ jobs: with: persist-credentials: true ref: main - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations - path: head - name: Checkout previous update uses: actions/checkout@v4 @@ -72,7 +70,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: --all -- :!prev + files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} From c03cdca5334904522fa6a08d6eb0edb50ca12380 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:50:34 -0800 Subject: [PATCH 316/352] Update index.js --- .../actions/learning-path-staleness-check/index.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 1303cec33b6..eb35605cfda 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,6 +1,5 @@ const actionUtils = require('../action-utils.js'); const prevPathPrefix = "prev/"; -const headPathPrefix = "head/"; const linePrefix = "#L"; const separator = " | "; @@ -205,10 +204,10 @@ const main = async () => { const [core] = await actionUtils.installAndRequirePackages("@actions/core"); try { - const learningPathDirectory = headPathPrefix + core.getInput('learningPathsDirectory', { required: true }); + const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); const changedFilePaths = core.getInput('changedFilePaths', {required: false}); - const learningPathHashFile = headPathPrefix + core.getInput('learningPathHashFile', { required: true }); + const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); const oldHash = core.getInput('oldHash', { required: true }); const newHash = core.getInput('newHash', { required: true }); @@ -234,6 +233,8 @@ const main = async () => { }); }); + actionUtils.writeFileSync(learningPathHashFile, newHash); + // Scan each file in the learningPaths directory actionUtils.readdir(learningPathDirectory, (_, files) => { @@ -254,7 +255,6 @@ const main = async () => { }) } - console.log("Writing new content to file: " + fullPath); content = ReplaceOldWithNewText(content, oldHash, newHash) actionUtils.writeFileSync(fullPath, content); } catch (error) { @@ -264,9 +264,6 @@ const main = async () => { }); }); - console.log("Writing new hash to file: " + learningPathHashFile); - actionUtils.writeFileSync(learningPathHashFile, newHash); - } catch (error) { core.setFailed(error.message); } From 8005f35746ed97941d249fb0be4d52db9bcfc1c4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:53:31 -0800 Subject: [PATCH 317/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a7981c0c4eb..9e0226b4806 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -70,7 +70,7 @@ jobs: - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} + files_to_commit: --all -- :!prev title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} From 978fbc64ba61c239736e33e2abf6da3b45351fe5 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 09:54:45 -0800 Subject: [PATCH 318/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 1a18acbac49889793d943fccc340b07521b73f7e Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:04:21 -0800 Subject: [PATCH 319/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index eb35605cfda..974e235f8a4 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -84,7 +84,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. "); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } From 4a08e9c7cc8edbab8474e168575cd40d618b41f4 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:06:13 -0800 Subject: [PATCH 320/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 131cd2a084d430311839e1cb760ef3bc716ff7b9 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:23:57 -0800 Subject: [PATCH 321/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 974e235f8a4..25bc749497f 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -85,6 +85,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. + console.log("illegalCharIndex=" + illegalCharIndex) return illegalCharIndex; } From 56d2abad2f7cac511e9e5388e9871f5350963485 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:39:11 -0800 Subject: [PATCH 322/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 9e0226b4806..fcdec4c2d09 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -22,19 +22,11 @@ jobs: fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations ref: main - - name: Get current SHA - id: get_new_sha - run: | - new_sha=$(git rev-parse HEAD) - echo "new_sha=$new_sha" >> $GITHUB_ENV - - name: Get previous update SHA id: get_sha run: | - cd .github - prev_sha=$(cat learning-path-sha.txt) + prev_sha=$(cat .github/learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV - cd ../ - name: Checkout head uses: actions/checkout@v4 @@ -64,7 +56,7 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: ${{ env.new_sha }} + newHash: ${{ GITHUB_SHA }} learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR @@ -74,6 +66,6 @@ jobs: title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/${{ env.new_sha }} + branch_name: learningPathUpdates/${{ GITHUB_SHA }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 9ccbdc8fa7a1cb442f9abc7f230de41b2204aca6 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:43:11 -0800 Subject: [PATCH 323/352] Update index.js --- .../learning-path-staleness-check/index.js | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 25bc749497f..b87d857cd56 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,4 +1,5 @@ const actionUtils = require('../action-utils.js'); +const fs = require('fs'); const prevPathPrefix = "prev/"; const linePrefix = "#L"; const separator = " | "; @@ -85,7 +86,6 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. - console.log("illegalCharIndex=" + illegalCharIndex) return illegalCharIndex; } @@ -96,7 +96,7 @@ function StripLineNumber(link, linePrefixIndex) function GetContent(path) { try { - return actionUtils.readFileSync(path) + return fs.readFileSync(path, 'utf8'); } catch (error) {} @@ -105,21 +105,17 @@ function GetContent(path) { function ConstructOutputText(core) { - var manuallyReviewSection = "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; - if (manuallyReview.size === 0) { manuallyReviewSection = ""; } + var body = ""; - var outOfSyncSection = "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; - if (outOfSync.size === 0) { outOfSyncSection = ""; } + if (manuallyReview.size > 0) { body += "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; } - var suggestionsSection = "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; - if (suggestions.size === 0) { suggestionsSection = ""; } + if (outOfSync.size > 0) { body += "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; } - var modifiedFilesSection = "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; - if (modifiedFiles.size === 0) { modifiedFilesSection = ""; } + if (suggestions.size > 0) { body += "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; } - var body = modifiedFilesSection + manuallyReviewSection + outOfSyncSection + suggestionsSection; - console.log("body=" + body); + if (modifiedFiles.size > 0) { body += "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; } + console.log("body=" + body); core.setOutput('outputText', body); } @@ -139,6 +135,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } + console.log("Debug 1") + const pathStartIndex = link.indexOf(sourceDirectoryName); if (pathStartIndex === -1) { continue } @@ -218,7 +216,7 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { + fs.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) @@ -234,15 +232,15 @@ const main = async () => { }); }); - actionUtils.writeFileSync(learningPathHashFile, newHash); + fs.writeFileSync(learningPathHashFile, newHash); // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { + fs.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { const fullPath = learningPathDirectory + "/" + learningPathFile - let content = actionUtils.readFileSync(fullPath) + let content = fs.readFileSync(fullPath, 'utf8') let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { @@ -257,7 +255,7 @@ const main = async () => { } content = ReplaceOldWithNewText(content, oldHash, newHash) - actionUtils.writeFileSync(fullPath, content); + fs.writeFileSync(fullPath, content); } catch (error) { console.log("Error: " + error) console.log("Could not find learning path file: " + learningPathFile) From 35dd890464ca3210b37f2987ec2e8909a91b9a14 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:44:38 -0800 Subject: [PATCH 324/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index fcdec4c2d09..75582da9f76 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -56,7 +56,7 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: ${{ GITHUB_SHA }} + newHash: $GITHUB_SHA learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR @@ -66,6 +66,6 @@ jobs: title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/${{ GITHUB_SHA }} + branch_name: learningPathUpdates/$GITHUB_SHA fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 567892df81b7cd9f9d03a2a4136cdf09aa984062 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:46:18 -0800 Subject: [PATCH 325/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 75582da9f76..7773741b989 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -56,7 +56,7 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: $GITHUB_SHA + newHash: $("GITHUB_SHA") learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR @@ -66,6 +66,6 @@ jobs: title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/$GITHUB_SHA + branch_name: learningPathUpdates/$("GITHUB_SHA") fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 68fa36149ddfec4644b669a3642b4a69e11ee89c Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:48:36 -0800 Subject: [PATCH 326/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 7773741b989..0c1d24abe3d 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,8 +18,8 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + persist-credentials: true # need this for opening a PR + fetch-depth: 0 ref: main - name: Get previous update SHA @@ -28,12 +28,6 @@ jobs: prev_sha=$(cat .github/learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - ref: main - - name: Checkout previous update uses: actions/checkout@v4 with: @@ -56,7 +50,7 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: $("GITHUB_SHA") + newHash: ${{ env.GITHUB_SHA }} learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR @@ -66,6 +60,6 @@ jobs: title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/$("GITHUB_SHA") + branch_name: learningPathUpdates/${{ env.GITHUB_SHA }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From f715577c8a9ee75fa7c13040cb7f17810da282dc Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:51:56 -0800 Subject: [PATCH 327/352] Update check-learning-path-links.yml --- .github/workflows/check-learning-path-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 0c1d24abe3d..7b9f4f0a6f9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -50,7 +50,7 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: ${{ env.GITHUB_SHA }} + newHash: ${{ github.sha }} learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR @@ -60,6 +60,6 @@ jobs: title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/${{ env.GITHUB_SHA }} + branch_name: learningPathUpdates/${{ github.sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 7b2f5d25c00cdf9a4834cb70000a9f1630f0d32f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:56:50 -0800 Subject: [PATCH 328/352] Update index.js --- .../learning-path-staleness-check/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index b87d857cd56..ea87e4afe2c 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -138,8 +138,13 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l console.log("Debug 1") const pathStartIndex = link.indexOf(sourceDirectoryName); + + console.log("Path start index: " + pathStartIndex); + if (pathStartIndex === -1) { continue } + console.log("Still here: "); + if (!link.includes(oldHash)) { UpdateOutOfSync(link, learningPathFile); @@ -150,6 +155,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l const linkHasLineNumber = linePrefixIndex !== -1; const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink; + console.log("Still here 2: "); + // Check if the file being referenced by the link is one of the modified files in the PR const linkFilePath = link.substring(pathStartIndex, pathEndIndex); if (modifiedPRFiles.includes(linkFilePath)) @@ -168,6 +175,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l } const headContentLines = headContent.toString().split("\n"); + console.log("Still here 3: "); + if (!linkHasLineNumber) { continue; } const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length)); @@ -175,6 +184,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (!prevContent) { continue; } const prevContentLines = prevContent.toString().split("\n"); + console.log("Still here 4: "); + if (prevContentLines.length < oldLineNumber) { UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); @@ -219,7 +230,7 @@ const main = async () => { fs.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = GetContent(path.join(learningPathDirectory, learningPathFile)) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) @@ -239,7 +250,7 @@ const main = async () => { files.forEach(learningPathFile => { try { - const fullPath = learningPathDirectory + "/" + learningPathFile + const fullPath = path.join(learningPathDirectory, learningPathFile) let content = fs.readFileSync(fullPath, 'utf8') let suggestionsArray = Array.from(suggestions); From 865b4a9d86aa0a022ce74e4836da034c90e36177 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:58:44 -0800 Subject: [PATCH 329/352] Update check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 345 ++++++++++++++---- 1 file changed, 282 insertions(+), 63 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 7b9f4f0a6f9..5fff7f6563b 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,65 +1,284 @@ -name: 'Check Learning Path Links' -on: - schedule: # Run once a month - - cron: '0 0 1 * *' - workflow_dispatch: +const actionUtils = require('../action-utils.js'); +const fs = require('fs'); +const path = require('path'); +const prevPathPrefix = "prev/"; +const linePrefix = "#L"; +const separator = " | "; -permissions: {} +modifiedFilesDict = {}; +modifiedFilesUrlToFileName = {}; + +var outOfSync = new Set(); +var manuallyReview = new Set(); +var suggestions = new Set(); +var modifiedFiles = new Set(); + +const oldNewLinkSeparator = ' -> '; + +function ReplaceOldWithNewText(content, oldText, newText) +{ + return content.replaceAll(oldText, newText); +} + +function UpdateModifiedFiles(fileName, path, learningPathFile) +{ + modifiedFilesUrlToFileName[path] = fileName; + + modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; + modifiedFilesDict[path].add(learningPathFile); + + modifiedFiles = new Set(); + for (currPath in modifiedFilesDict) + { + const fileName = modifiedFilesUrlToFileName[currPath]; + modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); + } +} + +function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) +{ + return CreateLink(fileName, path, undefined) + separator + BoldedText(learningPathFiles.join(" ")); +} + +function BoldedText(text) +{ + return "**" + text + "**"; +} + +function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) +{ + manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) +} + +function UpdateOutOfSync(link, learningPathFile) +{ + outOfSync.add(link + separator + BoldedText(learningPathFile)) +} + +function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) +{ + suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) +} + +function CreateLink(fileName, path, lineNumber) +{ + var codeFileLink = "[" + fileName + "]" + "(" + path + ")" + return AppendLineNumber(codeFileLink, lineNumber) +} + +function AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber) +{ + var codeFileLink = CreateLink(fileName, oldPath, oldLineNumber) + + if (newPath && newLineNumber) { + codeFileLink += oldNewLinkSeparator + CreateLink(fileName, newPath, newLineNumber) + } + + return codeFileLink + separator + BoldedText(AppendLineNumber(learningPathFile, learningPathLineNumber, undefined)); +} + +function AppendLineNumber(text, lineNumber) +{ + if (!lineNumber) { return text } + + return text + " " + linePrefix + lineNumber +} + +function CheckForEndOfLink(str, startIndex) +{ + const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. + return illegalCharIndex; +} + +function StripLineNumber(link, linePrefixIndex) +{ + return link.substring(0, linePrefixIndex); +} + +function GetContent(path) { + try { + return fs.readFileSync(path, 'utf8'); + } + catch (error) {} + + return undefined; +} + +function ConstructOutputText(core) +{ + var body = ""; + + if (manuallyReview.size > 0) { body += "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; } + + if (outOfSync.size > 0) { body += "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; } + + if (suggestions.size > 0) { body += "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; } + + if (modifiedFiles.size > 0) { body += "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; } + + console.log("body=" + body); + core.setOutput('outputText', body); +} + +function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) +{ + // Get all indices where a link to the repo is found within the current learning path file + var linkIndices = []; + for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { + linkIndices.push(pos); + } + + for(let startOfLink of linkIndices) + { + // Clean up the link, determine if it has a line number suffix + const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + const link = learningPathContents.substring(startOfLink, endOfLink); + + if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } + + console.log("Debug 1") + + const pathStartIndex = link.indexOf(sourceDirectoryName); + + console.log("Path start index: " + pathStartIndex); + + if (pathStartIndex === -1) { continue } + + console.log("Still here: "); + + if (!link.includes(oldHash)) + { + UpdateOutOfSync(link, learningPathFile); + continue + } + + const linePrefixIndex = link.indexOf(linePrefix); + const linkHasLineNumber = linePrefixIndex !== -1; + const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink; + + console.log("Still here 2: "); + + // Check if the file being referenced by the link is one of the modified files in the PR + const linkFilePath = link.substring(pathStartIndex, pathEndIndex); + if (modifiedPRFiles.includes(linkFilePath)) + { + const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); + + UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); + + // This is the line number in the learning path file that contains the link - not the #L line number in the link itself + const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; + + var headContent = GetContent(linkFilePath) + if (!headContent) { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); + continue + } + const headContentLines = headContent.toString().split("\n"); + + console.log("Still here 3: "); + + if (!linkHasLineNumber) { continue; } + const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length)); + + var prevContent = GetContent(prevPathPrefix + linkFilePath) + if (!prevContent) { continue; } + const prevContentLines = prevContent.toString().split("\n"); + + console.log("Still here 4: "); + + if (prevContentLines.length < oldLineNumber) + { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + } + else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) + { + const newLineNumberLast = headContentLines.lastIndexOf(prevContentLines[oldLineNumber - 1]) + 1; + const newLineNumberFirst = headContentLines.indexOf(prevContentLines[oldLineNumber - 1]) + 1; + + if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file + { + UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); + } + else + { + let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; + UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); + } + } + } + } +} + +const main = async () => { + + const [core] = await actionUtils.installAndRequirePackages("@actions/core"); + + try { + const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); + const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); + const changedFilePaths = core.getInput('changedFilePaths', {required: false}); + const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); + const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); + const oldHash = core.getInput('oldHash', { required: true }); + const newHash = core.getInput('newHash', { required: true }); + const excludeLinks = core.getInput('excludeLinks', { required: false }); + const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : []; + + if (changedFilePaths === null || changedFilePaths.trim() === "") { return } + + // Scan each file in the learningPaths directory + fs.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { + try { + const learningPathContents = GetContent(path.join(learningPathDirectory, learningPathFile)) + if (learningPathContents) + { + ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) + ConstructOutputText(core); + } + } catch (error) { + console.log("Error: " + error) + console.log("Could not find learning path file: " + learningPathFile) + } + }); + }); + + fs.writeFileSync(learningPathHashFile, newHash); + + // Scan each file in the learningPaths directory + fs.readdir(learningPathDirectory, (_, files) => { -jobs: - check-learning-path-links: - name: 'Check Learning Path Links' - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - - steps: - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true # need this for opening a PR - fetch-depth: 0 - ref: main - - - name: Get previous update SHA - id: get_sha - run: | - prev_sha=$(cat .github/learning-path-sha.txt) - echo "prev_sha=$prev_sha" >> $GITHUB_ENV - - - name: Checkout previous update - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: ${{ env.prev_sha }} - path: prev - - - name: Get changed files - run: | - changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) - echo "Files to validate: '${changed_source_files}'" - echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV - - - name: Check Learning Path Links - id: check-links - uses: ./.github/actions/learning-path-staleness-check - with: - repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' - learningPathsDirectory: 'documentation/learningPath' - changedFilePaths: ${{ env.updated_files }} - sourceDirectoryName: 'src' - oldHash: ${{ env.prev_sha }} - newHash: ${{ github.sha }} - learningPathHashFile: '.github/learning-path-sha.txt' - - - name: Open PR - uses: ./.github/actions/open-pr - with: - files_to_commit: --all -- :!prev - title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" - commit_message: Update Learning Paths - body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/${{ github.sha }} - fail_if_files_unchanged: true - auth_token: ${{ secrets.GITHUB_TOKEN }} + files.forEach(learningPathFile => { + try { + const fullPath = path.join(learningPathDirectory, learningPathFile) + let content = fs.readFileSync(fullPath, 'utf8') + + let suggestionsArray = Array.from(suggestions); + if (suggestionsArray && suggestionsArray.length > 0) { + suggestionsArray.forEach(suggestion => { + const suggestionArray = suggestion.split(oldNewLinkSeparator) + var oldLink = suggestionArray[0] + var newLink = suggestionArray[1] + oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) + newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) + content = ReplaceOldWithNewText(content, oldLink, newLink) + }) + } + + content = ReplaceOldWithNewText(content, oldHash, newHash) + fs.writeFileSync(fullPath, content); + } catch (error) { + console.log("Error: " + error) + console.log("Could not find learning path file: " + learningPathFile) + } + }); + }); + + } catch (error) { + core.setFailed(error.message); + } +} + +// Call the main function to run the action +main(); From 049a59919efced9da37be438514830190075ee4b Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:59:34 -0800 Subject: [PATCH 330/352] Update check-learning-path-links.yml --- .../workflows/check-learning-path-links.yml | 345 ++++-------------- 1 file changed, 63 insertions(+), 282 deletions(-) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index 5fff7f6563b..7b9f4f0a6f9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -1,284 +1,65 @@ -const actionUtils = require('../action-utils.js'); -const fs = require('fs'); -const path = require('path'); -const prevPathPrefix = "prev/"; -const linePrefix = "#L"; -const separator = " | "; +name: 'Check Learning Path Links' +on: + schedule: # Run once a month + - cron: '0 0 1 * *' + workflow_dispatch: -modifiedFilesDict = {}; -modifiedFilesUrlToFileName = {}; - -var outOfSync = new Set(); -var manuallyReview = new Set(); -var suggestions = new Set(); -var modifiedFiles = new Set(); - -const oldNewLinkSeparator = ' -> '; - -function ReplaceOldWithNewText(content, oldText, newText) -{ - return content.replaceAll(oldText, newText); -} - -function UpdateModifiedFiles(fileName, path, learningPathFile) -{ - modifiedFilesUrlToFileName[path] = fileName; - - modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; - modifiedFilesDict[path].add(learningPathFile); - - modifiedFiles = new Set(); - for (currPath in modifiedFilesDict) - { - const fileName = modifiedFilesUrlToFileName[currPath]; - modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); - } -} - -function AssembleModifiedFilesOutput(fileName, path, learningPathFiles) -{ - return CreateLink(fileName, path, undefined) + separator + BoldedText(learningPathFiles.join(" ")); -} - -function BoldedText(text) -{ - return "**" + text + "**"; -} - -function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined) -{ - manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber)) -} - -function UpdateOutOfSync(link, learningPathFile) -{ - outOfSync.add(link + separator + BoldedText(learningPathFile)) -} - -function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber) -{ - suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)) -} - -function CreateLink(fileName, path, lineNumber) -{ - var codeFileLink = "[" + fileName + "]" + "(" + path + ")" - return AppendLineNumber(codeFileLink, lineNumber) -} - -function AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber) -{ - var codeFileLink = CreateLink(fileName, oldPath, oldLineNumber) - - if (newPath && newLineNumber) { - codeFileLink += oldNewLinkSeparator + CreateLink(fileName, newPath, newLineNumber) - } - - return codeFileLink + separator + BoldedText(AppendLineNumber(learningPathFile, learningPathLineNumber, undefined)); -} - -function AppendLineNumber(text, lineNumber) -{ - if (!lineNumber) { return text } - - return text + " " + linePrefix + lineNumber -} - -function CheckForEndOfLink(str, startIndex) -{ - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. - return illegalCharIndex; -} - -function StripLineNumber(link, linePrefixIndex) -{ - return link.substring(0, linePrefixIndex); -} - -function GetContent(path) { - try { - return fs.readFileSync(path, 'utf8'); - } - catch (error) {} - - return undefined; -} - -function ConstructOutputText(core) -{ - var body = ""; - - if (manuallyReview.size > 0) { body += "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; } - - if (outOfSync.size > 0) { body += "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; } - - if (suggestions.size > 0) { body += "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; } - - if (modifiedFiles.size > 0) { body += "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; } - - console.log("body=" + body); - core.setOutput('outputText', body); -} - -function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) -{ - // Get all indices where a link to the repo is found within the current learning path file - var linkIndices = []; - for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) { - linkIndices.push(pos); - } - - for(let startOfLink of linkIndices) - { - // Clean up the link, determine if it has a line number suffix - const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) - const link = learningPathContents.substring(startOfLink, endOfLink); - - if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } - - console.log("Debug 1") - - const pathStartIndex = link.indexOf(sourceDirectoryName); - - console.log("Path start index: " + pathStartIndex); - - if (pathStartIndex === -1) { continue } - - console.log("Still here: "); - - if (!link.includes(oldHash)) - { - UpdateOutOfSync(link, learningPathFile); - continue - } - - const linePrefixIndex = link.indexOf(linePrefix); - const linkHasLineNumber = linePrefixIndex !== -1; - const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink; - - console.log("Still here 2: "); - - // Check if the file being referenced by the link is one of the modified files in the PR - const linkFilePath = link.substring(pathStartIndex, pathEndIndex); - if (modifiedPRFiles.includes(linkFilePath)) - { - const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1); - - UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile); - - // This is the line number in the learning path file that contains the link - not the #L line number in the link itself - const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length; - - var headContent = GetContent(linkFilePath) - if (!headContent) { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber); - continue - } - const headContentLines = headContent.toString().split("\n"); - - console.log("Still here 3: "); - - if (!linkHasLineNumber) { continue; } - const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length)); - - var prevContent = GetContent(prevPathPrefix + linkFilePath) - if (!prevContent) { continue; } - const prevContentLines = prevContent.toString().split("\n"); - - console.log("Still here 4: "); - - if (prevContentLines.length < oldLineNumber) - { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); - } - else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim()) - { - const newLineNumberLast = headContentLines.lastIndexOf(prevContentLines[oldLineNumber - 1]) + 1; - const newLineNumberFirst = headContentLines.indexOf(prevContentLines[oldLineNumber - 1]) + 1; - - if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file - { - UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); - } - else - { - let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst; - UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst); - } - } - } - } -} - -const main = async () => { - - const [core] = await actionUtils.installAndRequirePackages("@actions/core"); - - try { - const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true }); - const repoURLToSearch = core.getInput('repoURLToSearch', { required: true }); - const changedFilePaths = core.getInput('changedFilePaths', {required: false}); - const learningPathHashFile = core.getInput('learningPathHashFile', { required: true }); - const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true }); - const oldHash = core.getInput('oldHash', { required: true }); - const newHash = core.getInput('newHash', { required: true }); - const excludeLinks = core.getInput('excludeLinks', { required: false }); - const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : []; - - if (changedFilePaths === null || changedFilePaths.trim() === "") { return } - - // Scan each file in the learningPaths directory - fs.readdir(learningPathDirectory, (_, files) => { - files.forEach(learningPathFile => { - try { - const learningPathContents = GetContent(path.join(learningPathDirectory, learningPathFile)) - if (learningPathContents) - { - ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) - ConstructOutputText(core); - } - } catch (error) { - console.log("Error: " + error) - console.log("Could not find learning path file: " + learningPathFile) - } - }); - }); - - fs.writeFileSync(learningPathHashFile, newHash); - - // Scan each file in the learningPaths directory - fs.readdir(learningPathDirectory, (_, files) => { +permissions: {} - files.forEach(learningPathFile => { - try { - const fullPath = path.join(learningPathDirectory, learningPathFile) - let content = fs.readFileSync(fullPath, 'utf8') - - let suggestionsArray = Array.from(suggestions); - if (suggestionsArray && suggestionsArray.length > 0) { - suggestionsArray.forEach(suggestion => { - const suggestionArray = suggestion.split(oldNewLinkSeparator) - var oldLink = suggestionArray[0] - var newLink = suggestionArray[1] - oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) - newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - content = ReplaceOldWithNewText(content, oldLink, newLink) - }) - } - - content = ReplaceOldWithNewText(content, oldHash, newHash) - fs.writeFileSync(fullPath, content); - } catch (error) { - console.log("Error: " + error) - console.log("Could not find learning path file: " + learningPathFile) - } - }); - }); - - } catch (error) { - core.setFailed(error.message); - } -} - -// Call the main function to run the action -main(); +jobs: + check-learning-path-links: + name: 'Check Learning Path Links' + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout head + uses: actions/checkout@v4 + with: + persist-credentials: true # need this for opening a PR + fetch-depth: 0 + ref: main + + - name: Get previous update SHA + id: get_sha + run: | + prev_sha=$(cat .github/learning-path-sha.txt) + echo "prev_sha=$prev_sha" >> $GITHUB_ENV + + - name: Checkout previous update + uses: actions/checkout@v4 + with: + persist-credentials: false + ref: ${{ env.prev_sha }} + path: prev + + - name: Get changed files + run: | + changed_source_files=$(git diff-tree --no-commit-id --name-only -r "$prev_sha" "$GITHUB_SHA" | { grep "**.cs$" || test $? = 1; }) + echo "Files to validate: '${changed_source_files}'" + echo "updated_files=$(echo ${changed_source_files})" >> $GITHUB_ENV + + - name: Check Learning Path Links + id: check-links + uses: ./.github/actions/learning-path-staleness-check + with: + repoURLToSearch: 'https://github.com/dotnet/dotnet-monitor' + learningPathsDirectory: 'documentation/learningPath' + changedFilePaths: ${{ env.updated_files }} + sourceDirectoryName: 'src' + oldHash: ${{ env.prev_sha }} + newHash: ${{ github.sha }} + learningPathHashFile: '.github/learning-path-sha.txt' + + - name: Open PR + uses: ./.github/actions/open-pr + with: + files_to_commit: --all -- :!prev + title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" + commit_message: Update Learning Paths + body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} + branch_name: learningPathUpdates/${{ github.sha }} + fail_if_files_unchanged: true + auth_token: ${{ secrets.GITHUB_TOKEN }} From 6aaae4a24a6a363296df8e929f08a90ba2ef22b8 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:00:55 -0800 Subject: [PATCH 331/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index ea87e4afe2c..5fff7f6563b 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,5 +1,6 @@ const actionUtils = require('../action-utils.js'); const fs = require('fs'); +const path = require('path'); const prevPathPrefix = "prev/"; const linePrefix = "#L"; const separator = " | "; From 3e16ca954219f7f7ed9ff0cd8256b8a1e2df866a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:03:51 -0800 Subject: [PATCH 332/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 5fff7f6563b..2a816657e09 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -130,13 +130,18 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l for(let startOfLink of linkIndices) { + console.log("Start of Link: " + startOfLink) + // Clean up the link, determine if it has a line number suffix const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + + console.log("End of Link: " + endOfLink) + const link = learningPathContents.substring(startOfLink, endOfLink); if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } - console.log("Debug 1") + console.log("Link: " + link) const pathStartIndex = link.indexOf(sourceDirectoryName); From 23eaa0a6bcb1add581350432f20d7f140009f06f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:13:29 -0800 Subject: [PATCH 333/352] Update index.js --- .../actions/learning-path-staleness-check/index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 2a816657e09..bfa24fcd655 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n|\s{2,}"); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n"); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } @@ -130,13 +130,9 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l for(let startOfLink of linkIndices) { - console.log("Start of Link: " + startOfLink) - // Clean up the link, determine if it has a line number suffix const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) - console.log("End of Link: " + endOfLink) - const link = learningPathContents.substring(startOfLink, endOfLink); if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } @@ -145,12 +141,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l const pathStartIndex = link.indexOf(sourceDirectoryName); - console.log("Path start index: " + pathStartIndex); - if (pathStartIndex === -1) { continue } - console.log("Still here: "); - if (!link.includes(oldHash)) { UpdateOutOfSync(link, learningPathFile); @@ -161,8 +153,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l const linkHasLineNumber = linePrefixIndex !== -1; const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink; - console.log("Still here 2: "); - // Check if the file being referenced by the link is one of the modified files in the PR const linkFilePath = link.substring(pathStartIndex, pathEndIndex); if (modifiedPRFiles.includes(linkFilePath)) From 31c68202fb2f49a48a1d6aeddfb5467cd0b5b4f0 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:32:25 -0800 Subject: [PATCH 334/352] Update index.js --- .../learning-path-staleness-check/index.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index bfa24fcd655..ca22dea6232 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -5,7 +5,7 @@ const prevPathPrefix = "prev/"; const linePrefix = "#L"; const separator = " | "; -modifiedFilesDict = {}; +modifiedFilesPathToLearningPathFile = {}; modifiedFilesUrlToFileName = {}; var outOfSync = new Set(); @@ -24,14 +24,14 @@ function UpdateModifiedFiles(fileName, path, learningPathFile) { modifiedFilesUrlToFileName[path] = fileName; - modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; - modifiedFilesDict[path].add(learningPathFile); + modifiedFilesPathToLearningPathFile[path] = modifiedFilesPathToLearningPathFile[path] ? modifiedFilesPathToLearningPathFile[path] : new Set();; + modifiedFilesPathToLearningPathFile[path].add(learningPathFile); modifiedFiles = new Set(); - for (currPath in modifiedFilesDict) + for (currPath in modifiedFilesPathToLearningPathFile) { const fileName = modifiedFilesUrlToFileName[currPath]; - modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); + modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesPathToLearningPathFile[currPath]))); } } @@ -137,8 +137,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } - console.log("Link: " + link) - const pathStartIndex = link.indexOf(sourceDirectoryName); if (pathStartIndex === -1) { continue } @@ -171,8 +169,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l } const headContentLines = headContent.toString().split("\n"); - console.log("Still here 3: "); - if (!linkHasLineNumber) { continue; } const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length)); @@ -180,8 +176,6 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l if (!prevContent) { continue; } const prevContentLines = prevContent.toString().split("\n"); - console.log("Still here 4: "); - if (prevContentLines.length < oldLineNumber) { UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber); From 53f00e10819f110abf8f83af1cf3e5458a6f502a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:33:38 -0800 Subject: [PATCH 335/352] Update action-utils.js --- .github/actions/action-utils.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index c42b23ffeb0..78e7fe0e3b1 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,7 +51,3 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); -module.exports.readFileSync = (fileName) => fs.readFileSync(fileName, 'utf8'); -module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); -module.exports.writeFileSync = (fileName, contents) => fs.writeFileSync(fileName, contents); -module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); From a65df3be53343837eb38f287260987519f6d4867 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:34:52 -0800 Subject: [PATCH 336/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 27aace0fafa0b773f8e88395d244558fc011ba76 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:38:23 -0800 Subject: [PATCH 337/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 6303b85da2ee4047fcf1849a745a5bddfe83f663 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:38:38 -0800 Subject: [PATCH 338/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 6cb380a699ced623b429174b134d561eac032523 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:41:03 -0800 Subject: [PATCH 339/352] Flowing bits (#376) * Update index.js * Update check-learning-path-links.yml * Update EgressHelper.cs * Update check-learning-path-links.yml * Update index.js * Update index.js * Update EgressHelper.cs * Update check-learning-path-links.yml * Update EgressHelper.cs * Update index.js * Update check-learning-path-links.yml * Update action.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update action.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update action.yml * Update index.js * Update check-learning-path-links.yml * Update index.js * Update index.js * Update index.js * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update EgressHelper.cs * Update index.js * Update EgressHelper.cs * Update index.js * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update index.js * Update index.js * Update index.js * Update index.js * Update action-utils.js * Update ServiceCollectionExtensions.cs * Update ServiceCollectionExtensions.cs * Update EgressHelper.cs --- .github/actions/action-utils.js | 4 -- .../learning-path-staleness-check/index.js | 69 ++++++++----------- .../workflows/check-learning-path-links.yml | 26 ++----- 3 files changed, 33 insertions(+), 66 deletions(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index c42b23ffeb0..78e7fe0e3b1 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,7 +51,3 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); -module.exports.readFileSync = (fileName) => fs.readFileSync(fileName, 'utf8'); -module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); -module.exports.writeFileSync = (fileName, contents) => fs.writeFileSync(fileName, contents); -module.exports.readdir = (dirName, callback) => util.promisify(fs.readdir)(dirName, callback); diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 5db4d1e7d33..ca22dea6232 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -1,9 +1,11 @@ const actionUtils = require('../action-utils.js'); +const fs = require('fs'); +const path = require('path'); const prevPathPrefix = "prev/"; const linePrefix = "#L"; const separator = " | "; -modifiedFilesDict = {}; +modifiedFilesPathToLearningPathFile = {}; modifiedFilesUrlToFileName = {}; var outOfSync = new Set(); @@ -13,14 +15,6 @@ var modifiedFiles = new Set(); const oldNewLinkSeparator = ' -> '; -let modifiedFilesToCommit = []; - -function AppendModifiedFilesToCommit(path, core) -{ - modifiedFilesToCommit.push(path) - core.setOutput('modifiedFilesToCommit', modifiedFilesToCommit.join(' ')) -} - function ReplaceOldWithNewText(content, oldText, newText) { return content.replaceAll(oldText, newText); @@ -30,14 +24,14 @@ function UpdateModifiedFiles(fileName, path, learningPathFile) { modifiedFilesUrlToFileName[path] = fileName; - modifiedFilesDict[path] = modifiedFilesDict[path] ? modifiedFilesDict[path] : new Set();; - modifiedFilesDict[path].add(learningPathFile); + modifiedFilesPathToLearningPathFile[path] = modifiedFilesPathToLearningPathFile[path] ? modifiedFilesPathToLearningPathFile[path] : new Set();; + modifiedFilesPathToLearningPathFile[path].add(learningPathFile); modifiedFiles = new Set(); - for (currPath in modifiedFilesDict) + for (currPath in modifiedFilesPathToLearningPathFile) { const fileName = modifiedFilesUrlToFileName[currPath]; - modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesDict[currPath]))); + modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesPathToLearningPathFile[currPath]))); } } @@ -92,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. "); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n"); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } @@ -103,7 +97,7 @@ function StripLineNumber(link, linePrefixIndex) function GetContent(path) { try { - return actionUtils.readFileSync(path) + return fs.readFileSync(path, 'utf8'); } catch (error) {} @@ -112,21 +106,17 @@ function GetContent(path) { function ConstructOutputText(core) { - var manuallyReviewSection = "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; - if (manuallyReview.size === 0) { manuallyReviewSection = ""; } + var body = ""; - var outOfSyncSection = "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; - if (outOfSync.size === 0) { outOfSyncSection = ""; } + if (manuallyReview.size > 0) { body += "

Manually Review:

" + Array.from(manuallyReview).join("
") + "
"; } - var suggestionsSection = "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; - if (suggestions.size === 0) { suggestionsSection = ""; } + if (outOfSync.size > 0) { body += "

Links With Out Of Sync Commit Hashes:

" + Array.from(outOfSync).join("
") + "
"; } - var modifiedFilesSection = "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; - if (modifiedFiles.size === 0) { modifiedFilesSection = ""; } + if (suggestions.size > 0) { body += "

Auto-Applied Suggestions:

" + Array.from(suggestions).join("
") + "
"; } - var body = modifiedFilesSection + manuallyReviewSection + outOfSyncSection + suggestionsSection; - console.log("body=" + body); + if (modifiedFiles.size > 0) { body += "

Modified Files:

" + Array.from(modifiedFiles).join("
") + "
"; } + console.log("body=" + body); core.setOutput('outputText', body); } @@ -142,11 +132,13 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Clean up the link, determine if it has a line number suffix const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + const link = learningPathContents.substring(startOfLink, endOfLink); if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } const pathStartIndex = link.indexOf(sourceDirectoryName); + if (pathStartIndex === -1) { continue } if (!link.includes(oldHash)) @@ -225,10 +217,10 @@ const main = async () => { if (changedFilePaths === null || changedFilePaths.trim() === "") { return } // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { + fs.readdir(learningPathDirectory, (_, files) => { files.forEach(learningPathFile => { try { - const learningPathContents = GetContent(learningPathDirectory + "/" + learningPathFile) + const learningPathContents = GetContent(path.join(learningPathDirectory, learningPathFile)) if (learningPathContents) { ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray) @@ -241,17 +233,15 @@ const main = async () => { }); }); - actionUtils.writeFileSync(learningPathHashFile, newHash); - AppendModifiedFilesToCommit(learningPathHashFile, core) + fs.writeFileSync(learningPathHashFile, newHash); // Scan each file in the learningPaths directory - actionUtils.readdir(learningPathDirectory, (_, files) => { + fs.readdir(learningPathDirectory, (_, files) => { + files.forEach(learningPathFile => { try { - const fullPath = learningPathDirectory + "/" + learningPathFile - const content = actionUtils.readFileSync(fullPath) - - var replacedContent = content + const fullPath = path.join(learningPathDirectory, learningPathFile) + let content = fs.readFileSync(fullPath, 'utf8') let suggestionsArray = Array.from(suggestions); if (suggestionsArray && suggestionsArray.length > 0) { @@ -261,17 +251,12 @@ const main = async () => { var newLink = suggestionArray[1] oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')')) newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')')) - replacedContent = ReplaceOldWithNewText(replacedContent, oldLink, newLink) + content = ReplaceOldWithNewText(content, oldLink, newLink) }) } - replacedContent = ReplaceOldWithNewText(replacedContent, oldHash, newHash) - - actionUtils.writeFileSync(fullPath, replacedContent); - - if (content !== replacedContent) { - AppendModifiedFilesToCommit(fullPath, core) - } + content = ReplaceOldWithNewText(content, oldHash, newHash) + fs.writeFileSync(fullPath, content); } catch (error) { console.log("Error: " + error) console.log("Could not find learning path file: " + learningPathFile) diff --git a/.github/workflows/check-learning-path-links.yml b/.github/workflows/check-learning-path-links.yml index a7981c0c4eb..7b9f4f0a6f9 100644 --- a/.github/workflows/check-learning-path-links.yml +++ b/.github/workflows/check-learning-path-links.yml @@ -18,29 +18,15 @@ jobs: - name: Checkout head uses: actions/checkout@v4 with: - persist-credentials: false - fetch-depth: 0 # Fetch the entire repo for the below git commit graph operations + persist-credentials: true # need this for opening a PR + fetch-depth: 0 ref: main - - name: Get current SHA - id: get_new_sha - run: | - new_sha=$(git rev-parse HEAD) - echo "new_sha=$new_sha" >> $GITHUB_ENV - - name: Get previous update SHA id: get_sha run: | - cd .github - prev_sha=$(cat learning-path-sha.txt) + prev_sha=$(cat .github/learning-path-sha.txt) echo "prev_sha=$prev_sha" >> $GITHUB_ENV - cd ../ - - - name: Checkout head - uses: actions/checkout@v4 - with: - persist-credentials: true - ref: main - name: Checkout previous update uses: actions/checkout@v4 @@ -64,16 +50,16 @@ jobs: changedFilePaths: ${{ env.updated_files }} sourceDirectoryName: 'src' oldHash: ${{ env.prev_sha }} - newHash: ${{ env.new_sha }} + newHash: ${{ github.sha }} learningPathHashFile: '.github/learning-path-sha.txt' - name: Open PR uses: ./.github/actions/open-pr with: - files_to_commit: ${{ steps.check-links.outputs.modifiedFilesToCommit }} + files_to_commit: --all -- :!prev title: "[REQUIRES MANUAL REVIEW] Update Learning Paths" commit_message: Update Learning Paths body: This PR was auto generated and will not be automatically merged in - adjustments should be made manually as-needed.
${{ steps.check-links.outputs.outputText }} - branch_name: learningPathUpdates/${{ env.new_sha }} + branch_name: learningPathUpdates/${{ github.sha }} fail_if_files_unchanged: true auth_token: ${{ secrets.GITHUB_TOKEN }} From 1251aaa6169765d2a82390e13dab3e644c200ccd Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:45:38 -0800 Subject: [PATCH 340/352] Update action-utils.js --- .github/actions/action-utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index 78e7fe0e3b1..b401cf2a1ba 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,3 +51,4 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); +module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); From 2a80c4c1eec891d1c198c326954b0e68972fbd7e Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:52:25 -0800 Subject: [PATCH 341/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index ca22dea6232..4b7b2fef06d 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n"); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("[\>\]\s]|. "); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } @@ -131,7 +131,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l for(let startOfLink of linkIndices) { // Clean up the link, determine if it has a line number suffix - const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + if (endOfLink === -1) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file const link = learningPathContents.substring(startOfLink, endOfLink); From 487c3b4b28cc2b53760d922ebffe0f6dd4da36d2 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:53:06 -0800 Subject: [PATCH 342/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5f89be65af3..5933c211165 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From e4d065620ddf8ddab90572dd8ebeda5b80d64a38 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:53:34 -0800 Subject: [PATCH 343/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index bf4f4d96c5b..44446376ba6 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,6 +1,5 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 130c325b4f987d3b578613712c76d94d2eed6298 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 13:57:11 -0800 Subject: [PATCH 344/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 4b7b2fef06d..98f28bf54c2 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[\>\]\s]|. "); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("[\>\]\)\s]|. "); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } From eda2821599aedf4a7a50ec07cebdc5455206f9a6 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:10:00 -0800 Subject: [PATCH 345/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 98f28bf54c2..f16524f7b7a 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[\>\]\)\s]|. "); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search("/[\>\])\s]|$|.$|.\s/m"); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } From 5f19978c859e55c4c77cfc06944bcfbbe2d194a1 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:13:09 -0800 Subject: [PATCH 346/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index f16524f7b7a..2e48dde9dc8 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -132,10 +132,15 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Clean up the link, determine if it has a line number suffix let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + + console.log("End of Link: " + endOfLink); + if (endOfLink === -1) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file const link = learningPathContents.substring(startOfLink, endOfLink); + console.log("Link: " + link); + if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } const pathStartIndex = link.indexOf(sourceDirectoryName); From 0efd3908cb245acb16d61c144b0886f081e3ddcf Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:18:02 -0800 Subject: [PATCH 347/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 2e48dde9dc8..2fa0bb2bed0 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("/[\>\])\s]|$|.$|.\s/m"); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search(/[\>\])\s]|$|.$|.\s/m); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } @@ -132,15 +132,10 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Clean up the link, determine if it has a line number suffix let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) - - console.log("End of Link: " + endOfLink); - if (endOfLink === -1) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file const link = learningPathContents.substring(startOfLink, endOfLink); - console.log("Link: " + link); - if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; } const pathStartIndex = link.indexOf(sourceDirectoryName); From 953d566d0f04a07c2fcb4de871d03621afc38d0f Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:20:11 -0800 Subject: [PATCH 348/352] Update ServiceCollectionExtensions.cs --- src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs index 44446376ba6..bf4f4d96c5b 100644 --- a/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs +++ b/src/Tools/dotnet-monitor/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Diagnostics.Monitoring.EventPipe.Triggers; From 43b057dcc608959f649e037862409a478cfdd999 Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:20:30 -0800 Subject: [PATCH 349/352] Update EgressHelper.cs --- .../EgressHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs index 5933c211165..5f89be65af3 100644 --- a/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs +++ b/src/Microsoft.Diagnostics.Monitoring.Extension.Common/EgressHelper.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. - using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; From 64b90b2f71f1dad820db8f827e3dedd65d52108d Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:23:38 -0800 Subject: [PATCH 350/352] Flowing bits (#394) * Update index.js * Update check-learning-path-links.yml * Update EgressHelper.cs * Update check-learning-path-links.yml * Update index.js * Update index.js * Update EgressHelper.cs * Update check-learning-path-links.yml * Update EgressHelper.cs * Update index.js * Update check-learning-path-links.yml * Update action.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update action.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update action.yml * Update index.js * Update check-learning-path-links.yml * Update index.js * Update index.js * Update index.js * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update action.yml * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update EgressHelper.cs * Update index.js * Update EgressHelper.cs * Update index.js * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update index.js * Update check-learning-path-links.yml * Update check-learning-path-links.yml * Update index.js * Update index.js * Update index.js * Update index.js * Update action-utils.js * Update ServiceCollectionExtensions.cs * Update ServiceCollectionExtensions.cs * Update EgressHelper.cs * Update action-utils.js * Update index.js * Update EgressHelper.cs * Update ServiceCollectionExtensions.cs * Update index.js * Update index.js * Update index.js * Update index.js * Update ServiceCollectionExtensions.cs * Update EgressHelper.cs --- .github/actions/action-utils.js | 1 + .github/actions/learning-path-staleness-check/index.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/action-utils.js b/.github/actions/action-utils.js index 78e7fe0e3b1..b401cf2a1ba 100644 --- a/.github/actions/action-utils.js +++ b/.github/actions/action-utils.js @@ -51,3 +51,4 @@ module.exports.friendlyDateFromISODate = function(isoDate) { module.exports.splitVersionTag = splitVersionTag; module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8'); +module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents); diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index ca22dea6232..2fa0bb2bed0 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -86,7 +86,7 @@ function AppendLineNumber(text, lineNumber) function CheckForEndOfLink(str, startIndex) { - const illegalCharIndex = str.substr(startIndex).search("[(), '\`\"\}\{]|\. |\.\n"); // This regex isn't perfect, but should cover most cases. + const illegalCharIndex = str.substr(startIndex).search(/[\>\])\s]|$|.$|.\s/m); // This regex isn't perfect, but should cover most cases. return illegalCharIndex; } @@ -131,7 +131,8 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l for(let startOfLink of linkIndices) { // Clean up the link, determine if it has a line number suffix - const endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) + if (endOfLink === -1) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file const link = learningPathContents.substring(startOfLink, endOfLink); From f0aa8ede126552c0889a7805e127f2ed548a1e1a Mon Sep 17 00:00:00 2001 From: kkeirstead <85592574+kkeirstead@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:33:22 -0800 Subject: [PATCH 351/352] Update index.js --- .github/actions/learning-path-staleness-check/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/learning-path-staleness-check/index.js b/.github/actions/learning-path-staleness-check/index.js index 2fa0bb2bed0..0b8e3891711 100644 --- a/.github/actions/learning-path-staleness-check/index.js +++ b/.github/actions/learning-path-staleness-check/index.js @@ -132,7 +132,7 @@ function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, l { // Clean up the link, determine if it has a line number suffix let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink) - if (endOfLink === -1) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file + if (endOfLink < startOfLink) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file const link = learningPathContents.substring(startOfLink, endOfLink); From ecdb2f5026362b89b25c96ed9dfcf30135cecd5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:45:24 +0000 Subject: [PATCH 352/352] Bump dependabot/fetch-metadata from 1.6.0 to 2.2.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.2.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/c9c4182bf1b97f5224aee3906fd373f6b61b4526...dbb049abf0d677abbd7f7eee0375145b417fdd34) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/verify-dependabot-clearly-defined.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-dependabot-clearly-defined.yml b/.github/workflows/verify-dependabot-clearly-defined.yml index d761be2bf95..a04f031cc37 100644 --- a/.github/workflows/verify-dependabot-clearly-defined.yml +++ b/.github/workflows/verify-dependabot-clearly-defined.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Fetch Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@c9c4182bf1b97f5224aee3906fd373f6b61b4526 + uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 - name: Check ClearlyDefined if: ${{steps.metadata.outputs.package-ecosystem == 'nuget'}}