Skip to content

[ps-installation-script] better error message in case of failed instrumentation installer download #6165

New issue

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

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

Already on GitHub? Sign in to your account

Conversation

lachmatt
Copy link
Contributor

@lachmatt lachmatt commented Apr 22, 2025

Description:
Produce a better message in case of failed attempt to download .NET instrumentation installer.
Follows the same pattern as other download attempts in the script (e.g. 1).
Additionally, sets the security protocol (which might be needed on a legacy systems) similarly to other downloads in the script (1,2).

@lachmatt lachmatt requested review from a team as code owners April 22, 2025 11:51
@@ -456,7 +456,17 @@ if ($with_dotnet_instrumentation) {
$download = "https://github.com/signalfx/splunk-otel-dotnet/releases/latest/download/$module_name"
$dotnet_autoinstr_path = Join-Path $tempdir $module_name
echo "Downloading .NET Instrumentation installer ..."
Invoke-WebRequest -Uri $download -OutFile $dotnet_autoinstr_path -UseBasicParsing
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Copy link

Choose a reason for hiding this comment

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

should include tls13?

Copy link

Choose a reason for hiding this comment

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

This should do the trick, may need to add comment that 3072 is TLS 1.2 and 12288 is TLS 1.3
[Net.ServicePointManager]::SecurityProtocol = 3072 -bor 12288

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I considered that but decided it'd be preferable to:

  • set it consistently in the script (as similar is configured in multiplace places already)
  • use enum values instead of magic numbers e.g.
    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13

Copy link

@RassK RassK Apr 22, 2025

Choose a reason for hiding this comment

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

Makes sense to separate it to a new issue then, if there are multiple places. The idea is not to require older security protocols but instead use newest as possible and fallback if not possible.

[Net.SecurityProtocolType]::Tls13 is available in .NET FX 4.8+. I think PowerShell 5.1 what we require (min) is still at 4.5. So the enum value is not available there.

Copy link

codecov bot commented Apr 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 44.49%. Comparing base (dc9b260) to head (dad9556).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6165   +/-   ##
=======================================
  Coverage   44.49%   44.49%           
=======================================
  Files         391      391           
  Lines       27034    27034           
=======================================
  Hits        12029    12029           
  Misses      14165    14165           
  Partials      840      840           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pjanotti pjanotti merged commit d43f971 into signalfx:main Apr 23, 2025
142 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2025
@lachmatt lachmatt deleted the better-error-message-for-failed-net-instr-downloads branch April 24, 2025 12:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants