diff --git a/.github/workflows/add-labels.yml b/.github/workflows/add-labels.yml index 9c040eaaab..23137c1aa8 100644 --- a/.github/workflows/add-labels.yml +++ b/.github/workflows/add-labels.yml @@ -1,16 +1,21 @@ -name: 'Add labels for component found in bug issue descriptions' +name: 'Add labels to issues and pull requests' on: issues: - types: [opened] + types: [ opened ] + + pull_request_target: + branches: [ 'main*', 'instrumentation*', 'exporter*', 'extensions*' ] permissions: issues: write + pull-requests: write jobs: - add-labels: - if: ${{ !github.event.issue.pull_request }} + add-labels-on-issues: + if: github.event_name == 'issues' && !github.event.issue.pull_request runs-on: ubuntu-latest + steps: - name: check out code uses: actions/checkout@v4 @@ -18,8 +23,33 @@ jobs: - name: Add labels for component found in bug issue descriptions shell: pwsh run: | - .\build\scripts\add-labels.ps1 -issueNumber $env:ISSUE_NUMBER -issueBody $env:ISSUE_BODY + Import-Module .\build\scripts\add-labels.psm1 + + AddLabelsOnIssuesForComponentFoundInBody ` + -issueNumber ${{ github.event.issue.number }} ` + -issueBody $env:ISSUE_BODY env: GH_TOKEN: ${{ github.token }} - ISSUE_NUMBER: ${{ github.event.issue.number }} ISSUE_BODY: ${{ github.event.issue.body }} + + add-labels-on-pull-requests: + if: github.event_name == 'pull_request_target' + + runs-on: ubuntu-latest + + steps: + - name: check out code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.repository.default_branch }} # Note: Do not run on the PR branch we want to execute add-labels.psm1 from main on the base repo only because pull_request_target can see secrets + + - name: Add labels for files changed on pull requests + shell: pwsh + run: | + Import-Module .\build\scripts\add-labels.psm1 + + AddLabelsOnPullRequestsBasedOnFilesChanged ` + -pullRequestNumber ${{ github.event.pull_request.number }} ` + -labelPackagePrefix 'comp:' + env: + GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml index e85a3720ab..1385474892 100644 --- a/.github/workflows/automation.yml +++ b/.github/workflows/automation.yml @@ -13,7 +13,7 @@ on: value: ${{ vars.AUTOMATION_EMAIL }} secrets: OPENTELEMETRYBOT_GITHUB_TOKEN: - required: true + required: false jobs: resolve-automation: diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 0098bc82ed..eea3b61943 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -106,7 +106,7 @@ jobs: && github.event.action == 'closed' && github.event.pull_request.user.login == needs.automation.outputs.username && github.event.pull_request.merged == true - && startsWith(github.event.pull_request.title, '[repo] Prepare release ') + && startsWith(github.event.pull_request.title, '[release] Prepare release ') && needs.automation.outputs.enabled env: @@ -139,7 +139,7 @@ jobs: && github.event.issue.locked == true && github.event.comment.user.login != needs.automation.outputs.username && contains(github.event.comment.body, '/CreateReleaseTag') - && startsWith(github.event.issue.title, '[repo] Prepare release ') + && startsWith(github.event.issue.title, '[release] Prepare release ') && github.event.issue.pull_request.merged_at && needs.automation.outputs.enabled diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml index 84d492fcff..f9cae34b57 100644 --- a/.github/workflows/publish-packages.yml +++ b/.github/workflows/publish-packages.yml @@ -26,6 +26,7 @@ jobs: outputs: artifact-url: ${{ steps.upload-artifacts.outputs.artifact-url }} + artifact-id: ${{ steps.upload-artifacts.outputs.artifact-id }} steps: - uses: actions/checkout@v4 @@ -120,6 +121,16 @@ jobs: with: token: ${{ secrets[needs.automation.outputs.token-secret-name] }} + - name: Download Artifacts + run: | + curl \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ github.token }}" \ + -L \ + -o '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip' \ + --create-dirs \ + "https://github.com/gitapi/repos/${{ github.repository }}/actions/artifacts/${{ needs.build-pack-publish.outputs.artifact-id }}/zip" + - name: Create GitHub Release if: github.ref_type == 'tag' shell: pwsh @@ -128,7 +139,8 @@ jobs: CreateRelease ` -gitRepository '${{ github.repository }}' ` - -tag '${{ github.ref_name }}' + -tag '${{ github.ref_name }}' ` + -releaseFiles '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip#Packages' - name: Post notice when packages are ready shell: pwsh diff --git a/build/Common.props b/build/Common.props index 900c2e2fa9..7a6988f37f 100644 --- a/build/Common.props +++ b/build/Common.props @@ -38,8 +38,8 @@ [4.2.2,5.0) [3.11.0-beta1.23525.2] [8.0.0,9.0) - [1.9.0-alpha.2] - [1.8.1,2.0) + [1.9.0-beta.1] + [1.9.0,2.0) [1.9.0-rc.1] [2.1.58,3.0) [3.16.0,4.0) diff --git a/build/scripts/add-labels.ps1 b/build/scripts/add-labels.ps1 deleted file mode 100644 index 7d72236c11..0000000000 --- a/build/scripts/add-labels.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -param( - [Parameter(Mandatory=$true)][int]$issueNumber, - [Parameter(Mandatory=$true)][string]$issueBody -) - -$match = [regex]::Match($issueBody, '^[#]+ Component\s*OpenTelemetry\.((?:.|\w+)+)') -if ($match.Success -eq $false) -{ - Return -} - -gh issue edit $issueNumber --add-label $("comp:" + $match.Groups[1].Value.ToLower()) diff --git a/build/scripts/add-labels.psm1 b/build/scripts/add-labels.psm1 new file mode 100644 index 0000000000..d7d66c8396 --- /dev/null +++ b/build/scripts/add-labels.psm1 @@ -0,0 +1,148 @@ +function AddLabelsOnIssuesForComponentFoundInBody { + param( + [Parameter(Mandatory=$true)][int]$issueNumber, + [Parameter(Mandatory=$true)][string]$issueBody + ) + + $match = [regex]::Match($issueBody, '^[#]+ Component\s*OpenTelemetry\.((?:.|\w+)+)') + if ($match.Success -eq $false) + { + Return + } + + gh issue edit $issueNumber --add-label $("comp:" + $match.Groups[1].Value.ToLower()) +} + +Export-ModuleMember -Function AddLabelsOnIssuesForComponentFoundInBody + +function AddLabelsOnPullRequestsBasedOnFilesChanged { + param( + [Parameter(Mandatory=$true)][int]$pullRequestNumber, + [Parameter(Mandatory=$true)][string]$labelPackagePrefix # 'pkg:' on main repo, 'comp:' on contrib repo + ) + + # Note: This function is intended to work on main repo and on contrib. Please + # keep them in sync. + + $repoLabels = gh label list --json name,id -L 200 | ConvertFrom-Json + + $filesChangedOnPullRequest = gh pr diff $pullRequestNumber --name-only + + $labelsOnPullRequest = (gh pr view $pullRequestNumber --json labels | ConvertFrom-Json).labels + + $visitedProjects = New-Object System.Collections.Generic.HashSet[string] + $labelsToAdd = New-Object System.Collections.Generic.HashSet[string] + $labelsToRemove = New-Object System.Collections.Generic.HashSet[string] + + # Note: perf label may be added but it is kind of a guess so we don't remove + # it automatically in order to also allow manual inclusion after reviewing files + $managedLabels = 'infra', 'documentation', 'dependencies' + $rootInfraFiles = 'global.json', 'NuGet.config', 'codeowners' + $documentationFiles = 'readme.md', 'contributing.md', 'releasing.md', 'versioning.md' + + foreach ($fileChanged in $filesChangedOnPullRequest) + { + $fileChanged = $fileChanged.ToLower() + $fullFileName = [System.IO.Path]::GetFileName($fileChanged) + $fileName = [System.IO.Path]::GetFileNameWithoutExtension($fileChanged) + $fileExtension = [System.IO.Path]::GetExtension($fileChanged) + + if ($fileChanged.StartsWith('src/') -or $fileChanged.StartsWith('test/')) + { + $match = [regex]::Match($fileChanged, '^(?:(?:src)|(?:test))\/(.*?)\/.+$') + if ($match.Success -eq $false) + { + continue + } + $rawProjectName = $match.Groups[1].Value + if ($rawProjectName.Contains(".benchmarks") -or $rawProjectName.Contains(".stress")) + { + $added = $labelsToAdd.Add("perf") + } + + $projectName = $rawProjectName.Replace(".tests", "").Replace(".benchmarks", "").Replace(".stress", "") + if ($visitedProjects.Contains($projectName)) + { + continue + } + + $added = $visitedProjects.Add($projectName); + + foreach ($repoLabel in $repoLabels) + { + if ($repoLabel.name.StartsWith($labelPackagePrefix)) + { + $package = $repoLabel.name.Substring($labelPackagePrefix.Length).ToLower() + if ($package.StartsWith('opentelemetry') -eq $false) + { + # Note: On contrib labels don't have "OpenTelemetry." prefix + $package = 'opentelemetry.' + $package + } + if ($package -eq $projectName) + { + $added = $labelsToAdd.Add($repoLabel.name) + break + } + } + } + } + + if ($documentationFiles.Contains($fullFileName) -or + $fileChanged.StartsWith('docs/') -or + $fileChanged.StartsWith('examples/')) + { + $added = $labelsToAdd.Add("documentation") + } + + if ($fileChanged.StartsWith('build/') -or + $fileChanged.StartsWith('.github/') -or + $rootInfraFiles.Contains($fullFileName) -or + $fileExtension -eq ".props" -or + $fileExtension -eq ".targets" -or + $fileChanged.StartsWith('test\openTelemetry.aotcompatibility')) + { + $added = $labelsToAdd.Add("infra") + } + + if ($fileChanged.StartsWith('test\benchmarks')) + { + $added = $labelsToAdd.Add("perf") + } + + if ($fullFileName -eq 'directory.packages.props') + { + $added = $labelsToAdd.Add("dependencies") + } + } + + foreach ($labelOnPullRequest in $labelsOnPullRequest) + { + if ($labelsToAdd.Contains($labelOnPullRequest.name)) + { + $removed = $labelsToAdd.Remove($labelOnPullRequest.name) + } + elseif ($labelOnPullRequest.name.StartsWith($labelPackagePrefix) -or + $managedLabels.Contains($labelOnPullRequest.name)) + { + $added = $labelsToRemove.Add($labelOnPullRequest.name) + } + } + + if ($labelsToAdd.Count -gt 0) + { + foreach ($label in $labelsToAdd) + { + gh pr edit $pullRequestNumber --add-label $label + } + } + + if ($labelsToRemove.Count -gt 0) + { + foreach ($label in $labelsToRemove) + { + gh pr edit $pullRequestNumber --remove-label $label + } + } +} + +Export-ModuleMember -Function AddLabelsOnPullRequestsBasedOnFilesChanged diff --git a/build/scripts/post-release.psm1 b/build/scripts/post-release.psm1 index ff74519816..0cc7e96fd7 100644 --- a/build/scripts/post-release.psm1 +++ b/build/scripts/post-release.psm1 @@ -1,7 +1,8 @@ function CreateRelease { param( [Parameter(Mandatory=$true)][string]$gitRepository, - [Parameter(Mandatory=$true)][string]$tag + [Parameter(Mandatory=$true)][string]$tag, + [Parameter()][string]$releaseFiles ) $match = [regex]::Match($tag, '^(.*?-)(.*)$') @@ -69,7 +70,7 @@ $content if ($version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc') { - gh release create $tag ` + gh release create $tag $releaseFiles ` --title $tag ` --verify-tag ` --notes $notes ` @@ -77,7 +78,7 @@ $content } else { - gh release create $tag ` + gh release create $tag $releaseFiles ` --title $tag ` --verify-tag ` --notes $notes ` @@ -106,7 +107,7 @@ function TryPostPackagesReadyNoticeOnPrepareReleasePullRequest { foreach ($pr in $prListResponse) { - if ($pr.author.login -ne $botUserName -or $pr.title -ne "[repo] Prepare release $tag") + if ($pr.author.login -ne $botUserName -or $pr.title -ne "[release] Prepare release $tag") { continue } @@ -249,11 +250,11 @@ Merge once packages are available on NuGet and the build passes. "@ gh pr create ` - --title "[repo] $tagPrefix stable release $version updates" ` + --title "[release] $tagPrefix stable release $version updates" ` --body $body ` --base $targetBranch ` --head $branch ` - --label infra + --label release } Export-ModuleMember -Function CreatePackageValidationBaselineVersionUpdatePullRequest @@ -263,6 +264,7 @@ function CreateOpenTelemetryCoreLatestVersionUpdatePullRequest { [Parameter(Mandatory=$true)][string]$gitRepository, [Parameter(Mandatory=$true)][string]$tag, [Parameter()][string]$targetBranch="main", + [Parameter()][string]$lineEnding="`n", [Parameter()][string]$gitUserName, [Parameter()][string]$gitUserEmail ) @@ -274,26 +276,35 @@ function CreateOpenTelemetryCoreLatestVersionUpdatePullRequest { } $tagPrefix = $match.Groups[1].Value - if ($tagPrefix.StartsWith('core-') -eq $false) + $version = $match.Groups[2].Value + $isPrerelease = ($version.Contains('-alpha.') -or $version.Contains('-beta.') -or $version.Contains('-rc.')) + + if ($tagPrefix.StartsWith('core-') -eq $true) + { + $changelogEntry = "Updated OpenTelemetry core component version(s) to" + $propertyName = "OpenTelemetryCoreLatestVersion" + $propertyVersion = "[$version,2.0)" + if ($isPrerelease -eq $true) + { + $propertyName = "OpenTelemetryCoreLatestPrereleaseVersion" + $propertyVersion = "[$version]" + } + } + elseif ($tagPrefix.StartsWith('coreunstable-') -eq $true) + { + $changelogEntry = "Updated OpenTelemetry core unstable component version(s) to" + $propertyName = "OpenTelemetryCoreUnstableLatestVersion" + $propertyVersion = "[$version]" + } + else { Return } $projectsAndDependenciesBefore = GetCoreDependenciesForProjects - $version = $match.Groups[2].Value - $isPrerelease = ($version.Contains('-alpha.') -or $version.Contains('-beta.') -or $version.Contains('-rc.')) - $branch="release/post-core-${version}-update" - $propertyName = "OpenTelemetryCoreLatestVersion" - $propertyVersion = "[$version,2.0)" - if ($isPrerelease -eq $true) - { - $propertyName = "OpenTelemetryCoreLatestPrereleaseVersion" - $propertyVersion = "[$version]" - } - (Get-Content build/Common.props) ` -replace "<$propertyName>.*<\/$propertyName>", "<$propertyName>$propertyVersion" | Set-Content build/Common.props @@ -362,11 +373,13 @@ Merge once packages are available on NuGet and the build passes. "@ $createPullRequestResponse = gh pr create ` - --title "[repo] Core release $version updates" ` + --title "[release] $tag release updates" ` --body $body ` --base $targetBranch ` --head $branch ` - --label infra + --label release + + Write-Host $createPullRequestResponse $match = [regex]::Match($createPullRequestResponse, "\/pull\/(.*)$") if ($match.Success -eq $false) @@ -382,18 +395,25 @@ Merge once packages are available on NuGet and the build passes. } $entry = @" -* Updated OpenTelemetry core component version(s) to ``$version``. +* $changelogEntry ``$version``. ([#$pullRequestNumber](https://github.com/$gitRepository/pull/$pullRequestNumber)) "@ $lastLineBlank = $true + $changelogFilesUpdated = 0 foreach ($projectDir in $changedProjects.Keys) { $path = Join-Path -Path $projectDir -ChildPath "CHANGELOG.md" + if ([System.IO.File]::Exists($path) -eq $false) + { + Write-Host "No CHANGELOG found in $projectDir" + continue + } + $changelogContent = Get-Content -Path $path $started = $false @@ -410,16 +430,21 @@ $entry = @" { if ($lastLineBlank -eq $false) { - $content += "`r`n" + $content += $lineEnding } $content += $entry $started = $false $isRemoving = $false } - elseif ($line -like '*Update* OpenTelemetry SDK version to*' -and $started -eq $true) + elseif ($started -eq $true -and $tagPrefix.StartsWith('core-') -eq $true -and $line -like '*Update* OpenTelemetry SDK version to*') { - $isRemoving = $true - continue + $isRemoving = $true + continue + } + elseif ($started -eq $true -and $line -like "*$changelogEntry*") + { + $isRemoving = $true + continue } if ($line.StartsWith('* ')) @@ -431,7 +456,7 @@ $entry = @" if ($lastLineBlank -eq $false) { - $content += "`r`n" + $content += $lineEnding } } @@ -440,7 +465,7 @@ $entry = @" continue } - $content += $line + "`r`n" + $content += $line + $lineEnding $lastLineBlank = [string]::IsNullOrWhitespace($line) } @@ -450,7 +475,7 @@ $entry = @" # Note: If we never wrote the entry it means the file ended in the unreleased section if ($lastLineBlank -eq $false) { - $content += "`r`n" + $content += $lineEnding } $content += $entry } @@ -462,18 +487,23 @@ $entry = @" { throw 'git add failure' } - } - git commit -m "Update CHANGELOGs for projects using $propertyName." 2>&1 | % ToString - if ($LASTEXITCODE -gt 0) - { - throw 'git commit failure' + $changelogFilesUpdated++ } - git push -u origin $branch 2>&1 | % ToString - if ($LASTEXITCODE -gt 0) + if ($changelogFilesUpdated -gt 0) { - throw 'git push failure' + git commit -m "Update CHANGELOGs for projects using $propertyName." 2>&1 | % ToString + if ($LASTEXITCODE -gt 0) + { + throw 'git commit failure' + } + + git push -u origin $branch 2>&1 | % ToString + if ($LASTEXITCODE -gt 0) + { + throw 'git push failure' + } } } @@ -503,7 +533,11 @@ function GetCoreDependenciesForProjects { if ($packageName -eq 'OpenTelemetry' -or $packageName -eq 'OpenTelemetry.Api' -or $packageName -eq 'OpenTelemetry.Api.ProviderBuilderExtensions' -or - $packageName -eq 'OpenTelemetry.Extensions.Hosting') + $packageName -eq 'OpenTelemetry.Extensions.Hosting' -or + $packageName -eq 'OpenTelemetry.Extensions.Propagators' -or + $packageName -eq 'OpenTelemetry.Exporter.Prometheus.AspNetCore' -or + $packageName -eq 'OpenTelemetry.Exporter.Prometheus.HttpListener' -or + $packageName -eq 'OpenTelemetry.Shims.OpenTracing') { $projectDependencies[$packageName.ToString()] = $packageVersion.ToString() } diff --git a/build/scripts/prepare-release.psm1 b/build/scripts/prepare-release.psm1 index 0db3cca47e..f567987878 100644 --- a/build/scripts/prepare-release.psm1 +++ b/build/scripts/prepare-release.psm1 @@ -68,11 +68,11 @@ Note: This PR was opened automatically by the [prepare release workflow](https:/ } gh pr create ` - --title "[repo] Prepare release $tag" ` + --title "[release] Prepare release $tag" ` --body $body ` --base $targetBranch ` --head $branch ` - --label infra + --label release } Export-ModuleMember -Function CreatePullRequestToUpdateChangelogsAndPublicApis @@ -91,7 +91,7 @@ function LockPullRequestAndPostNoticeToCreateReleaseTag { throw 'PR author was unexpected' } - $match = [regex]::Match($prViewResponse.title, '^\[repo\] Prepare release (.*)$') + $match = [regex]::Match($prViewResponse.title, '^\[release\] Prepare release (.*)$') if ($match.Success -eq $false) { throw 'Could not parse tag from PR title' @@ -109,7 +109,7 @@ function LockPullRequestAndPostNoticeToCreateReleaseTag { @" I noticed this PR was merged. -Post a comment with "/CreateReleaseTag" in the body if you would like me to create the release tag ``$tag`` for [the merge commit](https://github.com/$gitRepository/commit/$commit) and then trigger the package workflow. +Post a comment with "/CreateReleaseTag" in the body if you would like me to create the release tag ``$tag`` for [the merge commit](https://github.com/$gitRepository/commit/$commit) which will trigger the package workflow. "@ gh pr comment $pullRequestNumber --body $body @@ -135,7 +135,7 @@ function CreateReleaseTagAndPostNoticeOnPullRequest { throw 'PR author was unexpected' } - $match = [regex]::Match($prViewResponse.title, '^\[repo\] Prepare release (.*)$') + $match = [regex]::Match($prViewResponse.title, '^\[release\] Prepare release (.*)$') if ($match.Success -eq $false) { throw 'Could not parse tag from PR title' diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln index 2d80d5dceb..f0a4560077 100644 --- a/opentelemetry-dotnet-contrib.sln +++ b/opentelemetry-dotnet-contrib.sln @@ -361,7 +361,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{70CA77 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{45D29DAA-0DB9-4808-B879-1AECC37EF366}" ProjectSection(SolutionItems) = preProject - build\scripts\add-labels.ps1 = build\scripts\add-labels.ps1 + build\scripts\add-labels.psm1 = build\scripts\add-labels.psm1 build\scripts\build.psm1 = build\scripts\build.psm1 build\scripts\finalize-publicapi.ps1 = build\scripts\finalize-publicapi.ps1 build\scripts\post-release.psm1 = build\scripts\post-release.psm1 diff --git a/src/OpenTelemetry.Exporter.Geneva/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Exporter.Geneva/.publicApi/PublicAPI.Unshipped.txt index e69de29bb2..47d044db99 100644 --- a/src/OpenTelemetry.Exporter.Geneva/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Exporter.Geneva/.publicApi/PublicAPI.Unshipped.txt @@ -0,0 +1,6 @@ +OpenTelemetry.Exporter.Geneva.GenevaExporterOptions.IncludeTraceStateForSpan.get -> bool +OpenTelemetry.Exporter.Geneva.GenevaExporterOptions.IncludeTraceStateForSpan.set -> void +static Microsoft.Extensions.Logging.GenevaLoggingExtensions.AddGenevaLogExporter(this OpenTelemetry.Logs.LoggerProviderBuilder builder) -> OpenTelemetry.Logs.LoggerProviderBuilder +static Microsoft.Extensions.Logging.GenevaLoggingExtensions.AddGenevaLogExporter(this OpenTelemetry.Logs.LoggerProviderBuilder builder, string name, System.Action configureExporter) -> OpenTelemetry.Logs.LoggerProviderBuilder +static Microsoft.Extensions.Logging.GenevaLoggingExtensions.AddGenevaLogExporter(this OpenTelemetry.Logs.LoggerProviderBuilder builder, System.Action configureExporter) -> OpenTelemetry.Logs.LoggerProviderBuilder +static OpenTelemetry.Exporter.Geneva.GenevaExporterHelperExtensions.AddGenevaTraceExporter(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder diff --git a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md index c7305b6af7..d48fa9a706 100644 --- a/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md @@ -2,6 +2,26 @@ ## Unreleased +* Update GenevaTraceExporter to export `activity.TraceStateString` as the value + for Part B `traceState` field for Spans when the `IncludeTraceStateForSpan` + option is set to `true`. This is an opt-in feature and the default value is `false`. + Note that this is for Spans only and not for LogRecord. + ([#1850](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1850)) + +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + +## 1.9.0-rc.1 + +Released 2024-Jun-12 + +* Update OpenTelemetry SDK version to `1.9.0-rc.1`. + ([#1869](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1869)) + +* Added `LoggerProviderBuilder.AddGenevaLogExporter` registration extensions. + Added `TracerProviderBuilder.AddGenevaTraceExporter()` registration extension. + ([#1880](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1880)) + ## 1.9.0-alpha.1 Released 2024-May-22 diff --git a/src/OpenTelemetry.Exporter.Geneva/Common.GenevaExporter.props b/src/OpenTelemetry.Exporter.Geneva/Common.GenevaExporter.props index 78181066e1..5570a7a1fe 100644 --- a/src/OpenTelemetry.Exporter.Geneva/Common.GenevaExporter.props +++ b/src/OpenTelemetry.Exporter.Geneva/Common.GenevaExporter.props @@ -1,6 +1,6 @@ - $(OpenTelemetryCoreLatestPrereleaseVersion) + $(OpenTelemetryCoreLatestVersion) diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaExporterHelperExtensions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaExporterHelperExtensions.cs index cc913f5ef0..74b1a0113f 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaExporterHelperExtensions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaExporterHelperExtensions.cs @@ -12,6 +12,14 @@ namespace OpenTelemetry.Exporter.Geneva; public static class GenevaExporterHelperExtensions { + /// + /// Adds to the . + /// + /// builder to use. + /// The instance of to chain the calls. + public static TracerProviderBuilder AddGenevaTraceExporter(this TracerProviderBuilder builder) + => AddGenevaTraceExporter(builder, name: null, configure: null); + /// /// Adds to the . /// @@ -32,34 +40,64 @@ public static TracerProviderBuilder AddGenevaTraceExporter(this TracerProviderBu { Guard.ThrowIfNull(builder); - name ??= Options.DefaultName; + var finalOptionsName = name ?? Options.DefaultName; - if (configure != null) + builder.ConfigureServices(services => { - builder.ConfigureServices(services => services.Configure(name, configure)); - } + if (name != null && configure != null) + { + // If we are using named options we register the + // configuration delegate into options pipeline. + services.Configure(finalOptionsName, configure); + } + }); return builder.AddProcessor(sp => { - var exporterOptions = sp.GetRequiredService>().Get(name); + GenevaExporterOptions exporterOptions; + + BatchExportActivityProcessorOptions batchExportActivityProcessorOptions; + + if (name == null) + { + // If we are NOT using named options we create a new + // instance always. The reason for this is + // GenevaExporterOptions is shared by tracing and logging signals. Without a + // name, delegates for all signals will mix together. See: + // https://github.com/open-telemetry/opentelemetry-dotnet/issues/4043 + exporterOptions = sp.GetRequiredService>().Create(finalOptionsName); + + batchExportActivityProcessorOptions = sp.GetRequiredService>().Create(finalOptionsName); + + // Configuration delegate is executed inline on the fresh instance. + configure?.Invoke(exporterOptions); + } + else + { + // When using named options we can properly utilize Options + // API to create or reuse an instance. + exporterOptions = sp.GetRequiredService>().Get(finalOptionsName); + + batchExportActivityProcessorOptions = sp.GetRequiredService>().Get(finalOptionsName); + } - return BuildGenevaTraceExporter(exporterOptions, configure); + return BuildGenevaTraceExporter( + exporterOptions, + batchExportActivityProcessorOptions); }); } - private static BaseProcessor BuildGenevaTraceExporter(GenevaExporterOptions options, Action configure) + private static BaseProcessor BuildGenevaTraceExporter(GenevaExporterOptions options, BatchExportActivityProcessorOptions batchActivityExportProcessor) { - configure?.Invoke(options); var exporter = new GenevaTraceExporter(options); if (exporter.IsUsingUnixDomainSocket) { - var batchOptions = new BatchExportActivityProcessorOptions(); return new BatchActivityExportProcessor( exporter, - batchOptions.MaxQueueSize, - batchOptions.ScheduledDelayMilliseconds, - batchOptions.ExporterTimeoutMilliseconds, - batchOptions.MaxExportBatchSize); + batchActivityExportProcessor.MaxQueueSize, + batchActivityExportProcessor.ScheduledDelayMilliseconds, + batchActivityExportProcessor.ExporterTimeoutMilliseconds, + batchActivityExportProcessor.MaxExportBatchSize); } else { diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaExporterOptions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaExporterOptions.cs index 9069182880..1f9bfa0aaf 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaExporterOptions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaExporterOptions.cs @@ -25,6 +25,8 @@ public class GenevaExporterOptions public EventNameExportMode EventNameExportMode { get; set; } + public bool IncludeTraceStateForSpan { get; set; } + public IReadOnlyDictionary TableNameMappings { get => this._tableNameMappings; diff --git a/src/OpenTelemetry.Exporter.Geneva/GenevaLoggingExtensions.cs b/src/OpenTelemetry.Exporter.Geneva/GenevaLoggingExtensions.cs index 908038e053..6d950f2180 100644 --- a/src/OpenTelemetry.Exporter.Geneva/GenevaLoggingExtensions.cs +++ b/src/OpenTelemetry.Exporter.Geneva/GenevaLoggingExtensions.cs @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 using System; +using System.Diagnostics; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; using OpenTelemetry; using OpenTelemetry.Exporter.Geneva; using OpenTelemetry.Internal; @@ -27,4 +30,102 @@ public static OpenTelemetryLoggerOptions AddGenevaLogExporter(this OpenTelemetry return options.AddProcessor(new ReentrantExportProcessor(exporter)); } } + + /// + /// Adds Geneva exporter to the LoggerProvider. + /// + /// builder to use. + /// The instance of to chain the calls. + public static LoggerProviderBuilder AddGenevaLogExporter(this LoggerProviderBuilder builder) + => AddGenevaLogExporter(builder, name: null, configureExporter: null); + + /// + /// Adds Geneva exporter to the LoggerProvider. + /// + /// builder to use. + /// Callback action for configuring . + /// The instance of to chain the calls. + public static LoggerProviderBuilder AddGenevaLogExporter(this LoggerProviderBuilder builder, Action configureExporter) + => AddGenevaLogExporter(builder, name: null, configureExporter); + + /// + /// Adds Geneva exporter to the LoggerProvider. + /// + /// builder to use. + /// Optional name which is used when retrieving options. + /// Optional callback action for configuring . + /// The instance of to chain the calls. + public static LoggerProviderBuilder AddGenevaLogExporter( + this LoggerProviderBuilder builder, + string name, + Action configureExporter) + { + var finalOptionsName = name ?? Options.Options.DefaultName; + + builder.ConfigureServices(services => + { + if (name != null && configureExporter != null) + { + // If we are using named options we register the + // configuration delegate into options pipeline. + services.Configure(finalOptionsName, configureExporter); + } + }); + + return builder.AddProcessor(sp => + { + GenevaExporterOptions exporterOptions; + + BatchExportLogRecordProcessorOptions batchExportLogRecordProcessorOptions; + + if (name == null) + { + // If we are NOT using named options we create a new + // instance always. The reason for this is + // GenevaExporterOptions is shared by tracing and logging signals. Without a + // name, delegates for all signals will mix together. See: + // https://github.com/open-telemetry/opentelemetry-dotnet/issues/4043 + exporterOptions = sp.GetRequiredService>().Create(finalOptionsName); + + batchExportLogRecordProcessorOptions = sp.GetRequiredService>().Create(finalOptionsName); + + // Configuration delegate is executed inline on the fresh instance. + configureExporter?.Invoke(exporterOptions); + } + else + { + // When using named options we can properly utilize Options + // API to create or reuse an instance. + exporterOptions = sp.GetRequiredService>().Get(finalOptionsName); + + batchExportLogRecordProcessorOptions = sp.GetRequiredService>().Get(finalOptionsName); + } + + return BuildGenevaLogExporter( + batchExportLogRecordProcessorOptions, + exporterOptions); + }); + } + + internal static BaseProcessor BuildGenevaLogExporter( + BatchExportLogRecordProcessorOptions batchExportLogRecordProcessorOptions, + GenevaExporterOptions exporterOptions) + { + Debug.Assert(exporterOptions != null, "exporterOptions was null"); + + var exporter = new GenevaLogExporter(exporterOptions); + if (exporter.IsUsingUnixDomainSocket) + { + return new BatchLogRecordExportProcessor( + exporter, + batchExportLogRecordProcessorOptions.MaxQueueSize, + batchExportLogRecordProcessorOptions.ScheduledDelayMilliseconds, + batchExportLogRecordProcessorOptions.ExporterTimeoutMilliseconds, + batchExportLogRecordProcessorOptions.MaxExportBatchSize); + } + else + { + return new ReentrantExportProcessor(exporter); + } + } } diff --git a/src/OpenTelemetry.Exporter.Geneva/MsgPackExporter/MsgPackTraceExporter.cs b/src/OpenTelemetry.Exporter.Geneva/MsgPackExporter/MsgPackTraceExporter.cs index 94b7f86bf9..c205c8a0c2 100644 --- a/src/OpenTelemetry.Exporter.Geneva/MsgPackExporter/MsgPackTraceExporter.cs +++ b/src/OpenTelemetry.Exporter.Geneva/MsgPackExporter/MsgPackTraceExporter.cs @@ -91,6 +91,8 @@ public MsgPackTraceExporter(GenevaExporterOptions options) #endif } + this.m_shouldIncludeTraceState = options.IncludeTraceStateForSpan; + var buffer = new byte[BUFFER_SIZE]; var cursor = 0; @@ -243,6 +245,17 @@ internal int SerializeActivity(Activity activity) cntFields += 1; } + if (this.m_shouldIncludeTraceState) + { + var traceStateString = activity.TraceStateString; + if (!string.IsNullOrEmpty(traceStateString)) + { + cursor = MessagePackSerializer.SerializeAsciiString(buffer, cursor, "traceState"); + cursor = MessagePackSerializer.SerializeUnicodeString(buffer, cursor, traceStateString); + cntFields += 1; + } + } + var linkEnumerator = activity.EnumerateLinks(); if (linkEnumerator.MoveNext()) { @@ -453,5 +466,7 @@ public void Dispose() private readonly HashSet m_dedicatedFields; #endif + private readonly bool m_shouldIncludeTraceState; + private bool isDisposed; } diff --git a/src/OpenTelemetry.Exporter.Geneva/README.md b/src/OpenTelemetry.Exporter.Geneva/README.md index 049bb6663c..286fa63dfd 100644 --- a/src/OpenTelemetry.Exporter.Geneva/README.md +++ b/src/OpenTelemetry.Exporter.Geneva/README.md @@ -98,6 +98,13 @@ A list of fields which should be stored as individual table columns. This is a collection of fields that will be applied to all the Logs and Traces sent through this exporter. +#### `IncludeTraceStateForSpan` (optional) + +Export `activity.TraceStateString` as the value for Part B `traceState` field for +Spans when the `IncludeTraceStateForSpan` option is set to `true`. +This is an opt-in feature and the default value is `false`. +Note that this is for Spans only and not for LogRecord. + #### `TableNameMappings` (optional) This defines the mapping for the table name used to store Logs and Traces. diff --git a/src/OpenTelemetry.Exporter.Geneva/TLDExporter/TldTraceExporter.cs b/src/OpenTelemetry.Exporter.Geneva/TLDExporter/TldTraceExporter.cs index 95e4d15b82..ce63e57fab 100644 --- a/src/OpenTelemetry.Exporter.Geneva/TLDExporter/TldTraceExporter.cs +++ b/src/OpenTelemetry.Exporter.Geneva/TLDExporter/TldTraceExporter.cs @@ -43,6 +43,7 @@ internal sealed class TldTraceExporter : TldExporter, IDisposable private readonly byte partAFieldsCount = 3; // At least three fields: time, ext_dt_traceId, ext_dt_spanId private readonly HashSet m_customFields; private readonly Tuple repeatedPartAFields; + private readonly bool m_shouldIncludeTraceState; private readonly EventProvider eventProvider; @@ -114,6 +115,8 @@ public TldTraceExporter(GenevaExporterOptions options) this.repeatedPartAFields = eb.GetRawFields(); } } + + this.m_shouldIncludeTraceState = options.IncludeTraceStateForSpan; } public ExportResult Export(in Batch batch) @@ -205,6 +208,16 @@ internal void SerializeActivity(Activity activity) partBFieldsCount++; } + if (this.m_shouldIncludeTraceState) + { + var traceStateString = activity.TraceStateString; + if (!string.IsNullOrEmpty(traceStateString)) + { + eb.AddCountedAnsiString("traceState", traceStateString, Encoding.UTF8); + partBFieldsCount++; + } + } + var linkEnumerator = activity.EnumerateLinks(); if (linkEnumerator.MoveNext()) { diff --git a/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md b/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md index cd581033a3..a919418175 100644 --- a/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.InfluxDB/CHANGELOG.md @@ -2,8 +2,8 @@ ## Unreleased -* Updates OpenTelemetry SDK version to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) ## 1.0.0-alpha.3 @@ -11,6 +11,7 @@ Released 2023-Oct-13 * Updates to 1.6.0 of OpenTelemetry SDK. ([#1344](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1344)) + * Support for a configurable export interval in OpenTelemetry.Exporter.InfluxDB. ([#1394](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1394)) @@ -21,6 +22,7 @@ Released 2023-Jun-20 * Support for Resource attributes in OpenTelemetry.Exporter.InfluxDB, allowing resource attributes to be passed as InfluxDB tags. ([#1241](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1241)) + * Updates to 1.5.0 of OpenTelemetry SDK. ([#1220](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1220)) diff --git a/src/OpenTelemetry.Exporter.Instana/CHANGELOG.md b/src/OpenTelemetry.Exporter.Instana/CHANGELOG.md index 1ecd8030b1..65df2e05a7 100644 --- a/src/OpenTelemetry.Exporter.Instana/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Instana/CHANGELOG.md @@ -5,8 +5,9 @@ * Drop support for .NET Framework 4.6.1. The lowest supported version is .NET Framework 4.6.2. ([#1050](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1050)) -* Update OpenTelemetry SDK version to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) + +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) ## 1.0.3 @@ -14,6 +15,7 @@ Released 2023-Feb-21 * Fixes issue in span serialization process introduced in 1.0.2 version. ([#979](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/979)) + * Update OpenTelemetry SDK version to `1.3.2`. ([#917](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/917)) @@ -33,8 +35,10 @@ Released 2022-Nov-02 * Instana span duration was not calculated correctly [376](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/376) + * Application is crashing if environment variables are not defined [385](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/385) + * Update OpenTelemetry SDK version to `1.3.1`. ([#749](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/749)) diff --git a/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md b/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md index f3ad78eb10..a66bea6860 100644 --- a/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.OneCollector/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + ## 1.9.0-rc.1 Released 2024-Jun-11 diff --git a/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj b/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj index 3a3a2cffb9..6ebaded012 100644 --- a/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj +++ b/src/OpenTelemetry.Exporter.OneCollector/OpenTelemetry.Exporter.OneCollector.csproj @@ -19,7 +19,7 @@ - $(OpenTelemetryCoreLatestPrereleaseVersion) + $(OpenTelemetryCoreLatestVersion) $(DefineConstants);EXPOSE_EXPERIMENTAL_FEATURES diff --git a/src/OpenTelemetry.Exporter.Stackdriver/CHANGELOG.md b/src/OpenTelemetry.Exporter.Stackdriver/CHANGELOG.md index 5d912749ed..00a00b1c6f 100644 --- a/src/OpenTelemetry.Exporter.Stackdriver/CHANGELOG.md +++ b/src/OpenTelemetry.Exporter.Stackdriver/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + ## 1.0.0-beta.6 Released 2024-Apr-22 @@ -9,8 +12,10 @@ Released 2024-Apr-22 * Fixes an issue when Activity/ActivityLink tags contain duplicate tag keys that lead to ArgumentException. ([#1660](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1660)) + * Update OpenTelemetry SDK version to `1.8.1`. ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) + * Annotates trace information with `service.name` attribute if it's present in the resource tags. Please use `services.ConfigureResource(r => r.AddService("my-service", "1.0.0"))` @@ -23,6 +28,7 @@ Released 2024-Feb-15 * Update OpenTelemetry SDK version to `1.7.0`. ([#1486](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1486)) + * Add support of a native "gRPC for .NET" for apps targeting .NET 6.0 or later. ([#1414](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/issues/1414)) 1. Add support net8.0, net6.0 as target frameworks. @@ -37,6 +43,7 @@ Released 2022-Dec-07 * Fix the issue of incorrect handling of null attributes. ([#566](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/566)) + * Support for Google Cloud Dependencies up to 3.x.x and OpenTelemetry SDK package to 1.3.1 ([#794](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/794)) @@ -46,8 +53,11 @@ Released 2022-Dec-07 Released 2022-Jul-22 * Updated OpenTelemetry SDK package version to 1.2.0 + * Updated minimum full framework support to net462 + * Update Google.Cloud.Monitoring.V3 2.1.0 -> 2.6.0 + * Update Google.Cloud.Monitoring.V3 2.0.0 -> 2.3.0 * Rename the namespaces to remove the word `Contrib` from them: @@ -70,6 +80,7 @@ Released 2022-Jul-22 ## 1.0.0-beta1 * Update OpenTelemetry SDK package version to 1.1.0 + * Log exceptions when failing to export data to stackdriver ## Initial Release diff --git a/src/OpenTelemetry.Extensions.AWS/CHANGELOG.md b/src/OpenTelemetry.Extensions.AWS/CHANGELOG.md index 87a842cabd..0d049f8f79 100644 --- a/src/OpenTelemetry.Extensions.AWS/CHANGELOG.md +++ b/src/OpenTelemetry.Extensions.AWS/CHANGELOG.md @@ -2,11 +2,12 @@ ## Unreleased -* Update OpenTelemetry SDK version to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) * Remove NuGet reference to `System.Net.Http` ([#1713](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1713)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + ## 1.3.0-beta.1 Released 2023-Aug-02 @@ -14,29 +15,38 @@ Released 2023-Aug-02 * Rename package from `OpenTelemetry.Contrib.Extensions.AWSXRay` to `OpenTelemetry.Extensions.AWS` ([#1232](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1232)) + * Updates to 1.5.1 of OpenTelemetry SDK. ([#1255](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1255)) + * Enhancement - AWSXRayIdGenerator - Generate X-Ray IDs with global Random instance instead of recreating with ThreadLocal ([#380](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/380)) + * Raised minimum .NET version to `net462` ([#875](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/875)) + * Replaced Newtonsoft.Json dependency with System.Text.Json ([#1092](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1092)) + * Enhancement - AWSECSResourceDetector - Implement `aws.{ecs.*,log.*}` resource attributes with data from ECS Metadata endpoint v4 ([#875](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/875)) + * Removal - IResourceDetector - Remove local IResourceDetector interface and its supporting ResourceBuilderExtensions extension, and migrate all detectors to implement OpenTelemetry.Resources.IResourceDetector ([#875](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/875)) + * Add a `net6.0` build with optimized trace ID generation using the new `Activity.TraceIdGenerator` API. ([#1096](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1096)) + * Drop support for `AWSLambdaResourceDetector`. AWS Lambda Resources are detected by `OpenTelemetry.Instrumentation.AWSLambda` package ([#1140](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1140)) + * Extract AWS Resource Detectors to dedicated package `OpenTelemetry.ResourceDetectors.AWS` ([#1140](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1140)) @@ -47,6 +57,7 @@ Released 2022-May-18 * Enhancement - AWSEKSResourceDetector - Validate ClusterName/ContainerID independently before adding it to the resource ([#205](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/205)) + * Fix - AWSEKSResourceDetector fails to detect resources due to exception "The SSL connection could not be established" ([#208](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/208)) @@ -56,6 +67,7 @@ Released 2022-May-18 Released 2021-Sep-20 * Added AWS resource detectors ([#149](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/149)) + * Updated OTel SDK package version to 1.1.0 ([#100](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/100)) diff --git a/src/OpenTelemetry.Extensions.Enrichment/CHANGELOG.md b/src/OpenTelemetry.Extensions.Enrichment/CHANGELOG.md index 642075cb3f..4c11ffe15d 100644 --- a/src/OpenTelemetry.Extensions.Enrichment/CHANGELOG.md +++ b/src/OpenTelemetry.Extensions.Enrichment/CHANGELOG.md @@ -4,3 +4,6 @@ * Make Extensions.Enrichment AoT compatible. ([#1541](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1541)) + +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) diff --git a/src/OpenTelemetry.Extensions/CHANGELOG.md b/src/OpenTelemetry.Extensions/CHANGELOG.md index c1df059f81..fde331e39a 100644 --- a/src/OpenTelemetry.Extensions/CHANGELOG.md +++ b/src/OpenTelemetry.Extensions/CHANGELOG.md @@ -5,6 +5,9 @@ * Update BaggageActivityProcessor to require baggage key predicate. ([#1816](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1816)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + ## 1.0.0-beta.5 Released 2024-May-08 diff --git a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md index 102e86b315..78b64f3b18 100644 --- a/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule/CHANGELOG.md @@ -2,8 +2,8 @@ ## Unreleased -* Update `OpenTelemetry.Api` to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) ## 1.8.0-beta.1 @@ -11,6 +11,7 @@ Released 2024-Apr-05 * `Meter.Version` is set to NuGet package version. ([#1624](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1624)) + * Update `OpenTelemetry.Api` to `1.8.0`. ([#1635](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1635)) diff --git a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md index 2b31a759e3..02aedf6d07 100644 --- a/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md @@ -2,9 +2,8 @@ ## Unreleased -* Update `OpenTelemetry.Api.ProviderBuilderExtensions` to `1.8.1`. - * Update `OpenTelemetry.Api` to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) ## 1.8.1 @@ -454,11 +453,14 @@ Released 2022-Aug-02 * Fix Remote IP Address - NULL reference exception. ([#3481](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3481)) + * Metrics instrumentation to correctly populate `http.flavor` tag. (1.1 instead of HTTP/1.1 etc.) ([#3379](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3379)) + * Tracing instrumentation to populate `http.flavor` tag. ([#3372](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3372)) + * Tracing instrumentation to populate `http.scheme` tag. ([#3392](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3392)) @@ -468,6 +470,7 @@ Released 2022-Jun-03 * Added additional metric dimensions. ([#3247](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3247)) + * Removes net5.0 target as .NET 5.0 is going out of support. The package keeps netstandard2.1 target, so it can still be used with .NET5.0 apps. @@ -487,9 +490,11 @@ Released 2022-Mar-30 * Fix: Http server span status is now unset for `400`-`499`. ([#2904](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2904)) + * Fix: drop direct reference of the `Microsoft.AspNetCore.Http.Features` from net5 & net6 targets (already part of the FrameworkReference since the net5). ([#2860](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2860)) + * Reduce allocations calculating the http.url tag. ([#2947](https://github.com/open-telemetry/opentelemetry-dotnet/pull/2947)) @@ -542,6 +547,7 @@ Released 2021-Mar-19 and ActivityProcessors. Samplers, ActivityProcessor.OnStart will now get the Activity before any enrichment done by the instrumentation. ([#1836](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1836)) + * Performance optimization by leveraging sampling decision and short circuiting activity enrichment. `Filter` and `Enrich` are now only called if `activity.IsAllDataRequested` is `true` @@ -558,6 +564,7 @@ Released 2020-Nov-17 * AspNetCoreInstrumentation sets ActivitySource to activities created outside ActivitySource. ([#1515](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1515/)) + * For gRPC invocations, leading forward slash is trimmed from span name in order to conform to the specification. ([#1551](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1551)) @@ -569,17 +576,21 @@ Released 2020-Nov-5 * Record `Exception` in AspNetCore instrumentation based on `RecordException` in `AspNetCoreInstrumentationOptions` ([#1408](https://github.com/open-telemetry/opentelemetry-dotnet/issues/1408)) + * Added configuration option `EnableGrpcAspNetCoreSupport` to enable or disable support for adding OpenTelemetry RPC attributes when using [Grpc.AspNetCore](https://www.nuget.org/packages/Grpc.AspNetCore/). This option is enabled by default. ([#1423](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1423)) + * Renamed TextMapPropagator to TraceContextPropagator, CompositePropagator to CompositeTextMapPropagator. IPropagator is renamed to TextMapPropagator and changed from interface to abstract class. ([#1427](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1427)) + * Propagators.DefaultTextMapPropagator will be used as the default Propagator ([#1427](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1428)) + * Removed Propagator from Instrumentation Options. Instrumentation now always respect the Propagator.DefaultTextMapPropagator. ([#1448](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1448)) @@ -592,6 +603,7 @@ Released 2020-Oct-16 Activity.CustomProperty. To enrich activity, use the Enrich action on the instrumentation. ([#1261](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1261)) + * Span Status is populated as per new spec ([#1313](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1313)) @@ -621,6 +633,7 @@ Released 2020-08-28 BaggageFormat)`. Baggage sent via the [W3C Baggage](https://github.com/w3c/baggage/blob/master/baggage/HTTP_HEADER_FORMAT.md) header will now be parsed and set on incoming Http spans. + * Introduced support for Grpc.AspNetCore (#803). * Attributes are added to gRPC invocations: `rpc.system`, `rpc.service`, `rpc.method`. These attributes are added to an existing span generated by @@ -628,6 +641,7 @@ Released 2020-08-28 calls where one span is created for the gRPC call and a separate span is created for the underlying HTTP call in the event both gRPC and HTTP instrumentation are enabled. + * Renamed `ITextPropagator` to `IPropagator` ([#1190](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1190)) diff --git a/src/OpenTelemetry.Instrumentation.Cassandra/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Cassandra/CHANGELOG.md index db0a98ed36..a8c7fd6100 100644 --- a/src/OpenTelemetry.Instrumentation.Cassandra/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.Cassandra/CHANGELOG.md @@ -4,8 +4,9 @@ * `ActivitySource.Version` is set to NuGet package version. ([#1624](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1624)) -* Update OpenTelemetry SDK version to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) + +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) ## 1.0.0-beta.1 diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Shipped.txt b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Shipped.txt index e69de29bb2..7dc5c58110 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Shipped.txt +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Unshipped.txt b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Unshipped.txt index 95461d9b80..a3c6cc40bf 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Unshipped.txt +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/.publicApi/PublicAPI.Unshipped.txt @@ -1,6 +1,6 @@ OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.ElasticsearchClientInstrumentationOptions() -> void -OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.Enrich.get -> System.Action +OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.Enrich.get -> System.Action? OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.Enrich.set -> void OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.MaxDbStatementLength.get -> int OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.MaxDbStatementLength.set -> void @@ -11,6 +11,6 @@ OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumenta OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.SuppressDownstreamInstrumentation.get -> bool OpenTelemetry.Instrumentation.ElasticsearchClient.ElasticsearchClientInstrumentationOptions.SuppressDownstreamInstrumentation.set -> void OpenTelemetry.Trace.TracerProviderBuilderExtensions -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder -static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, string name, System.Action configure) -> OpenTelemetry.Trace.TracerProviderBuilder \ No newline at end of file +static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder, System.Action? configure) -> OpenTelemetry.Trace.TracerProviderBuilder! +static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder) -> OpenTelemetry.Trace.TracerProviderBuilder! +static OpenTelemetry.Trace.TracerProviderBuilderExtensions.AddElasticsearchClientInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder, string? name, System.Action? configure) -> OpenTelemetry.Trace.TracerProviderBuilder! diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md index 7fb2da394c..744daabdcb 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md @@ -4,14 +4,17 @@ * Span status is set based on [semantic convention for client spans](https://github.com/open-telemetry/semantic-conventions/blob/v1.24.0/docs/http/http-spans.md#status). ([#1538](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1538)) + * `ActivitySource.Version` is set to NuGet package version. ([#1624](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1624)) -* Update OpenTelemetry SDK version to `1.8.1`. - ([#1668](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1668)) + * Replace `db.url` attribute with `url.full` to comply with [semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/v1.25.0/docs/database/elasticsearch.md#attributes). Redact `username` and `password` part of the `url.full`. ([#1684](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1684)) +* Updated OpenTelemetry core component version(s) to `1.9.0`. + ([#1888](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1888)) + ## 1.0.0-beta.5 Released 2023-Oct-24 @@ -19,6 +22,7 @@ Released 2023-Oct-24 * Fix issue of multiple instances of OpenTelemetry-Instrumentation EventSource being created ([#1362](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1362)) + * Updated OpenTelemetry SDK package version to 1.6.0 ([#1344](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1344)) @@ -28,14 +32,21 @@ Released 2023-Mar-06 * Updated OpenTelemetry SDK package version to 1.4.0 ([#1019](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1019)) + * Update minimum full framework support to net462 + * Requests that get an HTTP status code of 404 are not marked as an error span status + * Add MaxDbStatementLength option with default of 4096 + * Remove duplicated HTTP method and URL from db.statement attribute value + * Fix faulty logic of MaxDbStatementLength option ([#425](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/425)) + * Remove method with default attribute ([#1019](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/1019)) + * Added overloads which accept a name to the `TracerProviderBuilder` `AddElasticsearchClientInstrumentation` extension to allow for more fine-grained options management diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/ElasticsearchClientInstrumentationOptions.cs b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/ElasticsearchClientInstrumentationOptions.cs index dcb91ef5c1..3c7e647ef4 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/ElasticsearchClientInstrumentationOptions.cs +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/ElasticsearchClientInstrumentationOptions.cs @@ -41,5 +41,5 @@ public class ElasticsearchClientInstrumentationOptions /// object: the raw object from which additional information can be extracted to enrich the activity. /// The type of this object depends on the event, which is given by the above parameter. /// - public Action Enrich { get; set; } + public Action? Enrich { get; set; } } diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/Implementation/ElasticsearchRequestPipelineDiagnosticListener.cs b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/Implementation/ElasticsearchRequestPipelineDiagnosticListener.cs index af907e627d..315c7a4e44 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/Implementation/ElasticsearchRequestPipelineDiagnosticListener.cs +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/Implementation/ElasticsearchRequestPipelineDiagnosticListener.cs @@ -28,17 +28,17 @@ internal class ElasticsearchRequestPipelineDiagnosticListener : ListenerHandler internal static readonly string ActivitySourceName = AssemblyName.Name; internal static readonly ActivitySource ActivitySource = new(ActivitySourceName, Assembly.GetPackageVersion()); - private static readonly Regex ParseRequest = new Regex(@"\n# Request:\r?\n(\{.*)\n# Response", RegexOptions.Compiled | RegexOptions.Singleline); - private static readonly ConcurrentDictionary MethodNameCache = new ConcurrentDictionary(); + private static readonly Regex ParseRequest = new(@"\n# Request:\r?\n(\{.*)\n# Response", RegexOptions.Compiled | RegexOptions.Singleline); + private static readonly ConcurrentDictionary MethodNameCache = new(); private readonly ElasticsearchClientInstrumentationOptions options; - private readonly MultiTypePropertyFetcher uriFetcher = new MultiTypePropertyFetcher("Uri"); - private readonly MultiTypePropertyFetcher methodFetcher = new MultiTypePropertyFetcher("Method"); - private readonly MultiTypePropertyFetcher debugInformationFetcher = new MultiTypePropertyFetcher("DebugInformation"); - private readonly MultiTypePropertyFetcher httpStatusFetcher = new MultiTypePropertyFetcher("HttpStatusCode"); - private readonly MultiTypePropertyFetcher originalExceptionFetcher = new MultiTypePropertyFetcher("OriginalException"); - private readonly MultiTypePropertyFetcher failureReasonFetcher = new MultiTypePropertyFetcher("FailureReason"); - private readonly MultiTypePropertyFetcher responseBodyFetcher = new MultiTypePropertyFetcher("ResponseBodyInBytes"); + private readonly MultiTypePropertyFetcher uriFetcher = new("Uri"); + private readonly MultiTypePropertyFetcher methodFetcher = new("Method"); + private readonly MultiTypePropertyFetcher debugInformationFetcher = new("DebugInformation"); + private readonly MultiTypePropertyFetcher httpStatusFetcher = new("HttpStatusCode"); + private readonly MultiTypePropertyFetcher originalExceptionFetcher = new("OriginalException"); + private readonly MultiTypePropertyFetcher failureReasonFetcher = new("FailureReason"); + private readonly MultiTypePropertyFetcher responseBodyFetcher = new("ResponseBodyInBytes"); public ElasticsearchRequestPipelineDiagnosticListener(ElasticsearchClientInstrumentationOptions options) : base("Elasticsearch.Net.RequestPipeline") @@ -46,7 +46,7 @@ public ElasticsearchRequestPipelineDiagnosticListener(ElasticsearchClientInstrum this.options = options; } - public override void OnEventWritten(string name, object payload) + public override void OnEventWritten(string name, object? payload) { var activity = Activity.Current; Guard.ThrowIfNull(activity); @@ -61,7 +61,7 @@ public override void OnEventWritten(string name, object payload) } } - private static string GetDisplayName(Activity activity, object method, string elasticType = null) + private static string GetDisplayName(Activity activity, object? method, string? elasticType = null) { switch (activity.OperationName) { @@ -83,7 +83,7 @@ private static string GetDisplayName(Activity activity, object method, string el } } - private static string GetElasticIndex(Uri uri) + private static string? GetElasticIndex(Uri uri) { // first segment is always / if (uri.Segments.Length < 2) @@ -91,7 +91,7 @@ private static string GetElasticIndex(Uri uri) return null; } - // operations starting with _ are not indices (_cat, _search, etc) + // operations starting with _ are not indices (_cat, _search, etc.) if (uri.Segments[1].StartsWith("_", StringComparison.Ordinal)) { return null; @@ -123,7 +123,7 @@ private string ParseAndFormatRequest(string debugInformation) var request = ParseRequest.Match(debugInformation); if (request.Success) { - string body = request.Groups[1]?.Value?.Trim(); + string? body = request.Groups[1]?.Value?.Trim(); if (body == null) { return debugInformation; @@ -150,7 +150,7 @@ private string ParseAndFormatRequest(string debugInformation) return debugInformation; } - private void OnStartActivity(Activity activity, object payload) + private void OnStartActivity(Activity activity, object? payload) { // By this time, samplers have already run and // activity.IsAllDataRequested populated accordingly. @@ -226,7 +226,7 @@ private void OnStartActivity(Activity activity, object payload) } } - private void OnStopActivity(Activity activity, object payload) + private void OnStopActivity(Activity activity, object? payload) { if (activity.IsAllDataRequested) { diff --git a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/OpenTelemetry.Instrumentation.ElasticsearchClient.csproj b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/OpenTelemetry.Instrumentation.ElasticsearchClient.csproj index 30383291e8..8bd24ba026 100644 --- a/src/OpenTelemetry.Instrumentation.ElasticsearchClient/OpenTelemetry.Instrumentation.ElasticsearchClient.csproj +++ b/src/OpenTelemetry.Instrumentation.ElasticsearchClient/OpenTelemetry.Instrumentation.ElasticsearchClient.csproj @@ -6,7 +6,6 @@ Elasticsearch instrumentation for OpenTelemetry .NET $(PackageTags);distributed-tracing Instrumentation.ElasticsearchClient- - disable + diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/AnotherArea/Controllers/AnotherAreaController.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/AnotherArea/Controllers/AnotherAreaController.cs index 7754255edf..626c69da6f 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/AnotherArea/Controllers/AnotherAreaController.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/AnotherArea/Controllers/AnotherAreaController.cs @@ -1,8 +1,6 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#nullable disable - using Microsoft.AspNetCore.Mvc; namespace RouteTests.Controllers; diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/MyArea/Controllers/ControllerForMyAreaController.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/MyArea/Controllers/ControllerForMyAreaController.cs index 762f4a95e8..fabece0296 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/MyArea/Controllers/ControllerForMyAreaController.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Areas/MyArea/Controllers/ControllerForMyAreaController.cs @@ -1,8 +1,6 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#nullable disable - using Microsoft.AspNetCore.Mvc; namespace RouteTests.Controllers; diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/AttributeRouteController.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/AttributeRouteController.cs index b1e5783b0a..93e4174166 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/AttributeRouteController.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/AttributeRouteController.cs @@ -1,8 +1,6 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#nullable disable - using Microsoft.AspNetCore.Mvc; namespace RouteTests.Controllers; diff --git a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/ConventionalRouteController.cs b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/ConventionalRouteController.cs index 977ee36a13..ac6bc3be0f 100644 --- a/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/ConventionalRouteController.cs +++ b/test/OpenTelemetry.Instrumentation.AspNetCore.Tests/RouteTests/TestApplication/Controllers/ConventionalRouteController.cs @@ -1,8 +1,6 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#nullable disable - using Microsoft.AspNetCore.Mvc; namespace RouteTests.Controllers; diff --git a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/Customer.cs b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/Customer.cs index 369171f5f4..2ace4b977c 100644 --- a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/Customer.cs +++ b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/Customer.cs @@ -5,7 +5,7 @@ namespace OpenTelemetry.Instrumentation.ElasticsearchClient.Tests; public class Customer { - public string Id { get; set; } + public string? Id { get; set; } - public string Name { get; set; } + public string? Name { get; set; } } diff --git a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/DependencyInjectionConfigTests.cs b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/DependencyInjectionConfigTests.cs index 6a0775b7f1..736945d141 100644 --- a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/DependencyInjectionConfigTests.cs +++ b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/DependencyInjectionConfigTests.cs @@ -16,7 +16,7 @@ public class DependencyInjectionConfigTests [Theory] [InlineData(null)] [InlineData("CustomName")] - public async Task TestTracingOptionsDiConfig(string name) + public async Task TestTracingOptionsDiConfig(string? name) { bool optionsPickedFromDi = false; diff --git a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientTests.cs b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientTests.cs index f9db99cbcb..41dd366fa3 100644 --- a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientTests.cs +++ b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientTests.cs @@ -67,7 +67,8 @@ public async Task CanCaptureGetById() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (200) low level call", debugInfo); @@ -119,7 +120,8 @@ public async Task CanCaptureGetByIdNotFound() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (404) low level call", debugInfo); @@ -170,7 +172,8 @@ public async Task CanCaptureSearchCall() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (200) low level call", debugInfo); @@ -401,7 +404,8 @@ public async Task CanCaptureSearchCallWithDebugMode() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (200) low level call", debugInfo); @@ -451,7 +455,8 @@ public async Task CanCaptureSearchCallWithParseAndFormatRequestOption() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Equal( @"{ @@ -518,7 +523,8 @@ public async Task CanCaptureSearchCallWithoutDebugMode() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.DoesNotContain("123", debugInfo); @@ -569,7 +575,8 @@ public async Task CanCaptureMultipleIndiceSearchCall() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Null(searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (200) low level call", debugInfo); @@ -621,7 +628,8 @@ public async Task CanCaptureElasticsearchClientException() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Equal("customer", searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Unsuccessful (500) low level call", debugInfo); @@ -673,7 +681,8 @@ public async Task CanCaptureCatRequest() Assert.Equal("elasticsearch", searchActivity.GetTagValue(SemanticConventions.AttributeDbSystem)); Assert.Null(searchActivity.GetTagValue(SemanticConventions.AttributeDbName)); - var debugInfo = (string)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + var debugInfo = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeDbStatement); + Assert.NotNull(debugInfo); Assert.NotEmpty(debugInfo); Assert.Contains("Successful (200) low level call", debugInfo); @@ -846,7 +855,7 @@ public async Task ShouldRemoveSensitiveInformation() Assert.Single(exportedItems); var searchActivity = exportedItems[0]; - string dbUrl = (string)searchActivity.GetTagValue(SemanticConventions.AttributeUrlFull); + string? dbUrl = (string?)searchActivity.GetTagValue(SemanticConventions.AttributeUrlFull); Assert.DoesNotContain("sensitive", dbUrl); Assert.Contains("REDACTED:REDACTED", dbUrl); diff --git a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests.csproj b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests.csproj index e51a2e7b55..dee17e80d3 100644 --- a/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests.csproj +++ b/test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests.csproj @@ -4,7 +4,6 @@ $(SupportedNetTargets) $(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion) - disable diff --git a/test/OpenTelemetry.Sampler.AWS.Tests/TestSamplingRuleApplier.cs b/test/OpenTelemetry.Sampler.AWS.Tests/TestSamplingRuleApplier.cs index 725eabb8f9..a28c8faa9d 100644 --- a/test/OpenTelemetry.Sampler.AWS.Tests/TestSamplingRuleApplier.cs +++ b/test/OpenTelemetry.Sampler.AWS.Tests/TestSamplingRuleApplier.cs @@ -30,8 +30,8 @@ public void TestRuleMatchesWithAllAttributes() var activityTags = new Dictionary { { "http.host", "localhost" }, - { "http.method", "GET" }, - { "http.url", @"http://127.0.0.1:5000/helloworld" }, + { "http.request.method", "GET" }, + { "url.full", @"http://127.0.0.1:5000/helloworld" }, { "faas.id", "arn:aws:lambda:us-west-2:123456789012:function:my-function" }, }; @@ -59,8 +59,8 @@ public void TestRuleMatchesWithWildcardAttributes() var activityTags = new Dictionary { { "http.host", "localhost" }, - { "http.method", "GET" }, - { "http.url", @"http://127.0.0.1:5000/helloworld" }, + { "http.request.method", "GET" }, + { "url.full", @"http://127.0.0.1:5000/helloworld" }, }; var applier = new SamplingRuleApplier("clientId", new TestClock(), rule, new Statistics()); @@ -132,7 +132,7 @@ public void TestRuleMatchesWithHttpTarget() var activityTags = new Dictionary { - { "http.target", "/helloworld" }, + { "url.path", "/helloworld" }, }; var applier = new SamplingRuleApplier("clientId", new TestClock(), rule, new Statistics()); @@ -164,7 +164,7 @@ public void TestAttributeMatching() var activityTags = new Dictionary { - { "http.target", "/helloworld" }, + { "url.path", "/helloworld" }, { "dog", "bark" }, { "cat", "meow" }, }; @@ -198,7 +198,7 @@ public void TestAttributeMatchingWithLessActivityTags() var activityTags = new Dictionary { - { "http.target", "/helloworld" }, + { "url.path", "/helloworld" }, { "dog", "bark" }, };