A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/microsoft/PowerShellForGitHub/commit/ae8467f74a8bae1b97ca808a3b6eec727d15fc7e below:

Removing binary dependencies for telemetry (#186) · microsoft/PowerShellForGitHub@ae8467f · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+369

-727

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+369

-727

lines changed Original file line number Diff line number Diff line change

@@ -1,4 +1 @@

1 1

Tests/Config/Settings.ps1

2 -

Microsoft.ApplicationInsights.dll

3 -

Microsoft.Diagnostics.Tracing.EventSource.dll

4 -

Microsoft.Threading.Tasks.dll

Original file line number Diff line number Diff line change

@@ -76,11 +76,6 @@ function Set-GitHubConfiguration

76 76

Change the Application Insights instance that telemetry will be reported to (if telemetry

77 77

hasn't been disabled via DisableTelemetry).

78 78 79 -

.PARAMETER AssemblyPath

80 -

The location that any dependent assemblies that this module depends on can be located.

81 -

If the assemblies can't be found at this location, nor in a temporary cache or in

82 -

the module's directory, the assemblies will be downloaded and temporarily cached.

83 - 84 79

.PARAMETER DefaultNoStatus

85 80

Control if the -NoStatus switch should be passed-in by default to all methods.

86 81

@@ -182,8 +177,6 @@ function Set-GitHubConfiguration

182 177 183 178

[string] $ApplicationInsightsKey,

184 179 185 -

[string] $AssemblyPath,

186 - 187 180

[switch] $DefaultNoStatus,

188 181 189 182

[string] $DefaultOwnerName,

@@ -279,7 +272,6 @@ function Get-GitHubConfiguration

279 272

[ValidateSet(

280 273

'ApiHostName',

281 274

'ApplicationInsightsKey',

282 -

'AssemblyPath',

283 275

'DefaultNoStatus',

284 276

'DefaultOwnerName',

285 277

'DefaultRepositoryName',

@@ -617,7 +609,6 @@ function Import-GitHubConfiguration

617 609

$config = [PSCustomObject]@{

618 610

'apiHostName' = 'github.com'

619 611

'applicationInsightsKey' = '66d83c52-3070-489b-886b-09860e05e78a'

620 -

'assemblyPath' = [String]::Empty

621 612

'disableLogging' = ([String]::IsNullOrEmpty($logPath))

622 613

'disablePiiProtection' = $false

623 614

'disableSmarterObjects' = $false

Original file line number Diff line number Diff line change

@@ -98,8 +98,7 @@ function Invoke-GHRestMethod

98 98 99 99

.NOTES

100 100

This wraps Invoke-WebRequest as opposed to Invoke-RestMethod because we want access to the headers

101 -

that are returned in the response (specifically 'MS-ClientRequestId') for logging purposes, and

102 -

Invoke-RestMethod drops those headers.

101 +

that are returned in the response, and Invoke-RestMethod drops those headers.

103 102

#>

104 103

[CmdletBinding(SupportsShouldProcess)]

105 104

param(

@@ -144,10 +143,7 @@ function Invoke-GHRestMethod

144 143 145 144

# Telemetry-related

146 145

$stopwatch = New-Object -TypeName System.Diagnostics.Stopwatch

147 -

$localTelemetryProperties = @{

148 -

'UriFragment' = $UriFragment

149 -

'WaitForCompletion' = ($WaitForCompletion -eq $true)

150 -

}

146 +

$localTelemetryProperties = @{}

151 147

$TelemetryProperties.Keys | ForEach-Object { $localTelemetryProperties[$_] = $TelemetryProperties[$_] }

152 148

$errorBucket = $TelemetryExceptionBucket

153 149

if ([String]::IsNullOrEmpty($errorBucket))

@@ -198,13 +194,14 @@ function Invoke-GHRestMethod

198 194

return

199 195

}

200 196 197 +

$NoStatus = Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus

198 + 201 199

try

202 200

{

203 201

Write-Log -Message $Description -Level Verbose

204 202

Write-Log -Message "Accessing [$Method] $url [Timeout = $(Get-GitHubConfiguration -Name WebRequestTimeoutSec))]" -Level Verbose

205 203 206 204

$result = $null

207 -

$NoStatus = Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus

208 205

if ($NoStatus)

209 206

{

210 207

$params = @{}

@@ -293,7 +290,8 @@ function Invoke-GHRestMethod

293 290

Write-Log -Message "Unable to retrieve the raw HTTP Web Response:" -Exception $_ -Level Warning

294 291

}

295 292 296 -

throw (ConvertTo-Json -InputObject $ex -Depth 20)

293 +

$jsonConversionDepth = 20 # Seems like it should be more than sufficient

294 +

throw (ConvertTo-Json -InputObject $ex -Depth $jsonConversionDepth)

297 295

}

298 296

}

299 297

@@ -326,7 +324,7 @@ function Invoke-GHRestMethod

326 324

if (-not [String]::IsNullOrEmpty($TelemetryEventName))

327 325

{

328 326

$telemetryMetrics = @{ 'Duration' = $stopwatch.Elapsed.TotalSeconds }

329 -

Set-TelemetryEvent -EventName $TelemetryEventName -Properties $localTelemetryProperties -Metrics $telemetryMetrics

327 +

Set-TelemetryEvent -EventName $TelemetryEventName -Properties $localTelemetryProperties -Metrics $telemetryMetrics -NoStatus:$NoStatus

330 328

}

331 329 332 330

$finalResult = $result.Content

@@ -454,14 +452,14 @@ function Invoke-GHRestMethod

454 452

{

455 453

# Will be thrown if $ex.Message isn't JSON content

456 454

Write-Log -Exception $_ -Level Error

457 -

Set-TelemetryException -Exception $ex -ErrorBucket $errorBucket -Properties $localTelemetryProperties

455 +

Set-TelemetryException -Exception $ex -ErrorBucket $errorBucket -Properties $localTelemetryProperties -NoStatus:$NoStatus

458 456

throw

459 457

}

460 458

}

461 459

else

462 460

{

463 461

Write-Log -Exception $_ -Level Error

464 -

Set-TelemetryException -Exception $_.Exception -ErrorBucket $errorBucket -Properties $localTelemetryProperties

462 +

Set-TelemetryException -Exception $_.Exception -ErrorBucket $errorBucket -Properties $localTelemetryProperties -NoStatus:$NoStatus

465 463

throw

466 464

}

467 465

@@ -524,7 +522,7 @@ function Invoke-GHRestMethod

524 522 525 523

$newLineOutput = ($output -join [Environment]::NewLine)

526 524

Write-Log -Message $newLineOutput -Level Error

527 -

Set-TelemetryException -Exception $ex -ErrorBucket $errorBucket -Properties $localTelemetryProperties

525 +

Set-TelemetryException -Exception $ex -ErrorBucket $errorBucket -Properties $localTelemetryProperties -NoStatus:$NoStatus

528 526

throw $newLineOutput

529 527

}

530 528

}

Original file line number Diff line number Diff line change

@@ -322,16 +322,21 @@ function Get-GitHubIssue

322 322

'NoStatus' = (Resolve-ParameterWithDefaultConfigurationValue -Name NoStatus -ConfigValueName DefaultNoStatus)

323 323

}

324 324 325 -

$result = Invoke-GHRestMethodMultipleResult @params

326 - 327 -

if ($IgnorePullRequests)

325 +

try

328 326

{

329 -

return ($result | Where-Object { $null -eq (Get-Member -InputObject $_ -Name pull_request) })

330 -

}

331 -

else

332 -

{

333 -

return $result

327 +

$result = Invoke-GHRestMethodMultipleResult @params

328 + 329 +

if ($IgnorePullRequests)

330 +

{

331 +

return ($result | Where-Object { $null -eq (Get-Member -InputObject $_ -Name pull_request) })

332 +

}

333 +

else

334 +

{

335 +

return $result

336 +

}

337 + 334 338

}

339 +

finally {}

335 340

}

336 341 337 342

function Get-GitHubIssueTimeline

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4