Compare commits
259 Commits
core-1.10.
...
main
Author | SHA1 | Date |
---|---|---|
|
f153e130b4 | |
|
b659171101 | |
|
2a9c406b6d | |
|
bab4b954cd | |
|
cd522d9081 | |
|
8321588b28 | |
|
62162211ad | |
|
7a4643a829 | |
|
84b3ca4e11 | |
|
0ebe718c70 | |
|
a871f0fc68 | |
|
44f46b1656 | |
|
ca892e44a9 | |
|
a067b8f437 | |
|
2e73a2c468 | |
|
4bab51a01a | |
|
81f29e6068 | |
|
583166cc71 | |
|
e2fdf99f52 | |
|
d2f8e54bb9 | |
|
27234c2a14 | |
|
6b58da89e2 | |
|
accfea63fe | |
|
570a6fa687 | |
|
4dc60007ca | |
|
e67ecf8164 | |
|
98a8d38e8a | |
|
e5b9a9a3db | |
|
be60150962 | |
|
7f111ea831 | |
|
a8ef3e1888 | |
|
9480cb3e9a | |
|
b921486b67 | |
|
5ff15e58c1 | |
|
872ab2b80c | |
|
21af34df63 | |
|
2b20ffc1ed | |
|
7ccfda242a | |
|
6f805344dd | |
|
d8dfaa84a3 | |
|
361a1655b9 | |
|
a2679d5a6d | |
|
0ad46df6cf | |
|
393b5e04f3 | |
|
5963d1d710 | |
|
afe1a5bb11 | |
|
4e9e37fa35 | |
|
f8dc06acf2 | |
|
869d9475ef | |
|
12b994ceda | |
|
5a89e2cfe8 | |
|
cd796552ef | |
|
42fe0738cb | |
|
796be6b4a9 | |
|
e58ee78c2d | |
|
309ed2e7a8 | |
|
04a48b6033 | |
|
4eb55be9a9 | |
|
19afd63555 | |
|
b76121e858 | |
|
b83bc6800e | |
|
7ed91a108f | |
|
5acf77cf04 | |
|
1479b236f7 | |
|
05f74a4c36 | |
|
a2bb510f79 | |
|
4f51654047 | |
|
bd434cc9ae | |
|
e76e0f9f44 | |
|
3401b31085 | |
|
5f9b011c0f | |
|
e9cfc33fad | |
|
154a6dc10b | |
|
21993b01a3 | |
|
d324abb29d | |
|
7cad682002 | |
|
52edab3c8c | |
|
eb0ddd1273 | |
|
dde8f4024b | |
|
e21e9ccd24 | |
|
a10f955cd9 | |
|
6c826c7176 | |
|
260e25271d | |
|
f067d0db96 | |
|
ed26d99bf5 | |
|
78a71ebbf7 | |
|
3f86f47ac3 | |
|
4e84aa72dd | |
|
b552c7f9bf | |
|
74352b8769 | |
|
1f9fa9ffe7 | |
|
77e73ced3c | |
|
15446598f6 | |
|
ec554f9eb0 | |
|
9ecf6b77bc | |
|
fb4bb17b34 | |
|
b884697d47 | |
|
d5f6732118 | |
|
1065e43060 | |
|
0ad6a95bf2 | |
|
3c9beb896b | |
|
7abe983ac0 | |
|
844e148f68 | |
|
3f9b636f06 | |
|
6209ed8f80 | |
|
60a3839591 | |
|
805dd6b4ab | |
|
6828791c61 | |
|
c638ef67cf | |
|
6420be005b | |
|
ee720ba3a3 | |
|
8c1e63894f | |
|
9c9d8585f3 | |
|
c4268fe92b | |
|
e371d7f02d | |
|
24a13ab91c | |
|
2ec8931fc8 | |
|
a67acd87d5 | |
|
ceebd456f1 | |
|
13ed63a88c | |
|
0252f6ca0d | |
|
4792d020f8 | |
|
d5f44d0ae5 | |
|
fd1b5afd08 | |
|
177596891a | |
|
1edcddbe00 | |
|
31fb3bdf35 | |
|
ea70cd550d | |
|
ab32e39c14 | |
|
fbbe939dd4 | |
|
7c0eab2f42 | |
|
98b3986620 | |
|
bb8abee277 | |
|
ff009146a9 | |
|
aa73ce3aaf | |
|
f183a6a11e | |
|
72f7348b57 | |
|
6e6ce171e8 | |
|
04dd5d149c | |
|
06ef55786a | |
|
20988528fd | |
|
180c9e84db | |
|
528d642b44 | |
|
72a5f7c36e | |
|
868ae707fc | |
|
3e8c537192 | |
|
27116b2210 | |
|
a8ede4bdc5 | |
|
f63f8d93f8 | |
|
242cebabfc | |
|
c1472c76fd | |
|
6c69fb2b8c | |
|
d01e7f9699 | |
|
89e5999e69 | |
|
99b686e1ad | |
|
647f1b17a1 | |
|
402ed87689 | |
|
3be15201d7 | |
|
807aa26d20 | |
|
aa5b0423ff | |
|
643e80ef53 | |
|
a8f1076e4d | |
|
5635e6b8d6 | |
|
2862c884e0 | |
|
13a06da855 | |
|
cc2ffdad5b | |
|
c977f73246 | |
|
8943733bcd | |
|
796f49bcfd | |
|
9b83e7bf09 | |
|
4af4abd7c9 | |
|
0c53d9f7dd | |
|
7f2eb92952 | |
|
2ea6e04dab | |
|
1b555c1201 | |
|
577337c992 | |
|
752172890c | |
|
71e6cb49aa | |
|
ec9f76127e | |
|
7b076c64b0 | |
|
e5f65ca696 | |
|
0aba0cdc26 | |
|
c643b7fb22 | |
|
62af9ad84f | |
|
3c62f6b1b1 | |
|
8f17a0ea54 | |
|
41e1a59eb9 | |
|
720d610fa8 | |
|
89ba8073d8 | |
|
71abd4169b | |
|
0c26ce2b3b | |
|
c99f9a1d6d | |
|
36b777b16f | |
|
cccf1ec3b7 | |
|
0cfbf86a8c | |
|
89ea5c6698 | |
|
c44984ef93 | |
|
e5a7095daa | |
|
cd8cb41d9f | |
|
b508b84676 | |
|
275a4463cf | |
|
8fa00cb9d6 | |
|
2828321d1b | |
|
292953799b | |
|
db828ceb44 | |
|
ef090adab3 | |
|
feba0d40fa | |
|
e3855e80b8 | |
|
7037824da6 | |
|
d9864b1e1d | |
|
54f7d9eb87 | |
|
6e8e190039 | |
|
48e5a0804b | |
|
fdca498b44 | |
|
c5acd9f1d3 | |
|
dcdaaae6e3 | |
|
f7df3e1714 | |
|
75d947c58f | |
|
837e852232 | |
|
3d1f74db5a | |
|
17bbd834e5 | |
|
90dd82c382 | |
|
cd31c57af5 | |
|
6100452988 | |
|
7ae7b131e8 | |
|
408a52d62f | |
|
7d7d37ae42 | |
|
29068585a1 | |
|
c3bb89ae50 | |
|
e0a10f7890 | |
|
c94c422e31 | |
|
8e6d814f0f | |
|
ad4e80e282 | |
|
fc9de8b9bc | |
|
f69d9c53e5 | |
|
a6582704cd | |
|
80287c061e | |
|
1f39623af5 | |
|
75a683eab7 | |
|
be8209987b | |
|
145e7ade6f | |
|
305597d9d5 | |
|
0c775e58fa | |
|
44bc90a25b | |
|
b9be07a27d | |
|
84e6afbeba | |
|
7eeddf5f22 | |
|
88d2ad60bb | |
|
f9a0b4c657 | |
|
e3665c95c2 | |
|
4bc398f9d1 | |
|
68c79a3bfd | |
|
913bccfdfc | |
|
2ae01a73fe | |
|
1e7397e779 | |
|
b201d709c1 | |
|
74fc70e8eb | |
|
a5fa611774 | |
|
60a683986a |
|
@ -0,0 +1,4 @@
|
|||
# see https://github.com/cncf/clomonitor/blob/main/docs/checks.md#exemptions
|
||||
exemptions:
|
||||
- check: artifacthub_badge
|
||||
reason: "Artifact Hub doesn't support .NET packages"
|
|
@ -10,6 +10,9 @@ indent_size = 2
|
|||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
|
||||
[*.{cs,cshtml,htm,html,md,py,sln,xml}]
|
||||
indent_size = 4
|
||||
|
||||
|
@ -156,7 +159,14 @@ dotnet_diagnostic.IDE0005.severity = warning
|
|||
# RS0041: Public members should not use oblivious types
|
||||
dotnet_diagnostic.RS0041.severity = suggestion
|
||||
|
||||
[obj/**.cs]
|
||||
[*Tests.cs]
|
||||
# CA1515: Disable making types internal for Tests classes. It is required by xunit
|
||||
dotnet_diagnostic.CA1515.severity = none
|
||||
|
||||
# CA2007: Disable Consider calling ConfigureAwait on the awaited task. It is not working with xunit
|
||||
dotnet_diagnostic.CA2007.severity = none
|
||||
|
||||
[**/obj/**.cs]
|
||||
generated_code = true
|
||||
|
||||
[*.csproj]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
*.sh eol=lf
|
|
@ -62,7 +62,7 @@ body:
|
|||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: Provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). We will close the issue if the repro project you share with us is complex or we cannot reproduce the behavior you are reporting. We cannot investigate custom projects, so don't point us to such, please.
|
||||
description: Provide a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). We will close the issue if the repro project you share with us is complex or we cannot reproduce the behavior you are reporting. We cannot investigate custom projects, so don't point us to such, please.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
@ -84,3 +84,11 @@ body:
|
|||
attributes:
|
||||
label: Additional Context
|
||||
description: Any additional information you think may be relevant to this issue.
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Tip
|
||||
description: This element is static, used to render a helpful sub-heading for end-users and community members to help prioritize issues. Please leave as is.
|
||||
options:
|
||||
- "<sub>[React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with :+1: to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>"
|
||||
default: 0
|
||||
|
|
|
@ -53,3 +53,11 @@ body:
|
|||
attributes:
|
||||
label: Additional context
|
||||
description: Any additional information you think may be relevant to this feature request.
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Tip
|
||||
description: This element is static, used to render a helpful sub-heading for end-users and community members to help prioritize issues. Please leave as is.
|
||||
options:
|
||||
- "<sub>[React](https://github.blog/news-insights/product-news/add-reactions-to-pull-requests-issues-and-comments/) with :+1: to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it. Learn more [here](https://opentelemetry.io/community/end-user/issue-participation/).</sub>"
|
||||
default: 0
|
||||
|
|
|
@ -6,3 +6,70 @@ updates:
|
|||
interval: "daily"
|
||||
labels:
|
||||
- "infra"
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/examples/MicroserviceExample/WebApi"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- "version-update:semver-minor"
|
||||
- package-ecosystem: "docker"
|
||||
directory: "examples/MicroserviceExample/WorkerService"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- "version-update:semver-minor"
|
||||
- package-ecosystem: "docker"
|
||||
directory: "test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- "version-update:semver-minor"
|
||||
- package-ecosystem: "docker"
|
||||
directory: "test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- "version-update:semver-minor"
|
||||
- package-ecosystem: "dotnet-sdk"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types:
|
||||
- "version-update:semver-major"
|
||||
- "version-update:semver-minor"
|
||||
- package-ecosystem: "pip"
|
||||
directory: "test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
labels:
|
||||
- "infra"
|
||||
|
|
|
@ -20,7 +20,7 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
os-list:
|
||||
default: '[ "windows-latest", "ubuntu-latest", "otel-linux-arm64" ]'
|
||||
default: '[ "windows-latest", "ubuntu-22.04", "ubuntu-22.04-arm" ]'
|
||||
required: false
|
||||
type: string
|
||||
tfm-list:
|
||||
|
@ -28,6 +28,9 @@ on:
|
|||
required: false
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
|
||||
|
@ -37,24 +40,30 @@ jobs:
|
|||
os: ${{ fromJSON(inputs.os-list) }}
|
||||
version: ${{ fromJSON(inputs.tfm-list) }}
|
||||
exclude:
|
||||
- os: ubuntu-latest
|
||||
- os: ubuntu-22.04
|
||||
version: net462
|
||||
- os: otel-linux-arm64
|
||||
- os: ubuntu-22.04-arm
|
||||
version: net462
|
||||
- os: otel-linux-arm64
|
||||
- os: ubuntu-22.04-arm
|
||||
version: net8.0
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
|
||||
# the version tag which is typically NOT on the first commit so we
|
||||
# retrieve them all.
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
- name: Setup previous .NET runtimes
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
with:
|
||||
dotnet-version: |
|
||||
8.0.x
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: dotnet restore ${{ inputs.project-name }}
|
||||
run: dotnet restore ${{ inputs.project-name }} ${{ inputs.project-build-commands }}
|
||||
|
@ -63,7 +72,18 @@ jobs:
|
|||
run: dotnet build ${{ inputs.project-name }} --configuration Release --no-restore ${{ inputs.project-build-commands }}
|
||||
|
||||
- name: dotnet test ${{ inputs.project-name }}
|
||||
run: dotnet test ${{ inputs.project-name }} --collect:"Code Coverage" --results-directory:TestResults --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true
|
||||
run: >
|
||||
dotnet test ${{ inputs.project-name }}
|
||||
--collect:"Code Coverage"
|
||||
--results-directory:TestResults
|
||||
--framework ${{ matrix.version }}
|
||||
--configuration Release
|
||||
--no-restore
|
||||
--no-build
|
||||
--logger:"console;verbosity=detailed"
|
||||
--logger:"GitHubActions;report-warnings=false"
|
||||
--logger:"junit;LogFilePath=TestResults/junit.xml"
|
||||
-- RunConfiguration.DisableAppDomain=true
|
||||
|
||||
- name: Install coverage tool
|
||||
run: dotnet tool install -g dotnet-coverage
|
||||
|
@ -72,15 +92,24 @@ jobs:
|
|||
run: dotnet-coverage merge -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/**/*.coverage
|
||||
|
||||
- name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
|
||||
continue-on-error: true # Note: Don't fail for upload failures
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
TFM: ${{ matrix.version }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
with:
|
||||
file: TestResults/Cobertura.xml
|
||||
files: TestResults/Cobertura.xml
|
||||
env_vars: OS,TFM
|
||||
flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
|
||||
name: Code Coverage for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}]
|
||||
codecov_yml_path: .github/codecov.yml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Upload test results ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
|
||||
if: ${{ !cancelled() && hashFiles('./**/TestResults/junit.xml') != '' }}
|
||||
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
|
||||
with:
|
||||
env_vars: OS,TFM
|
||||
flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
|
||||
name: Test results for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}]
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
|
@ -7,18 +7,19 @@ on:
|
|||
branches: [ 'main*' ]
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
add-labels-on-issues:
|
||||
permissions:
|
||||
issues: write
|
||||
if: github.event_name == 'issues' && !github.event.issue.pull_request
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Add labels for package found in bug issue descriptions
|
||||
shell: pwsh
|
||||
|
@ -33,13 +34,15 @@ jobs:
|
|||
ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
|
||||
add-labels-on-pull-requests:
|
||||
permissions:
|
||||
pull-requests: write
|
||||
if: github.event_name == 'pull_request_target'
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
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
|
||||
|
||||
|
|
|
@ -15,10 +15,13 @@ on:
|
|||
OPENTELEMETRYBOT_GITHUB_TOKEN:
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
resolve-automation:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
outputs:
|
||||
enabled: ${{ steps.evaluate.outputs.enabled }}
|
||||
|
|
|
@ -9,6 +9,9 @@ on:
|
|||
pull_request:
|
||||
branches: [ 'main*' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
lint-misspell-sanitycheck:
|
||||
uses: ./.github/workflows/sanitycheck.yml
|
||||
|
@ -18,13 +21,13 @@ jobs:
|
|||
outputs:
|
||||
changes: ${{ steps.changes.outputs.changes }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: AurorNZ/paths-filter@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629 # v4.0.0
|
||||
id: changes
|
||||
with:
|
||||
filters: |
|
||||
md: ['**.md']
|
||||
build: ['build/**', '.github/**/*.yml', '**/*.targets', '**/*.props']
|
||||
build: ['build/**', '.github/**/*.yml', '**/*.targets', '**/*.props', 'global.json']
|
||||
shared: ['src/Shared/**']
|
||||
code: ['**.cs', '**.csproj', '.editorconfig']
|
||||
solution: ['OpenTelemetry.sln']
|
||||
|
@ -107,13 +110,13 @@ jobs:
|
|||
|| contains(needs.detect-changes.outputs.changes, 'otlp')
|
||||
|| contains(needs.detect-changes.outputs.changes, 'build')
|
||||
|| contains(needs.detect-changes.outputs.changes, 'shared')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: [ net8.0, net9.0 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Run OTLP Exporter docker compose
|
||||
run: docker compose --file=test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
|
||||
|
||||
|
@ -125,13 +128,13 @@ jobs:
|
|||
|| contains(needs.detect-changes.outputs.changes, 'instrumentation')
|
||||
|| contains(needs.detect-changes.outputs.changes, 'build')
|
||||
|| contains(needs.detect-changes.outputs.changes, 'shared')
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
version: [ net8.0, net9.0 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Run W3C Trace Context docker compose
|
||||
run: docker compose --file=test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/docker-compose.yml --file=build/docker-compose.${{ matrix.version }}.yml --project-directory=. up --exit-code-from=tests --build
|
||||
|
||||
|
@ -187,7 +190,7 @@ jobs:
|
|||
concurrency-tests
|
||||
]
|
||||
if: always() && !cancelled()
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- run: |
|
||||
if ( ${{ contains(needs.*.result, 'failure') }} == true ); then echo 'build failed'; exit 1; else echo 'build complete'; fi
|
||||
|
|
|
@ -1,46 +1,71 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
pull_request:
|
||||
branches: [ 'main' ]
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # once in a day at 00:00
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
permissions:
|
||||
actions: read # for github/codeql-action/init to get workflow details
|
||||
contents: read # for actions/checkout to fetch code
|
||||
security-events: write # for github/codeql-action/analyze to upload SARIF results
|
||||
runs-on: windows-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['csharp']
|
||||
language: ['actions', 'csharp']
|
||||
|
||||
steps:
|
||||
- name: configure Pagefile
|
||||
uses: al-cheb/configure-pagefile-action@v1.4
|
||||
- name: Configure Pagefile
|
||||
if: matrix.language == 'csharp'
|
||||
uses: al-cheb/configure-pagefile-action@a3b6ebd6b634da88790d9c58d4b37a7f4a7b8708 # v1.4
|
||||
with:
|
||||
minimum-size: 8GB
|
||||
maximum-size: 32GB
|
||||
disk-root: "D:"
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
filter: 'tree:0'
|
||||
persist-credentials: false
|
||||
show-progress: false
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||
with:
|
||||
build-mode: none
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
- name: dotnet pack
|
||||
run: dotnet pack ./build/OpenTelemetry.proj --configuration Release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||
with:
|
||||
category: '/language:${{ matrix.language }}'
|
||||
|
||||
codeql:
|
||||
if: ${{ !cancelled() }}
|
||||
needs: [ analyze ]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Report status
|
||||
shell: bash
|
||||
env:
|
||||
SCAN_SUCCESS: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
||||
run: |
|
||||
if [ "${SCAN_SUCCESS}" == "true" ]
|
||||
then
|
||||
echo 'CodeQL analysis successful'
|
||||
else
|
||||
echo 'CodeQL analysis failed'
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -5,22 +5,25 @@ name: Concurrency Tests
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-concurrency-tests:
|
||||
|
||||
strategy:
|
||||
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
|
||||
matrix:
|
||||
os: [ windows-latest, ubuntu-latest ]
|
||||
os: [ windows-latest, ubuntu-22.04 ]
|
||||
version: [ net8.0 ]
|
||||
project: [ OpenTelemetry.Tests, OpenTelemetry.Api.Tests ]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: Run Coyote Tests
|
||||
shell: pwsh
|
||||
|
@ -28,7 +31,7 @@ jobs:
|
|||
|
||||
- name: Publish Artifacts
|
||||
if: always() && !cancelled()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ${{ matrix.os }}-${{ matrix.project }}-${{ matrix.version }}-coyoteoutput
|
||||
path: '**/*_CoyoteOutput.*'
|
||||
|
|
|
@ -5,16 +5,19 @@ name: Build docfx
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-docfx-build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: install docfx
|
||||
run: dotnet tool install -g docfx
|
||||
|
|
|
@ -5,16 +5,19 @@ name: Lint - dotnet format
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-dotnet-format-stable:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: dotnet restore
|
||||
run: dotnet restore OpenTelemetry.sln
|
||||
|
@ -29,10 +32,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: dotnet restore
|
||||
run: dotnet restore OpenTelemetry.sln
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
name: FOSSA scanning
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fossa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
|
||||
with:
|
||||
api-key: ${{secrets.FOSSA_API_KEY}}
|
||||
team: OpenTelemetry
|
|
@ -5,16 +5,19 @@ name: Lint - Markdown
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-markdownlint:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: run markdownlint
|
||||
uses: DavidAnson/markdownlint-cli2-action@v16.0.0
|
||||
uses: DavidAnson/markdownlint-cli2-action@992badcdf24e3b8eb7e87ff9287fe931bcb00c6e # v20.0.0
|
||||
with:
|
||||
globs: |
|
||||
**/*.md
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
name: OSSF Scorecard
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: "24 5 * * 0" # once a week
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed for Code scanning upload
|
||||
security-events: write
|
||||
# Needed for GitHub OIDC token if publish_results is true
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable
|
||||
# uploads of run results in SARIF format to the repository Actions tab.
|
||||
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
|
||||
with:
|
||||
sarif_file: results.sarif
|
|
@ -5,12 +5,15 @@ name: Package Validation
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-package-validation-stable:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
|
||||
# the version tag which is typically NOT on the first commit so we
|
||||
|
@ -18,16 +21,23 @@ jobs:
|
|||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: dotnet pack
|
||||
run: dotnet pack ./build/OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=false /p:RunningDotNetPack=true
|
||||
|
||||
- name: Publish stable NuGet packages to Artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: packages-stable
|
||||
path: ./artifacts/package/release
|
||||
if-no-files-found: error
|
||||
|
||||
run-package-validation-experimental:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
|
||||
# the version tag which is typically NOT on the first commit so we
|
||||
|
@ -35,7 +45,14 @@ jobs:
|
|||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: dotnet pack
|
||||
run: dotnet pack ./build/OpenTelemetry.proj --configuration Release /p:EnablePackageValidation=true /p:ExposeExperimentalFeatures=true /p:RunningDotNetPack=true
|
||||
|
||||
- name: Publish experimental NuGet packages to Artifacts
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: packages-experimental
|
||||
path: ./artifacts/package/release
|
||||
if-no-files-found: error
|
||||
|
|
|
@ -16,13 +16,16 @@ on:
|
|||
types:
|
||||
- created
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
automation:
|
||||
uses: ./.github/workflows/automation.yml
|
||||
secrets: inherit
|
||||
|
||||
push-packages-and-publish-release:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
|
@ -41,7 +44,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
|
@ -62,7 +65,7 @@ jobs:
|
|||
-pushToNuget '${{ secrets.NUGET_TOKEN != '' }}'
|
||||
|
||||
post-release-published:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs:
|
||||
- automation
|
||||
|
@ -75,7 +78,7 @@ jobs:
|
|||
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit. We need all the tags
|
||||
# for this work.
|
||||
|
@ -84,7 +87,7 @@ jobs:
|
|||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: Create GitHub Pull Request to update stable build version in props
|
||||
if: |
|
||||
|
|
|
@ -23,13 +23,16 @@ on:
|
|||
types:
|
||||
- created
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
automation:
|
||||
uses: ./.github/workflows/automation.yml
|
||||
secrets: inherit
|
||||
|
||||
prepare-release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
|
@ -40,7 +43,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
|
@ -59,7 +62,7 @@ jobs:
|
|||
-gitUserEmail '${{ needs.automation.outputs.email }}'
|
||||
|
||||
lock-pr-and-post-notice-to-create-release-tag:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
|
@ -76,7 +79,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
|
@ -91,7 +94,7 @@ jobs:
|
|||
-botUserName '${{ needs.automation.outputs.username }}'
|
||||
|
||||
create-release-tag-pr-post-notice:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
|
@ -110,7 +113,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
|
||||
fetch-depth: 0
|
||||
|
@ -130,7 +133,7 @@ jobs:
|
|||
-gitUserEmail '${{ needs.automation.outputs.email }}'
|
||||
|
||||
update-changelog-release-dates-on-prepare-pr-post-notice:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
|
@ -149,14 +152,13 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
- name: Update release date
|
||||
id: create-tag
|
||||
shell: pwsh
|
||||
run: |
|
||||
Import-Module .\build\scripts\prepare-release.psm1
|
||||
|
@ -169,3 +171,44 @@ jobs:
|
|||
-gitUserName '${{ needs.automation.outputs.username }}' `
|
||||
-gitUserEmail '${{ needs.automation.outputs.email }}'
|
||||
|
||||
update-releasenotes-on-prepare-pr-post-notice:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs: automation
|
||||
|
||||
if: |
|
||||
github.event_name == 'issue_comment'
|
||||
&& github.event.issue.pull_request
|
||||
&& github.event.issue.state == 'open'
|
||||
&& github.event.comment.user.login != needs.automation.outputs.username
|
||||
&& contains(github.event.comment.body, '/UpdateReleaseNotes')
|
||||
&& startsWith(github.event.issue.title, '[release] Prepare release ')
|
||||
&& github.event.issue.pull_request.merged_at == null
|
||||
&& needs.automation.outputs.enabled
|
||||
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit which fails the git tag operation below
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
- name: Update release notes
|
||||
env:
|
||||
COMMENT_BODY: ${{ github.event.comment.body }}
|
||||
shell: pwsh
|
||||
run: |
|
||||
Import-Module .\build\scripts\prepare-release.psm1
|
||||
|
||||
UpdateReleaseNotesAndPostNoticeOnPullRequest `
|
||||
-gitRepository '${{ github.repository }}' `
|
||||
-pullRequestNumber '${{ github.event.issue.number }}' `
|
||||
-botUserName '${{ needs.automation.outputs.username }}' `
|
||||
-commentUserName '${{ github.event.comment.user.login }}' `
|
||||
-commentBody $Env:COMMENT_BODY `
|
||||
-gitUserName '${{ needs.automation.outputs.username }}' `
|
||||
-gitUserEmail '${{ needs.automation.outputs.email }}'
|
||||
|
|
|
@ -16,6 +16,9 @@ on:
|
|||
schedule:
|
||||
- cron: '0 0 * * *' # once in a day at 00:00
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
automation:
|
||||
uses: ./.github/workflows/automation.yml
|
||||
|
@ -35,7 +38,7 @@ jobs:
|
|||
artifact-id: ${{ steps.upload-artifacts.outputs.artifact-id }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
# Note: By default GitHub only fetches 1 commit. MinVer needs to find
|
||||
# the version tag which is typically NOT on the first commit so we
|
||||
|
@ -43,12 +46,12 @@ jobs:
|
|||
fetch-depth: 0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@v3
|
||||
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
|
||||
with:
|
||||
cosign-release: v2.4.0
|
||||
cosign-release: v2.5.3
|
||||
|
||||
- name: dotnet restore
|
||||
run: dotnet restore ./build/OpenTelemetry.proj -p:RunningDotNetPack=true
|
||||
|
@ -64,7 +67,7 @@ jobs:
|
|||
foreach ($projectFile in $projectFiles) {
|
||||
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($projectFile)
|
||||
|
||||
Get-ChildItem -Path src/$projectName/bin/Release/*/$projectName.dll -File | ForEach-Object {
|
||||
Get-ChildItem -Path artifacts/bin/$projectName/release_*/$projectName.dll -File | ForEach-Object {
|
||||
$fileFullPath = $_.FullName
|
||||
Write-Host "Signing $fileFullPath"
|
||||
|
||||
|
@ -77,10 +80,11 @@ jobs:
|
|||
|
||||
- name: Publish Artifacts
|
||||
id: upload-artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ${{ github.ref_name }}-packages
|
||||
path: 'src/**/*.*nupkg'
|
||||
path: ./artifacts/package/release
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Publish MyGet
|
||||
env:
|
||||
|
@ -88,10 +92,10 @@ jobs:
|
|||
if: env.MYGET_TOKEN_EXISTS == 'true' # Skip MyGet publish if run on a fork without the secret
|
||||
run: |
|
||||
nuget setApiKey ${{ secrets.MYGET_TOKEN }} -Source https://www.myget.org/F/opentelemetry/api/v2/package
|
||||
nuget push src/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
|
||||
nuget push ./artifacts/package/release/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package
|
||||
|
||||
post-build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
needs:
|
||||
- automation
|
||||
|
@ -104,7 +108,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
|
||||
|
||||
|
|
|
@ -5,13 +5,16 @@ name: Lint - Spelling & Encoding
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-misspell:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: install misspell
|
||||
run: |
|
||||
|
@ -22,11 +25,11 @@ jobs:
|
|||
run: ./bin/misspell -error .
|
||||
|
||||
run-sanitycheck:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: check out code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: detect non-ASCII encoding and trailing space
|
||||
run: python3 ./build/scripts/sanitycheck.py
|
||||
|
|
|
@ -6,11 +6,17 @@ on:
|
|||
schedule:
|
||||
- cron: "12 3 * * *" # arbitrary time not to DDOS GitHub
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write # for actions/stale to close stale issues
|
||||
pull-requests: write # for actions/stale to close stale PRs
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
|
||||
with:
|
||||
stale-issue-message: 'This issue was marked stale due to lack of activity and will be closed in 7 days. Commenting will instruct the bot to automatically remove the label. This bot runs once per day.'
|
||||
close-issue-message: 'Closed as inactive. Feel free to reopen if this issue is still a concern.'
|
||||
|
@ -22,4 +28,5 @@ jobs:
|
|||
days-before-pr-close: 7
|
||||
days-before-issue-close: 7
|
||||
exempt-all-issue-milestones: true
|
||||
exempt-issue-labels: needs-triage
|
||||
exempt-issue-labels: 'keep-open,needs-triage'
|
||||
exempt-pr-labels: 'keep-open'
|
||||
|
|
|
@ -5,21 +5,24 @@ name: Publish & Verify AOT Compatibility
|
|||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-verify-aot-compat:
|
||||
|
||||
strategy:
|
||||
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
|
||||
matrix:
|
||||
os: [ ubuntu-latest, windows-latest ]
|
||||
os: [ ubuntu-22.04, windows-latest ]
|
||||
version: [ net8.0, net9.0 ]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
|
||||
|
||||
- name: publish AOT testApp, assert static analysis warning count, and run the app
|
||||
shell: pwsh
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Aa]rtifacts/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
@ -351,3 +352,6 @@ tempo-data/
|
|||
|
||||
# Coyote Rewrite Files
|
||||
rewrite.coyote.json
|
||||
|
||||
# Test results
|
||||
TestResults/
|
||||
|
|
|
@ -10,3 +10,6 @@ MD013:
|
|||
MD033:
|
||||
# Allowed elements
|
||||
allowed_elements: [ 'details', 'summary' ]
|
||||
|
||||
# MD059/link-text-should-be-descriptive : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md
|
||||
MD059: false
|
||||
|
|
|
@ -14,10 +14,33 @@ Anyone may contribute but there are benefits of being a member of our community.
|
|||
See the [community membership
|
||||
document](https://github.com/open-telemetry/community/blob/main/community-membership.md)
|
||||
on how to become a
|
||||
[**Member**](https://github.com/open-telemetry/community/blob/main/community-membership.md#member),
|
||||
[**Approver**](https://github.com/open-telemetry/community/blob/main/community-membership.md#approver)
|
||||
[**Member**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#member),
|
||||
[**Triager**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager),
|
||||
[**Approver**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver),
|
||||
and
|
||||
[**Maintainer**](https://github.com/open-telemetry/community/blob/main/community-membership.md#maintainer).
|
||||
[**Maintainer**](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
|
||||
|
||||
## Give feedback
|
||||
|
||||
We are always looking for your feedback.
|
||||
|
||||
You can do this by [submitting a GitHub issue](https://github.com/open-telemetry/opentelemetry-dotnet/issues/new).
|
||||
|
||||
You may also prefer writing on [#otel-dotnet Slack channel](https://cloud-native.slack.com/archives/C01N3BC2W7Q).
|
||||
|
||||
### Report a bug
|
||||
|
||||
Reporting bugs is an important contribution. Please make sure to include:
|
||||
|
||||
* Expected and actual behavior;
|
||||
* OpenTelemetry, OS, and .NET versions you are using;
|
||||
* Steps to reproduce;
|
||||
* [Minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).
|
||||
|
||||
### Request a feature
|
||||
|
||||
If you would like to work on something that is not listed as an issue
|
||||
(e.g. a new feature or enhancement) please create an issue and describe your proposal.
|
||||
|
||||
## Find a buddy and get started quickly
|
||||
|
||||
|
@ -300,9 +323,6 @@ types](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-type
|
|||
* Pass [static
|
||||
analysis](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/overview).
|
||||
|
||||
New projects MUST enable static analysis by specifying
|
||||
`<AnalysisLevel>latest-all</AnalysisLevel>` in the project file (`.csproj`).
|
||||
|
||||
> [!NOTE]
|
||||
> There are other project-level features enabled automatically via
|
||||
[Common.props](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/build/Common.props)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<ArtifactsPath>$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'artifacts'))</ArtifactsPath>
|
||||
<UseArtifactsOutput>true</UseArtifactsOutput>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<OTelLatestStableVer>1.9.0</OTelLatestStableVer>
|
||||
<OTelLatestStableVer>1.12.0</OTelLatestStableVer>
|
||||
|
||||
<!--
|
||||
This is typically the latest annual release of .NET. Use this wherever
|
||||
|
@ -31,13 +31,10 @@
|
|||
3) Since version 3.1.0, the .NET runtime team is holding a high bar for backward compatibility on
|
||||
these packages even during major version bumps, so compatibility is not a concern here.
|
||||
-->
|
||||
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Options" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
|
||||
<!--
|
||||
OTel packages always point to latest stable release.
|
||||
|
@ -60,14 +57,6 @@
|
|||
even during major version bumps, so compatibility is not a concern here.
|
||||
-->
|
||||
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
|
||||
<!--
|
||||
We use conservative versions of these packages where an upgrade might
|
||||
introduce breaking changes.
|
||||
-->
|
||||
<PackageVersion Include="Google.Protobuf" Version="[3.22.5,4.0)" />
|
||||
<PackageVersion Include="Grpc" Version="[2.44.0,3.0)" />
|
||||
<PackageVersion Include="Grpc.Net.Client" Version="[2.52.0,3.0)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -94,11 +83,16 @@
|
|||
These packages are referenced as "PrivateAssets" or used in tests/examples.
|
||||
-->
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="BenchmarkDotNet" Version="[0.13.12,0.14)" />
|
||||
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2" />
|
||||
<PackageVersion Include="CommandLineParser" Version="[2.9.1,3.0)" />
|
||||
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
|
||||
<PackageVersion Include="Grpc.AspNetCore" Version="[2.59.0,3.0)" />
|
||||
<PackageVersion Include="Grpc.AspNetCore.Server" Version="[2.59.0, 3.0)" />
|
||||
<PackageVersion Include="Grpc.Tools" Version="[2.59.0,3.0)" />
|
||||
<PackageVersion Include="Google.Protobuf" Version="[3.22.5,4.0)" />
|
||||
<PackageVersion Include="Grpc" Version="[2.44.0,3.0)" />
|
||||
<PackageVersion Include="Grpc.Net.Client" Version="[2.52.0,3.0)" />
|
||||
<PackageVersion Include="JunitXml.TestLogger" Version="6.1.0" />
|
||||
<PackageVersion Include="Microsoft.CSharp" Version="[4.7.0]" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="[3.11.0-beta1.23525.2]" />
|
||||
<PackageVersion Include="Microsoft.Coyote" Version="1.7.11" />
|
||||
|
@ -108,8 +102,7 @@
|
|||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(LatestRuntimeOutOfBandVer)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Telemetry.Abstractions" Version="[9.0.0,)" />
|
||||
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="[1.0.3,2.0)" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.11.0,18.0.0)" />
|
||||
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="[8.0.0,9.0)" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="[17.13.0,18.0.0)" />
|
||||
<PackageVersion Include="MinVer" Version="[5.0.0,6.0)" />
|
||||
<PackageVersion Include="NuGet.Versioning" Version="6.11.0" />
|
||||
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="[1.9.0,2.0)" />
|
||||
|
@ -120,7 +113,7 @@
|
|||
<PackageVersion Include="StyleCop.Analyzers" Version="[1.2.0-beta.556,2.0)" />
|
||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="[6.7.3,)" />
|
||||
<PackageVersion Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
|
||||
<PackageVersion Include="xunit" Version="[2.9.0,3.0)" />
|
||||
<PackageVersion Include="xunit" Version="[2.9.3,3.0)" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="[2.8.2,3.0)" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -3,19 +3,14 @@
|
|||
<packageSources>
|
||||
<clear />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
|
||||
<!-- Define mappings by adding package patterns beneath the target source. -->
|
||||
<!-- *.Tools packages will be restored from ".Net Core Tools", everything else from nuget.org. -->
|
||||
<packageSourceMapping>
|
||||
<!-- key value for <packageSource> should match key values from <packageSources> element -->
|
||||
<packageSource key="NuGet">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
<packageSource key="dotnet8">
|
||||
<package pattern="Microsoft.CodeAnalysis.PublicApiAnalyzers" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
|
||||
<disabledPackageSources />
|
||||
|
|
|
@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
.dockerignore = .dockerignore
|
||||
.editorconfig = .editorconfig
|
||||
.gitignore = .gitignore
|
||||
.github\workflows\ci-concurrency.yml = .github\workflows\ci-concurrency.yml
|
||||
CONTRIBUTING.md = CONTRIBUTING.md
|
||||
global.json = global.json
|
||||
LICENSE.TXT = LICENSE.TXT
|
||||
|
@ -74,6 +73,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{F1D0
|
|||
ProjectSection(SolutionItems) = preProject
|
||||
.github\codecov.yml = .github\codecov.yml
|
||||
.github\CODEOWNERS = .github\CODEOWNERS
|
||||
.github\dependabot.yml = .github\dependabot.yml
|
||||
.github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -254,7 +254,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299
|
|||
src\Shared\ExceptionExtensions.cs = src\Shared\ExceptionExtensions.cs
|
||||
src\Shared\Guard.cs = src\Shared\Guard.cs
|
||||
src\Shared\MathHelper.cs = src\Shared\MathHelper.cs
|
||||
src\Shared\PeerServiceResolver.cs = src\Shared\PeerServiceResolver.cs
|
||||
src\Shared\PeriodicExportingMetricReaderHelper.cs = src\Shared\PeriodicExportingMetricReaderHelper.cs
|
||||
src\Shared\PooledList.cs = src\Shared\PooledList.cs
|
||||
src\Shared\ResourceSemanticConventions.cs = src\Shared\ResourceSemanticConventions.cs
|
||||
|
@ -345,6 +344,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{4498
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "exemplars", "docs\metrics\exemplars\exemplars.csproj", "{79C12C80-B27B-41FB-AE79-A3BB74CFA782}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Proto", "Proto", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Shared\Proto\README.md = src\Shared\Proto\README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -661,6 +665,7 @@ Global
|
|||
{993E65E5-E71B-40FD-871C-60A9EBD59724} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
|
||||
{44982E0D-C8C6-42DC-9F8F-714981F27CE6} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
|
||||
{79C12C80-B27B-41FB-AE79-A3BB74CFA782} = {3277B1C0-BDFE-4460-9B0D-D9A661FB48DB}
|
||||
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {A49299FB-C5CD-4E0E-B7E1-B7867BBD67CC}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
|
||||
|
|
50
README.md
50
README.md
|
@ -6,6 +6,11 @@
|
|||
[](https://www.nuget.org/profiles/OpenTelemetry)
|
||||
[](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/ci.yml)
|
||||
|
||||
[](https://scorecard.dev/viewer/?uri=github.com/open-telemetry/opentelemetry-dotnet)
|
||||
[](https://www.bestpractices.dev/projects/10017)
|
||||
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-dotnet?ref=badge_shield&issueType=license)
|
||||
[](https://app.fossa.com/projects/custom%2B162%2Fgithub.com%2Fopen-telemetry%2Fopentelemetry-dotnet?ref=badge_shield&issueType=security)
|
||||
|
||||
The .NET [OpenTelemetry](https://opentelemetry.io/) implementation.
|
||||
|
||||
<details>
|
||||
|
@ -231,40 +236,55 @@ regardless of your experience level. Whether you're a seasoned OpenTelemetry
|
|||
developer, just starting your journey, or simply curious about the work we do,
|
||||
you're more than welcome to participate!
|
||||
|
||||
[Maintainers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer)
|
||||
([@open-telemetry/dotnet-maintainers](https://github.com/orgs/open-telemetry/teams/dotnet-maintainers)):
|
||||
### Maintainers
|
||||
|
||||
* [Alan West](https://github.com/alanwest), New Relic
|
||||
* [Mikel Blanchard](https://github.com/CodeBlanch), Microsoft
|
||||
* [Rajkumar Rangaraj](https://github.com/rajkumar-rangaraj), Microsoft
|
||||
|
||||
[Approvers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver)
|
||||
([@open-telemetry/dotnet-approvers](https://github.com/orgs/open-telemetry/teams/dotnet-approvers)):
|
||||
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
|
||||
|
||||
### Approvers
|
||||
|
||||
* [Cijo Thomas](https://github.com/cijothomas), Microsoft
|
||||
* [Martin Costello](https://github.com/martincostello), Grafana Labs
|
||||
* [Mikel Blanchard](https://github.com/CodeBlanch), Microsoft
|
||||
* [Piotr Kiełkowicz](https://github.com/Kielek), Splunk
|
||||
* [Rajkumar Rangaraj](https://github.com/rajkumar-rangaraj), Microsoft
|
||||
* [Utkarsh Umesan Pillai](https://github.com/utpilla), Microsoft
|
||||
|
||||
[Triagers](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager)
|
||||
([@open-telemetry/dotnet-triagers](https://github.com/orgs/open-telemetry/teams/dotnet-triagers)):
|
||||
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
|
||||
|
||||
### Triagers
|
||||
|
||||
* [Martin Thwaites](https://github.com/martinjt), Honeycomb
|
||||
* [Timothy "Mothra" Lee](https://github.com/TimothyMothra), Microsoft
|
||||
* [Timothy "Mothra" Lee](https://github.com/TimothyMothra)
|
||||
|
||||
[Emeritus
|
||||
Maintainer/Approver/Triager](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager):
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
### Emeritus Maintainers
|
||||
|
||||
* [Mike Goldsmith](https://github.com/MikeGoldsmith)
|
||||
* [Sergey Kanzhelev](https://github.com/SergeyKanzhelev)
|
||||
* [Utkarsh Umesan Pillai](https://github.com/utpilla)
|
||||
|
||||
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
|
||||
|
||||
### Emeritus Approvers
|
||||
|
||||
* [Bruno Garcia](https://github.com/bruno-garcia)
|
||||
* [Eddy Nakamura](https://github.com/eddynaka)
|
||||
* [Liudmila Molkova](https://github.com/lmolkova)
|
||||
* [Mike Goldsmith](https://github.com/MikeGoldsmith)
|
||||
* [Paulo Janotti](https://github.com/pjanotti)
|
||||
* [Reiley Yang](https://github.com/reyang)
|
||||
* [Robert Pająk](https://github.com/pellared)
|
||||
* [Sergey Kanzhelev](https://github.com/SergeyKanzhelev)
|
||||
* [Victor Lu](https://github.com/victlu)
|
||||
* [Vishwesh Bankwar](https://github.com/vishweshbankwar)
|
||||
|
||||
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
|
||||
|
||||
### Emeritus Triagers
|
||||
|
||||
* [Victor Lu](https://github.com/victlu)
|
||||
|
||||
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
|
||||
|
||||
### Thanks to all the people who have contributed
|
||||
|
||||
[](https://github.com/open-telemetry/opentelemetry-dotnet/graphs/contributors)
|
||||
|
|
|
@ -4,8 +4,38 @@ This file contains highlights and announcements covering all components.
|
|||
For more details see `CHANGELOG.md` files maintained in the root source
|
||||
directory of each individual package.
|
||||
|
||||
## 1.12.0
|
||||
|
||||
Release details: [1.12.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.12.0)
|
||||
|
||||
* **Breaking Change**: `OpenTelemetry.Exporter.OpenTelemetryProtocol` now
|
||||
defaults to using OTLP/HTTP instead of OTLP/gRPC when targeting .NET Framework
|
||||
and .NET Standard. This change may cause telemetry export to fail unless
|
||||
appropriate adjustments are made. Explicitly setting OTLP/gRPC may result in a
|
||||
`NotSupportedException` unless further configuration is applied. See
|
||||
[#6209](https://github.com/open-telemetry/opentelemetry-dotnet/issues/6209) for
|
||||
full details and mitigation guidance. [#6229](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6229)
|
||||
|
||||
## 1.11.1
|
||||
|
||||
Release details: [1.11.1](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.11.1)
|
||||
|
||||
* Fixed a bug preventing `OpenTelemetry.Exporter.OpenTelemetryProtocol` from
|
||||
exporting telemetry on .NET Framework.
|
||||
|
||||
## 1.11.0
|
||||
|
||||
Release details: [1.11.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.11.0)
|
||||
|
||||
* `OpenTelemetry.Exporter.OpenTelemetryProtocol` no longer depends on the
|
||||
`Google.Protobuf`, `Grpc`, or `Grpc.Net.Client` packages. Serialization and
|
||||
transmission of outgoing data is now performed manually to improve the overall
|
||||
performance.
|
||||
|
||||
## 1.10.0
|
||||
|
||||
Release details: [1.10.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.10.0)
|
||||
|
||||
* Bumped the package versions of `System.Diagnostic.DiagnosticSource` and other
|
||||
Microsoft.Extensions.* packages to `9.0.0`.
|
||||
|
||||
|
@ -50,6 +80,8 @@ directory of each individual package.
|
|||
|
||||
## 1.9.0
|
||||
|
||||
Release details: [1.9.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.9.0)
|
||||
|
||||
* `Exemplars` are now part of the stable API! For details see: [customizing
|
||||
exemplars
|
||||
collection](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics/customizing-the-sdk#exemplars).
|
||||
|
@ -60,6 +92,8 @@ directory of each individual package.
|
|||
|
||||
## 1.8.0
|
||||
|
||||
Release details: [1.8.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.8.0)
|
||||
|
||||
* `TracerProvider` sampler can now be configured via the `OTEL_TRACES_SAMPLER` &
|
||||
`OTEL_TRACES_SAMPLER_ARG` envvars.
|
||||
|
||||
|
@ -72,6 +106,8 @@ directory of each individual package.
|
|||
|
||||
## 1.7.0
|
||||
|
||||
Release details: [1.7.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.7.0)
|
||||
|
||||
* Bumped the package versions of System.Diagnostic.DiagnosticSource and other
|
||||
Microsoft.Extensions.* packages to `8.0.0`.
|
||||
|
||||
|
|
|
@ -29,3 +29,20 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
License notice for gRPC for .NET (https://github.com/grpc/grpc-dotnet)
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
Copyright 2019 The gRPC Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<Import Project=".\Common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn),1574,1591</NoWarn>
|
||||
<NoWarn>$(NoWarn),CS1574,CS1591</NoWarn>
|
||||
<IsPackable>false</IsPackable>
|
||||
<CodeAnalysisRuleSet>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\OpenTelemetry.test.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
|
@ -21,6 +21,18 @@
|
|||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
|
||||
<PackageReference Include="GitHubActionsTestLogger" />
|
||||
<PackageReference Include="JunitXml.TestLogger" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
|
||||
<Compile Include="$(RepoRoot)\test\Shared\StrongNameTests.cs" Link="StrongNameTests.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Running unit tests from VSCode does not work with .NET SDK 6.0.200 without ProduceReferenceAssemblyInOutDir -->
|
||||
<!-- Related breaking change: https://docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/6.0/write-reference-assemblies-to-obj -->
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<PackageProjectUrl>https://opentelemetry.io</PackageProjectUrl>
|
||||
<Authors>OpenTelemetry Authors</Authors>
|
||||
<Copyright>Copyright The OpenTelemetry Authors</Copyright>
|
||||
<PackageOutputPath Condition="$(Build_ArtifactStagingDirectory) != ''">$(Build_ArtifactStagingDirectory)</PackageOutputPath>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||
|
@ -36,16 +35,8 @@
|
|||
<ContinuousIntegrationBuild Condition="'$(Deterministic)'=='true'">true</ContinuousIntegrationBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Note: Disable net6.0 target for package validation because it has been
|
||||
removed. It should be possible to remove this once a stable version has been
|
||||
released to NuGet without net6.0. -->
|
||||
<PackageValidationBaselineFrameworkToIgnore Include="net6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Condition="'$(IntegrationBuild)' != 'true'" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Condition="'$(IntegrationBuild)' != 'true'" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<SignAssembly>true</SignAssembly>
|
||||
<RepoRoot>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).Parent.FullName)</RepoRoot>
|
||||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)debug.snk</AssemblyOriginatorKeyFile>
|
||||
<DefineConstants>$(DefineConstants);SIGNED</DefineConstants>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<Nullable>enable</Nullable>
|
||||
|
@ -14,8 +13,11 @@
|
|||
<NuGetAuditLevel>low</NuGetAuditLevel>
|
||||
<!-- Suppress warnings for repo code using experimental features -->
|
||||
<NoWarn>$(NoWarn);OTEL1000;OTEL1001;OTEL1002;OTEL1004</NoWarn>
|
||||
<!--temporarily disable. See 3958-->
|
||||
<!--<AnalysisLevel>latest-All</AnalysisLevel>-->
|
||||
<AnalysisLevel>latest-All</AnalysisLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(SignAssembly)' == 'true' ">
|
||||
<StrongNamePublicKey>002400000480000094000000060200000024000052534131000400000100010051C1562A090FB0C9F391012A32198B5E5D9A60E9B80FA2D7B434C9E5CCB7259BD606E66F9660676AFC6692B8CDC6793D190904551D2103B7B22FA636DCBB8208839785BA402EA08FC00C8F1500CCEF28BBF599AA64FFB1E1D5DC1BF3420A3777BADFE697856E9D52070A50C3EA5821C80BEF17CA3ACFFA28F89DD413F096F898</StrongNamePublicKey>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Label="BuildFlags">
|
||||
|
|
|
@ -80,11 +80,21 @@ Maintainers (admins) are needed to merge PRs and for the push to NuGet.**
|
|||
for the projects being released.
|
||||
</details
|
||||
|
||||
3. :stop_sign: The PR opened by [Prepare for a
|
||||
3. For stable releases, use the `/UpdateReleaseNotes` command on the PR opened
|
||||
by [Prepare for a
|
||||
release](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/prepare-release.yml)
|
||||
workflow in step 2 to update [Release Notes](../RELEASENOTES.md) with any
|
||||
big or interesting new features.
|
||||
|
||||
* The `/UpdateReleaseDates` command may also be used to update dates in
|
||||
`CHANGELOG.md` files. This is useful when the PR is opened a few days
|
||||
before the planned release date to review public API changes.
|
||||
|
||||
4. :stop_sign: The PR opened by [Prepare for a
|
||||
release](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/prepare-release.yml)
|
||||
workflow in step 2 has to be merged.
|
||||
|
||||
4. Once the PR opened by [Prepare for a
|
||||
5. Once the PR opened by [Prepare for a
|
||||
release](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/prepare-release.yml)
|
||||
workflow in step 2 has been merged a trigger will automatically add a
|
||||
comment and lock the PR. Post a comment with "/CreateReleaseTag" in the
|
||||
|
@ -123,7 +133,7 @@ Maintainers (admins) are needed to merge PRs and for the push to NuGet.**
|
|||
workflow.
|
||||
</details>
|
||||
|
||||
5. :stop_sign: Wait for the [Build, pack, and publish to
|
||||
6. :stop_sign: Wait for the [Build, pack, and publish to
|
||||
MyGet](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/publish-packages-1.0.yml)
|
||||
workflow to complete. When complete a trigger will automatically add a
|
||||
comment on the PR opened by [Prepare for a
|
||||
|
@ -187,14 +197,14 @@ Maintainers (admins) are needed to merge PRs and for the push to NuGet.**
|
|||
draft Release and click `Publish release`.
|
||||
</details>
|
||||
|
||||
6. If a new stable version of the core packages was released, a PR should have
|
||||
7. If a new stable version of the core packages was released, a PR should have
|
||||
been automatically created by the [Complete
|
||||
release](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/post-release.yml)
|
||||
workflow to update the `OTelLatestStableVer` property in
|
||||
`Directory.Packages.props` to the just released stable version. Merge that
|
||||
PR once the build passes (this requires the packages be available on NuGet).
|
||||
|
||||
7. The [Complete
|
||||
8. The [Complete
|
||||
release](https://github.com/open-telemetry/opentelemetry-dotnet/actions/workflows/post-release.yml)
|
||||
workflow should have invoked the [Core version
|
||||
update](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/actions/workflows/core-version-update.yml)
|
||||
|
@ -203,7 +213,6 @@ Maintainers (admins) are needed to merge PRs and for the push to NuGet.**
|
|||
repository which opens a PR to update dependencies. Verify this PR was
|
||||
opened successfully.
|
||||
|
||||
8. For stable releases, update [Release Notes](../RELEASENOTES.md) with any big
|
||||
or interesting new features and then post an announcement in the [Slack
|
||||
channel](https://cloud-native.slack.com/archives/C01N3BC2W7Q) with the same
|
||||
information.
|
||||
9. For stable releases post an announcement in the [Slack
|
||||
channel](https://cloud-native.slack.com/archives/C01N3BC2W7Q) announcing the
|
||||
release and link to the release notes.
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
version: '3.7'
|
||||
|
||||
services:
|
||||
tests:
|
||||
build:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
version: '3.7'
|
||||
|
||||
services:
|
||||
tests:
|
||||
build:
|
||||
|
|
|
@ -15,6 +15,7 @@ function CreatePullRequestToUpdateChangelogsAndPublicApis {
|
|||
throw 'Input version did not match expected format'
|
||||
}
|
||||
|
||||
$isPrerelease = $version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc'
|
||||
$tag="${minVerTagPrefix}${version}"
|
||||
$branch="release/prepare-${tag}-release"
|
||||
|
||||
|
@ -48,7 +49,7 @@ Requested by: @$requestedByUserName
|
|||
& ./build/scripts/update-changelogs.ps1 -minVerTagPrefix $minVerTagPrefix -version $version
|
||||
|
||||
# Update publicApi files for stable releases
|
||||
if ($version -notlike "*-alpha*" -and $version -notlike "*-beta*" -and $version -notlike "*-rc*")
|
||||
if ($isPrerelease -ne $true)
|
||||
{
|
||||
& ./build/scripts/finalize-publicapi.ps1 -minVerTagPrefix $minVerTagPrefix
|
||||
|
||||
|
@ -61,6 +62,20 @@ Requested by: @$requestedByUserName
|
|||
## Commands
|
||||
|
||||
``/UpdateReleaseDates``: Use to update release dates in CHANGELOGs before merging [``approvers``, ``maintainers``]
|
||||
"@
|
||||
|
||||
if ($minVerTagPrefix -eq 'core-' -and $isPrerelease -ne $true)
|
||||
{
|
||||
$body +=
|
||||
@"
|
||||
|
||||
``/UpdateReleaseNotes``: Use to update ``RELEASENOTES.md`` before merging [``approvers``, ``maintainers``]
|
||||
"@
|
||||
}
|
||||
|
||||
$body +=
|
||||
@"
|
||||
|
||||
``/CreateReleaseTag``: Use after merging to push the release tag and trigger the job to create packages [``approvers``, ``maintainers``]
|
||||
``/PushPackages``: Use after the created packages have been validated to push to NuGet [``maintainers``]
|
||||
"@
|
||||
|
@ -77,12 +92,42 @@ Requested by: @$requestedByUserName
|
|||
throw 'git push failure'
|
||||
}
|
||||
|
||||
gh pr create `
|
||||
$createPullRequestResponse = gh pr create `
|
||||
--title "[release] Prepare release $tag" `
|
||||
--body $body `
|
||||
--base $targetBranch `
|
||||
--head $branch `
|
||||
--label release
|
||||
|
||||
Write-Host $createPullRequestResponse
|
||||
|
||||
$match = [regex]::Match($createPullRequestResponse, "\/pull\/(.*)$")
|
||||
if ($match.Success -eq $false)
|
||||
{
|
||||
throw 'Could not parse pull request number from gh pr create response'
|
||||
}
|
||||
|
||||
$pullRequestNumber = $match.Groups[1].Value
|
||||
|
||||
if ($minVerTagPrefix -eq 'core-' -and $isPrerelease -ne $true)
|
||||
{
|
||||
$found = Select-String -Path "RELEASENOTES.md" -Pattern "## $version" -Quiet
|
||||
if ($found -eq $false)
|
||||
{
|
||||
$body =
|
||||
@"
|
||||
I noticed this PR is releasing a stable version of core packages but there isn't any content in ``RELEASENOTES.md`` for the version being released.
|
||||
|
||||
It is important to update ``RELEASENOTES.md`` before creating the release tag because a permalink will become part of the package(s).
|
||||
|
||||
Post a comment with "/UpdateReleaseNotes" in the body if you would like me to update release notes.
|
||||
|
||||
Note: In the comment everything below "/UpdateReleaseNotes" will be added to ``RELEASENOTES.md`` for the version being released. If something is already there it will be replaced.
|
||||
"@
|
||||
|
||||
gh pr comment $pullRequestNumber --body $body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function CreatePullRequestToUpdateChangelogsAndPublicApis
|
||||
|
@ -294,3 +339,125 @@ Released $(Get-Date -UFormat '%Y-%b-%d')
|
|||
}
|
||||
|
||||
Export-ModuleMember -Function UpdateChangelogReleaseDatesAndPostNoticeOnPullRequest
|
||||
|
||||
function UpdateReleaseNotesAndPostNoticeOnPullRequest {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$gitRepository,
|
||||
[Parameter(Mandatory=$true)][string]$pullRequestNumber,
|
||||
[Parameter(Mandatory=$true)][string]$botUserName,
|
||||
[Parameter(Mandatory=$true)][string]$commentUserName,
|
||||
[Parameter(Mandatory=$true)][string]$commentBody,
|
||||
[Parameter()][string]$gitUserName,
|
||||
[Parameter()][string]$gitUserEmail
|
||||
)
|
||||
|
||||
$prViewResponse = gh pr view $pullRequestNumber --json headRefName,author,title | ConvertFrom-Json
|
||||
|
||||
if ($prViewResponse.author.login -ne $botUserName)
|
||||
{
|
||||
throw 'PR author was unexpected'
|
||||
}
|
||||
|
||||
$match = [regex]::Match($prViewResponse.title, '^\[release\] Prepare release (.*)$')
|
||||
if ($match.Success -eq $false)
|
||||
{
|
||||
throw 'Could not parse tag from PR title'
|
||||
}
|
||||
|
||||
$tag = $match.Groups[1].Value
|
||||
|
||||
$match = [regex]::Match($tag, '^(.*?-)(.*)$')
|
||||
if ($match.Success -eq $false)
|
||||
{
|
||||
throw 'Could not parse prefix or version from tag'
|
||||
}
|
||||
|
||||
$tagPrefix = $match.Groups[1].Value
|
||||
$version = $match.Groups[2].Value
|
||||
$isPrerelease = $version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc'
|
||||
|
||||
$commentUserPermission = gh api "repos/$gitRepository/collaborators/$commentUserName/permission" | ConvertFrom-Json
|
||||
if ($commentUserPermission.permission -ne 'admin' -and $commentUserPermission.permission -ne 'write')
|
||||
{
|
||||
gh pr comment $pullRequestNumber `
|
||||
--body "I'm sorry @$commentUserName but you don't have permission to update this PR. Only maintainers and approvers can update this PR."
|
||||
return
|
||||
}
|
||||
|
||||
if ($tagPrefix -ne 'core-' -or $isPrerelease -eq $true)
|
||||
{
|
||||
gh pr comment $pullRequestNumber `
|
||||
--body "I'm sorry @$commentUserName but we don't typically add release notes for prereleases or unstable packages."
|
||||
return
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrEmpty($gitUserName) -eq $false)
|
||||
{
|
||||
git config user.name $gitUserName
|
||||
}
|
||||
if ([string]::IsNullOrEmpty($gitUserEmail) -eq $false)
|
||||
{
|
||||
git config user.email $gitUserEmail
|
||||
}
|
||||
|
||||
git switch $prViewResponse.headRefName 2>&1 | % ToString
|
||||
if ($LASTEXITCODE -gt 0)
|
||||
{
|
||||
throw 'git switch failure'
|
||||
}
|
||||
|
||||
$releaseNotesContent = (Get-Content -Path "RELEASENOTES.md" -Raw)
|
||||
|
||||
$match = [regex]::Match($commentBody, '[\w\W\s]*\/UpdateReleaseNotes.*$([\w\W\s]*)', [Text.RegularExpressions.RegexOptions]::Multiline)
|
||||
if ($match.Success -eq $false)
|
||||
{
|
||||
throw 'Could not find release notes content'
|
||||
}
|
||||
|
||||
$content = $match.Groups[1].Value.Trim() -replace "`r`n", "`n"
|
||||
|
||||
$body =
|
||||
@"
|
||||
## $version
|
||||
|
||||
Release details: [$version](https://github.com/$gitRepository/releases/tag/$tagPrefix$version)
|
||||
|
||||
$content
|
||||
|
||||
##
|
||||
"@
|
||||
|
||||
$match = [regex]::Match($releaseNotesContent, "(## $version[\w\W\s]*?)##", [Text.RegularExpressions.RegexOptions]::Multiline)
|
||||
if ($match.Success -eq $true)
|
||||
{
|
||||
$content = [regex]::Replace($releaseNotesContent, "(## $version[\w\W\s]*?)##", $body, [Text.RegularExpressions.RegexOptions]::Multiline)
|
||||
Set-Content -Path "RELEASENOTES.md" -Value $content.TrimEnd()
|
||||
}
|
||||
else {
|
||||
$match = [regex]::Match($releaseNotesContent, '(# Release Notes[\w\W\s]*?)##', [Text.RegularExpressions.RegexOptions]::Multiline)
|
||||
if ($match.Success -eq $false)
|
||||
{
|
||||
throw 'Could not find release notes header'
|
||||
}
|
||||
|
||||
$body = $match.Groups[1].Value + $body
|
||||
$content = [regex]::Replace($releaseNotesContent, '(# Release Notes[\w\W\s]*?)##', $body, [Text.RegularExpressions.RegexOptions]::Multiline)
|
||||
Set-Content -Path "RELEASENOTES.md" -Value $content.TrimEnd()
|
||||
}
|
||||
|
||||
git commit -a -m "Update RELEASENOTES for $tag." 2>&1 | % ToString
|
||||
if ($LASTEXITCODE -gt 0)
|
||||
{
|
||||
throw 'git commit failure'
|
||||
}
|
||||
|
||||
git push -u origin $prViewResponse.headRefName 2>&1 | % ToString
|
||||
if ($LASTEXITCODE -gt 0)
|
||||
{
|
||||
throw 'git push failure'
|
||||
}
|
||||
|
||||
gh pr comment $pullRequestNumber --body "I updated ``RELEASENOTES.md``."
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function UpdateReleaseNotesAndPostNoticeOnPullRequest
|
||||
|
|
|
@ -24,10 +24,9 @@ if ($LastExitCode -ne 0)
|
|||
Write-Host $publishOutput
|
||||
}
|
||||
|
||||
$runtime = $IsWindows ? "win-x64" : ($IsMacOS ? "macos-x64" : "linux-x64")
|
||||
$app = $IsWindows ? "./OpenTelemetry.AotCompatibility.TestApp.exe" : "./OpenTelemetry.AotCompatibility.TestApp"
|
||||
|
||||
Push-Location $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/bin/Release/$targetNetFramework/$runtime
|
||||
Push-Location $rootDirectory/artifacts/publish/OpenTelemetry.AotCompatibility.TestApp/release_$targetNetFramework
|
||||
|
||||
Write-Host "Executing test App..."
|
||||
$app
|
||||
|
|
|
@ -1,22 +1,32 @@
|
|||
param(
|
||||
[Parameter()][string]$coyoteVersion="1.7.10",
|
||||
[Parameter()][string]$coyoteVersion="1.7.11",
|
||||
[Parameter(Mandatory=$true)][string]$testProjectName,
|
||||
[Parameter(Mandatory=$true)][string]$targetFramework,
|
||||
[Parameter()][string]$categoryName="CoyoteConcurrencyTests",
|
||||
[Parameter()][string]$configuration="Release"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$env:OTEL_RUN_COYOTE_TESTS = 'true'
|
||||
|
||||
$rootDirectory = Get-Location
|
||||
|
||||
Write-Host "Install Coyote CLI."
|
||||
dotnet tool install --global Microsoft.Coyote.CLI
|
||||
dotnet tool install --global Microsoft.Coyote.CLI --version $coyoteVersion
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Microsoft.Coyote.CLI installation failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Write-Host "Build $testProjectName project."
|
||||
dotnet build "$rootDirectory/test/$testProjectName/$testProjectName.csproj" --configuration $configuration
|
||||
|
||||
$artifactsPath = Join-Path $rootDirectory "test/$testProjectName/bin/$configuration/$targetFramework"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "dotnet build failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$artifactsPath = Join-Path $rootDirectory "artifacts/bin/$testProjectName/$($configuration.ToLowerInvariant())_$targetFramework"
|
||||
|
||||
Write-Host "Generate Coyote rewriting options JSON file."
|
||||
$assemblies = Get-ChildItem $artifactsPath -Filter OpenTelemetry*.dll | ForEach-Object {$_.Name}
|
||||
|
@ -29,6 +39,13 @@ $RewriteOptionsJson | ConvertTo-Json -Compress | Set-Content -Path "$rootDirecto
|
|||
Write-Host "Run Coyote rewrite."
|
||||
coyote rewrite "$rootDirectory/test/$testProjectName/rewrite.coyote.json"
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "coyote rewrite failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Write-Host "Execute re-written binary."
|
||||
dotnet test "$artifactsPath/$testProjectName.dll" --framework $targetFramework --filter CategoryName=$categoryName
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "dotnet test failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
<Project>
|
||||
<Import Project="$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), '..', 'Directory.Build.props'))" />
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'OpenTelemetry.sln'))\build\Common.nonprod.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>$(TargetFrameworksForDocs)</TargetFrameworks>
|
||||
<!-- Opt-out of Artifacts Output for docs as there are duplicated project names -->
|
||||
<UseArtifactsOutput>false</UseArtifactsOutput>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
|
@ -25,33 +25,17 @@ OpenTelemetry .NET:
|
|||
* [Getting Started - Console Application](./getting-started-console/README.md)
|
||||
* [Logging with Complex Objects](./complex-objects/README.md)
|
||||
|
||||
## Structured Logging
|
||||
## Logging API
|
||||
|
||||
:heavy_check_mark: You should use structured logging.
|
||||
### ILogger
|
||||
|
||||
* Structured logging is more efficient than unstructured logging.
|
||||
* Filtering and redaction can happen on individual key-value pairs instead of
|
||||
the entire log message.
|
||||
* Storage and indexing are more efficient.
|
||||
* Structured logging makes it easier to manage and consume logs.
|
||||
.NET supports high performance, structured logging via the
|
||||
[`Microsoft.Extensions.Logging.ILogger`](https://docs.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger)
|
||||
interface (including
|
||||
[`ILogger<TCategoryName>`](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger-1))
|
||||
to help monitor application behavior and diagnose issues.
|
||||
|
||||
:stop_sign: You should avoid string interpolation.
|
||||
|
||||
> [!WARNING]
|
||||
> The following code has bad performance due to [string
|
||||
interpolation](https://learn.microsoft.com/dotnet/csharp/tutorials/string-interpolation):
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
logger.LogInformation($"Hello from {food} {price}.");
|
||||
```
|
||||
|
||||
Refer to the [logging performance
|
||||
benchmark](../../test/Benchmarks/Logs/LogBenchmarks.cs) for more details.
|
||||
|
||||
## Package Version
|
||||
#### Package Version
|
||||
|
||||
:heavy_check_mark: You should always use the
|
||||
[`ILogger`](https://docs.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger)
|
||||
|
@ -69,16 +53,6 @@ package, regardless of the .NET runtime version being used:
|
|||
backward compatibility on `Microsoft.Extensions.Logging` even during major
|
||||
version bumps, so compatibility is not a concern here.
|
||||
|
||||
## Logging API
|
||||
|
||||
### ILogger
|
||||
|
||||
.NET supports high performance, structured logging via the
|
||||
[`Microsoft.Extensions.Logging.ILogger`](https://docs.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger)
|
||||
interface (including
|
||||
[`ILogger<TCategoryName>`](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger-1))
|
||||
to help monitor application behavior and diagnose issues.
|
||||
|
||||
#### Get Logger
|
||||
|
||||
In order to use the `ILogger` interface, you need to first get a logger. How to
|
||||
|
@ -125,7 +99,38 @@ are not super expensive, they still come with CPU and memory cost, and are meant
|
|||
to be reused throughout the application. Refer to the [logging performance
|
||||
benchmark](../../test/Benchmarks/Logs/LogBenchmarks.cs) for more details.
|
||||
|
||||
#### Use Logger
|
||||
#### Write log messages
|
||||
|
||||
:heavy_check_mark: You should use structured logging.
|
||||
|
||||
* Structured logging is more efficient than unstructured logging.
|
||||
* Filtering and redaction can happen on individual key-value pairs instead of
|
||||
the entire log message.
|
||||
* Storage and indexing are more efficient.
|
||||
* Structured logging makes it easier to manage and consume logs.
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
logger.LogInformation("Hello from {food} {price}.", food, price);
|
||||
```
|
||||
|
||||
:stop_sign: You should avoid string interpolation.
|
||||
|
||||
> [!WARNING]
|
||||
> The following code has bad performance due to [string
|
||||
interpolation](https://learn.microsoft.com/dotnet/csharp/tutorials/string-interpolation):
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
logger.LogInformation($"Hello from {food} {price}.");
|
||||
```
|
||||
|
||||
Refer to the [logging performance
|
||||
benchmark](../../test/Benchmarks/Logs/LogBenchmarks.cs) for more details.
|
||||
|
||||
:heavy_check_mark: You should use [compile-time logging source
|
||||
generation](https://docs.microsoft.com/dotnet/core/extensions/logger-message-generator)
|
||||
|
@ -222,6 +227,111 @@ code is now depending on which logger is being enabled, not to mention the
|
|||
argument evaluation might have significant side effects that are now depending
|
||||
on the logging configuration.
|
||||
|
||||
:heavy_check_mark: You should use a dedicated parameter to log exceptions when
|
||||
using the compile-time source generator.
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
try
|
||||
{
|
||||
// Execute some logic
|
||||
|
||||
logger.SayHello(food, price);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.SayHelloFailure(ex, food, price);
|
||||
}
|
||||
|
||||
internal static partial class LoggerExtensions
|
||||
{
|
||||
[LoggerMessage(Level = LogLevel.Information, Message = "Hello from {food} {price}.")]
|
||||
public static partial void SayHello(this ILogger logger, string food, double price);
|
||||
|
||||
[LoggerMessage(Level = LogLevel.Error, Message = "Could not say hello from {food} {price}.")]
|
||||
public static partial void SayHelloFailure(this ILogger logger, Exception exception, string food, double price);
|
||||
}
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> When using the compile-time source generator the first `Exception` parameter
|
||||
> detected is automatically given special handling. It **SHOULD NOT** be part of
|
||||
> the message template. For details see: [Log method
|
||||
> anatomy](https://learn.microsoft.com/dotnet/core/extensions/logger-message-generator#log-method-anatomy).
|
||||
|
||||
:heavy_check_mark: You should use the dedicated overloads to log exceptions when
|
||||
using the logging extensions methods.
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
try
|
||||
{
|
||||
// Execute some logic
|
||||
|
||||
logger.LogInformation("Hello from {food} {price}.", food, price);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "Could not say hello from {food} {price}.", food, price);
|
||||
}
|
||||
```
|
||||
|
||||
:stop_sign: You should avoid adding exception details into the message template.
|
||||
|
||||
You want to use the correct `Exception` APIs because the OpenTelemetry
|
||||
Specification [defines dedicated
|
||||
attributes](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/exceptions/exceptions-logs.md)
|
||||
for `Exception` details. The following examples show what **NOT** to do. In
|
||||
these cases the details won't be lost, but the dedicated attributes also won't
|
||||
be added.
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
try
|
||||
{
|
||||
// Execute some logic
|
||||
|
||||
logger.SayHello(food, price);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.SayHelloFailure(food, price, ex.Message);
|
||||
}
|
||||
|
||||
internal static partial class LoggerExtensions
|
||||
{
|
||||
[LoggerMessage(Level = LogLevel.Information, Message = "Hello from {food} {price}.")]
|
||||
public static partial void SayHello(this ILogger logger, string food, double price);
|
||||
|
||||
// BAD - Exception should not be part of the message template. Use the dedicated parameter.
|
||||
[LoggerMessage(Level = LogLevel.Error, Message = "Could not say hello from {food} {price} {message}.")]
|
||||
public static partial void SayHelloFailure(this ILogger logger, string food, double price, string message);
|
||||
}
|
||||
```
|
||||
|
||||
```csharp
|
||||
var food = "tomato";
|
||||
var price = 2.99;
|
||||
|
||||
try
|
||||
{
|
||||
// Execute some logic
|
||||
|
||||
logger.LogInformation("Hello from {food} {price}.", food, price);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// BAD - Exception should not be part of the message template. Use the dedicated parameter.
|
||||
logger.LogError("Could not say hello from {food} {price} {message}.", food, price, ex.Message);
|
||||
}
|
||||
```
|
||||
|
||||
## LoggerFactory
|
||||
|
||||
In many cases, you can use [ILogger](#ilogger) without having to interact with
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
public struct FoodRecallNotice
|
||||
namespace ComplexObjects;
|
||||
|
||||
internal struct FoodRecallNotice
|
||||
{
|
||||
public string? BrandName { get; set; }
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
using ComplexObjects;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenTelemetry.Logs;
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@ using OpenTelemetry;
|
|||
using OpenTelemetry.Logs;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
public class Program
|
||||
namespace Correlation;
|
||||
|
||||
internal sealed class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("MyCompany.MyProduct.MyLibrary");
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ using OpenTelemetry.Logs;
|
|||
|
||||
namespace DedicatedLogging;
|
||||
|
||||
public static class DedicatedLoggingServiceCollectionExtensions
|
||||
internal static class DedicatedLoggingServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddDedicatedLogging(
|
||||
this IServiceCollection services,
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
namespace DedicatedLogging;
|
||||
|
||||
public interface IDedicatedLogger : ILogger
|
||||
internal interface IDedicatedLogger : ILogger
|
||||
{
|
||||
}
|
||||
|
||||
public interface IDedicatedLogger<out TCategoryName> : IDedicatedLogger
|
||||
internal interface IDedicatedLogger<out TCategoryName> : IDedicatedLogger
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA1812;CA2213</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using OpenTelemetry;
|
||||
using OpenTelemetry.Logs;
|
||||
|
||||
internal class MyExporter : BaseExporter<LogRecord>
|
||||
internal sealed class MyExporter : BaseExporter<LogRecord>
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
|
@ -59,6 +59,7 @@ internal class MyExporter : BaseExporter<LogRecord>
|
|||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
Console.WriteLine($"{this.name}.Dispose({disposing})");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using OpenTelemetry;
|
||||
using OpenTelemetry.Logs;
|
||||
|
||||
internal class MyProcessor : BaseProcessor<LogRecord>
|
||||
internal sealed class MyProcessor : BaseProcessor<LogRecord>
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
|
@ -32,6 +32,7 @@ internal class MyProcessor : BaseProcessor<LogRecord>
|
|||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
Console.WriteLine($"{this.name}.Dispose({disposing})");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ using OpenTelemetry;
|
|||
|
||||
namespace ExtendingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal sealed class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
|
@ -29,16 +29,16 @@ public class Program
|
|||
// logger.LogInformation($"Hello from potato {0.99}.");
|
||||
|
||||
// structured log with template
|
||||
logger.LogInformation("Hello from {name} {price}.", "tomato", 2.99);
|
||||
logger.LogInformation("Hello from {Name} {Price}.", "tomato", 2.99);
|
||||
|
||||
// structured log with strong type
|
||||
logger.LogInformation("{food}", new Food { Name = "artichoke", Price = 3.99 });
|
||||
logger.LogInformation("{Food}", new Food { Name = "artichoke", Price = 3.99 });
|
||||
|
||||
// structured log with anonymous type
|
||||
logger.LogInformation("{food}", new { Name = "pumpkin", Price = 5.99 });
|
||||
logger.LogInformation("{Food}", new { Name = "pumpkin", Price = 5.99 });
|
||||
|
||||
// structured log with general type
|
||||
logger.LogInformation("{food}", new Dictionary<string, object>
|
||||
logger.LogInformation("{Food}", new Dictionary<string, object>
|
||||
{
|
||||
["Name"] = "truffle",
|
||||
["Price"] = 299.99,
|
||||
|
@ -48,11 +48,11 @@ public class Program
|
|||
using (logger.BeginScope("[operation]"))
|
||||
using (logger.BeginScope("[hardware]"))
|
||||
{
|
||||
logger.LogError("{name} is broken.", "refrigerator");
|
||||
logger.LogError("{Name} is broken.", "refrigerator");
|
||||
}
|
||||
|
||||
// message will be redacted by MyRedactionProcessor
|
||||
logger.LogInformation("OpenTelemetry {sensitiveString}.", "<secret>");
|
||||
logger.LogInformation("OpenTelemetry {SensitiveString}.", "<secret>");
|
||||
}
|
||||
|
||||
internal struct Food
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA2000;CA1848;CA1510;CA1305</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA2213;CA1812;CA1307</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -59,7 +59,7 @@ too frequently. `Meter` is fairly expensive and meant to be reused throughout
|
|||
the application. For most applications, it can be modeled as static readonly
|
||||
field (e.g. [Program.cs](./getting-started-console/Program.cs)) or singleton via
|
||||
dependency injection (e.g.
|
||||
[Instrumentation.cs](../../examples/AspNetCore/Instrumentation.cs)).
|
||||
[InstrumentationSource.cs](../../examples/AspNetCore/InstrumentationSource.cs)).
|
||||
|
||||
:heavy_check_mark: You should use dot-separated
|
||||
[UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case) as the
|
||||
|
@ -97,7 +97,7 @@ frequently. Instruments are fairly expensive and meant to be reused throughout
|
|||
the application. For most applications, instruments can be modeled as static
|
||||
readonly fields (e.g. [Program.cs](./getting-started-console/Program.cs)) or
|
||||
singleton via dependency injection (e.g.
|
||||
[Instrumentation.cs](../../examples/AspNetCore/Instrumentation.cs)).
|
||||
[InstrumentationSource.cs](../../examples/AspNetCore/InstrumentationSource.cs)).
|
||||
|
||||
:stop_sign: You should avoid invalid instrument names.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ using OpenTelemetry.Resources;
|
|||
|
||||
namespace CustomizingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Meter Meter1 = new("CompanyA.ProductA.Library1", "1.0");
|
||||
private static readonly Meter Meter2 = new("CompanyA.ProductB.Library2", "1.0");
|
||||
|
@ -29,19 +29,19 @@ public class Program
|
|||
.AddView(instrumentName: "MyCounter", name: "MyCounterRenamed")
|
||||
|
||||
// Change Histogram boundaries using the Explicit Bucket Histogram aggregation.
|
||||
.AddView(instrumentName: "MyHistogram", new ExplicitBucketHistogramConfiguration() { Boundaries = new double[] { 10, 20 } })
|
||||
.AddView(instrumentName: "MyHistogram", new ExplicitBucketHistogramConfiguration() { Boundaries = [10.0, 20.0] })
|
||||
|
||||
// Change Histogram to use the Base2 Exponential Bucket Histogram aggregation.
|
||||
.AddView(instrumentName: "MyExponentialBucketHistogram", new Base2ExponentialBucketHistogramConfiguration())
|
||||
|
||||
// For the instrument "MyCounterCustomTags", aggregate with only the keys "tag1", "tag2".
|
||||
.AddView(instrumentName: "MyCounterCustomTags", new MetricStreamConfiguration() { TagKeys = new string[] { "tag1", "tag2" } })
|
||||
.AddView(instrumentName: "MyCounterCustomTags", new MetricStreamConfiguration() { TagKeys = ["tag1", "tag2"] })
|
||||
|
||||
// Drop the instrument "MyCounterDrop".
|
||||
.AddView(instrumentName: "MyCounterDrop", MetricStreamConfiguration.Drop)
|
||||
|
||||
// Configure the Explicit Bucket Histogram aggregation with custom boundaries and new name.
|
||||
.AddView(instrumentName: "histogramWithMultipleAggregations", new ExplicitBucketHistogramConfiguration() { Boundaries = new double[] { 10, 20 }, Name = "MyHistogramWithExplicitHistogram" })
|
||||
.AddView(instrumentName: "histogramWithMultipleAggregations", new ExplicitBucketHistogramConfiguration() { Boundaries = [10.0, 20.0], Name = "MyHistogramWithExplicitHistogram" })
|
||||
|
||||
// Use Base2 Exponential Bucket Histogram aggregation and new name.
|
||||
.AddView(instrumentName: "histogramWithMultipleAggregations", new Base2ExponentialBucketHistogramConfiguration() { Name = "MyHistogramWithBase2ExponentialBucketHistogram" })
|
||||
|
|
|
@ -248,8 +248,8 @@ histogram aggregation:
|
|||
recommended to be used by library authors when the SDK defaults don't match the
|
||||
required granularity for the histogram being emitted.
|
||||
|
||||
See:
|
||||
[InstrumentAdvice<T>](https://learn.microsoft.com/dotnet/api/system.diagnostics.metrics.instrumentadvice-1).
|
||||
See: [Using Advice to customize Histogram
|
||||
instruments](https://learn.microsoft.com/dotnet/core/diagnostics/metrics-instrumentation#using-advice-to-customize-histogram-instruments).
|
||||
|
||||
##### Base2 exponential bucket histogram aggregation
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -8,7 +8,9 @@ using OpenTelemetry.Exporter;
|
|||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
public class Program
|
||||
namespace Exemplars;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("OpenTelemetry.Demo.Exemplar");
|
||||
private static readonly Meter MyMeter = new("OpenTelemetry.Demo.Exemplar");
|
||||
|
|
|
@ -58,7 +58,7 @@ and
|
|||
enabled:
|
||||
|
||||
```sh
|
||||
./prometheus --enable-feature=exemplar-storage --enable-feature=otlp-write-receiver
|
||||
./prometheus --enable-feature=exemplar-storage --web.enable-otlp-receiver
|
||||
```
|
||||
|
||||
## Install and configure Grafana
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Text;
|
|||
using OpenTelemetry;
|
||||
using OpenTelemetry.Metrics;
|
||||
|
||||
internal class MyExporter : BaseExporter<Metric>
|
||||
internal sealed class MyExporter : BaseExporter<Metric>
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
|
@ -28,7 +28,7 @@ internal class MyExporter : BaseExporter<Metric>
|
|||
sb.Append(", ");
|
||||
}
|
||||
|
||||
sb.Append($"{metric.Name}");
|
||||
sb.Append(metric.Name);
|
||||
|
||||
foreach (ref readonly var metricPoint in metric.GetMetricPoints())
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ internal class MyExporter : BaseExporter<Metric>
|
|||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
Console.WriteLine($"{this.name}.Dispose({disposing})");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ using OpenTelemetry.Metrics;
|
|||
|
||||
namespace ExtendingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
|
||||
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA2000;CA1510;CA1305</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,7 +5,9 @@ using System.Diagnostics.Metrics;
|
|||
using OpenTelemetry;
|
||||
using OpenTelemetry.Metrics;
|
||||
|
||||
public class Program
|
||||
namespace GettingStartedConsole;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
|
||||
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
|
||||
|
|
|
@ -6,7 +6,9 @@ using OpenTelemetry;
|
|||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Metrics;
|
||||
|
||||
public class Program
|
||||
namespace GettingStartedPrometheusGrafana;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
|
||||
private static readonly Counter<long> MyFruitCounter = MyMeter.CreateCounter<long>("MyFruitCounter");
|
||||
|
|
|
@ -88,7 +88,7 @@ access. Run the `prometheus(.exe)` server executable with feature flag
|
|||
enabled:
|
||||
|
||||
```sh
|
||||
./prometheus --enable-feature=otlp-write-receiver
|
||||
./prometheus --web.enable-otlp-receiver
|
||||
```
|
||||
|
||||
### View results in Prometheus
|
||||
|
|
|
@ -8,7 +8,7 @@ using OpenTelemetry.Metrics;
|
|||
|
||||
namespace LearningMoreInstruments;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly Meter MyMeter = new("MyCompany.MyProduct.MyLibrary", "1.0");
|
||||
private static readonly Histogram<long> MyHistogram = MyMeter.CreateHistogram<long>("MyHistogram");
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ExtendingTheSdk;
|
||||
|
||||
internal static partial class LoggerExtensions
|
||||
{
|
||||
[LoggerMessage(LogLevel.Information, "Hello from {Name} {Price}")]
|
||||
public static partial void HelloFrom(this ILogger logger, string name, double price);
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using OpenTelemetry.Resources;
|
||||
|
||||
internal class MyResourceDetector : IResourceDetector
|
||||
internal sealed class MyResourceDetector : IResourceDetector
|
||||
{
|
||||
public Resource Detect()
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace ExtendingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource DemoSource = new("OTel.Demo");
|
||||
private static readonly Meter MeterDemoSource = new("OTel.Demo");
|
||||
|
@ -55,7 +55,6 @@ public class Program
|
|||
}
|
||||
|
||||
var logger = loggerFactory.CreateLogger("OTel.Demo");
|
||||
logger
|
||||
.LogInformation("Hello from {Name} {Price}", "tomato", 2.99);
|
||||
logger.HelloFrom("tomato", 2.99);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ too frequently. `ActivitySource` is fairly expensive and meant to be reused
|
|||
throughout the application. For most applications, it can be modeled as static
|
||||
readonly field (e.g. [Program.cs](./getting-started-console/Program.cs)) or
|
||||
singleton via dependency injection (e.g.
|
||||
[Instrumentation.cs](../../examples/AspNetCore/Instrumentation.cs)).
|
||||
[InstrumentationSource.cs](../../examples/AspNetCore/InstrumentationSource.cs)).
|
||||
|
||||
:heavy_check_mark: You should use dot-separated
|
||||
[UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case) as the
|
||||
|
|
|
@ -8,7 +8,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace CustomizingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyLibraryActivitySource = new(
|
||||
"MyCompany.MyProduct.MyLibrary");
|
||||
|
|
|
@ -477,8 +477,8 @@ When using the `AddOpenTelemetry` & `WithTracing` extension methods the
|
|||
into an existing collection (typically the collection used is the one managed by
|
||||
the application host). The `TracerProviderBuilder` will be able to access all
|
||||
services registered into that collection. For lifecycle management, the
|
||||
`AddOpenTelemetry` registers an [IHostedService
|
||||
](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihostedservice)
|
||||
`AddOpenTelemetry` registers an
|
||||
[IHostedService](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihostedservice)
|
||||
which is used to automatically start the `TracerProvider` when the host starts
|
||||
and the host will automatically shutdown and dispose the `TracerProvider` when
|
||||
it is shutdown.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System.Diagnostics;
|
||||
using OpenTelemetry;
|
||||
|
||||
internal class MyEnrichingProcessor : BaseProcessor<Activity>
|
||||
internal sealed class MyEnrichingProcessor : BaseProcessor<Activity>
|
||||
{
|
||||
public override void OnEnd(Activity activity)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Diagnostics;
|
|||
using System.Text;
|
||||
using OpenTelemetry;
|
||||
|
||||
internal class MyExporter : BaseExporter<Activity>
|
||||
internal sealed class MyExporter : BaseExporter<Activity>
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
|
@ -43,6 +43,7 @@ internal class MyExporter : BaseExporter<Activity>
|
|||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
Console.WriteLine($"{this.name}.Dispose({disposing})");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
using System.Diagnostics;
|
||||
using OpenTelemetry;
|
||||
|
||||
internal class MyProcessor : BaseProcessor<Activity>
|
||||
internal sealed class MyProcessor : BaseProcessor<Activity>
|
||||
{
|
||||
private readonly string name;
|
||||
|
||||
|
@ -37,6 +37,7 @@ internal class MyProcessor : BaseProcessor<Activity>
|
|||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
Console.WriteLine($"{this.name}.Dispose({disposing})");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using OpenTelemetry.Resources;
|
||||
|
||||
internal class MyResourceDetector : IResourceDetector
|
||||
internal sealed class MyResourceDetector : IResourceDetector
|
||||
{
|
||||
public Resource Detect()
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
internal class MySampler : Sampler
|
||||
internal sealed class MySampler : Sampler
|
||||
{
|
||||
public override SamplingResult ShouldSample(in SamplingParameters param)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace ExtendingTheSdk;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource DemoSource = new("OTel.Demo");
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA2000;CA1812;CA1510</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,7 +5,9 @@ using System.Diagnostics;
|
|||
using OpenTelemetry;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
public class Program
|
||||
namespace GettingStartedConsole;
|
||||
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("MyCompany.MyProduct.MyLibrary");
|
||||
|
||||
|
@ -18,9 +20,10 @@ public class Program
|
|||
|
||||
using (var activity = MyActivitySource.StartActivity("SayHello"))
|
||||
{
|
||||
int[] intArray = [1, 2, 3];
|
||||
activity?.SetTag("foo", 1);
|
||||
activity?.SetTag("bar", "Hello, World!");
|
||||
activity?.SetTag("baz", new int[] { 1, 2, 3 });
|
||||
activity?.SetTag("baz", intArray);
|
||||
activity?.SetStatus(ActivityStatusCode.Ok);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace GettingStartedJaeger;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("OpenTelemetry.Demo.Jaeger");
|
||||
|
||||
|
@ -33,13 +33,13 @@ public class Program
|
|||
{
|
||||
using (var slow = MyActivitySource.StartActivity("SomethingSlow"))
|
||||
{
|
||||
await client.GetStringAsync("https://httpstat.us/200?sleep=1000");
|
||||
await client.GetStringAsync("https://httpstat.us/200?sleep=1000");
|
||||
await client.GetStringAsync(new Uri("https://httpstat.us/200?sleep=1000")).ConfigureAwait(false);
|
||||
await client.GetStringAsync(new Uri("https://httpstat.us/200?sleep=1000")).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
using (var fast = MyActivitySource.StartActivity("SomethingFast"))
|
||||
{
|
||||
await client.GetStringAsync("https://httpstat.us/301");
|
||||
await client.GetStringAsync(new Uri("https://httpstat.us/301")).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace LinksAndParentBasedSamplerExample;
|
|||
/// links based sampler. If either of these samplers decide to sample,
|
||||
/// this composite sampler decides to sample.
|
||||
/// </summary>
|
||||
internal class LinksAndParentBasedSampler : Sampler
|
||||
internal sealed class LinksAndParentBasedSampler : Sampler
|
||||
{
|
||||
private readonly ParentBasedSampler parentBasedSampler;
|
||||
private readonly LinksBasedSampler linksBasedSampler;
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace LinksAndParentBasedSamplerExample;
|
|||
/// A non-probabilistic sampler that samples an activity if ANY of the linked activities
|
||||
/// is sampled.
|
||||
/// </summary>
|
||||
internal class LinksBasedSampler : Sampler
|
||||
internal sealed class LinksBasedSampler : Sampler
|
||||
{
|
||||
public override SamplingResult ShouldSample(in SamplingParameters samplingParameters)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace LinksAndParentBasedSamplerExample;
|
||||
|
||||
internal class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("LinksAndParentBasedSampler.Example");
|
||||
|
||||
|
@ -37,7 +37,7 @@ internal class Program
|
|||
/// Generates a list of activity links. A linked activity is sampled with a probability of 0.1.
|
||||
/// </summary>
|
||||
/// <returns>A list of links.</returns>
|
||||
private static IEnumerable<ActivityLink> GetActivityLinks(int seed)
|
||||
private static List<ActivityLink> GetActivityLinks(int seed)
|
||||
{
|
||||
var random = new Random(seed);
|
||||
var linkedActivitiesList = new List<ActivityLink>();
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -7,7 +7,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace LinksCreationWithNewRootActivitiesDemo;
|
||||
|
||||
internal class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("LinksCreationWithNewRootActivities");
|
||||
|
||||
|
@ -21,7 +21,7 @@ internal class Program
|
|||
using (var activity = MyActivitySource.StartActivity("OrchestratingActivity"))
|
||||
{
|
||||
activity?.SetTag("foo", 1);
|
||||
await DoFanoutAsync();
|
||||
await DoFanoutAsync().ConfigureAwait(false);
|
||||
|
||||
using (var nestedActivity = MyActivitySource.StartActivity("WrapUp"))
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ internal class Program
|
|||
}
|
||||
|
||||
// Wait for all tasks to complete
|
||||
await Task.WhenAll(tasks);
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
// Reset to the previous activity now that we are done with the fanout
|
||||
// This will ensure that the rest of the code executes in the context of the original activity.
|
||||
|
|
|
@ -7,7 +7,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace ReportingExceptions;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new(
|
||||
"MyCompany.MyProduct.MyLibrary");
|
||||
|
@ -27,7 +27,7 @@ public class Program
|
|||
{
|
||||
using (MyActivitySource.StartActivity("Bar"))
|
||||
{
|
||||
throw new Exception("Oops!");
|
||||
throw new InvalidOperationException("Oops!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace StratifiedSamplingByQueryTypeDemo;
|
||||
|
||||
internal class Program
|
||||
internal sealed class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("StratifiedSampling.POC");
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace StratifiedSamplingByQueryTypeDemo;
|
||||
|
||||
internal class StratifiedSampler : Sampler
|
||||
internal sealed class StratifiedSampler : Sampler
|
||||
{
|
||||
// For this POC, we have two groups.
|
||||
// 0 is the group corresponding to user-initiated queries where we want a 100% sampling rate.
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace SDKBasedSpanLevelTailSamplingSample;
|
|||
/// changed later by a span processor based on span attributes (e.g., failure) that become
|
||||
/// available only by the end of the span.
|
||||
/// </summary>
|
||||
internal class ParentBasedElseAlwaysRecordSampler : Sampler
|
||||
internal sealed class ParentBasedElseAlwaysRecordSampler : Sampler
|
||||
{
|
||||
private const double DefaultSamplingProbabilityForRootSpan = 0.1;
|
||||
private readonly ParentBasedSampler parentBasedSampler;
|
||||
|
|
|
@ -7,7 +7,7 @@ using OpenTelemetry.Trace;
|
|||
|
||||
namespace SDKBasedSpanLevelTailSamplingSample;
|
||||
|
||||
internal class Program
|
||||
internal static class Program
|
||||
{
|
||||
private static readonly ActivitySource MyActivitySource = new("SDK.TailSampling.POC");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ internal sealed class TailSamplingProcessor : BaseProcessor<Activity>
|
|||
}
|
||||
else
|
||||
{
|
||||
this.IncludeForExportIfFailedActivity(activity);
|
||||
IncludeForExportIfFailedActivity(activity);
|
||||
}
|
||||
|
||||
base.OnEnd(activity);
|
||||
|
@ -42,7 +42,7 @@ internal sealed class TailSamplingProcessor : BaseProcessor<Activity>
|
|||
// 2. Traces will not be complete: Since this sampling is at a span level, the generated trace will be partial and won't be complete.
|
||||
// For example, if another part of the call tree is successful, those spans may not be sampled in leading to a partial trace.
|
||||
// 3. If multiple exporters are used, this decision will impact all of them: https://github.com/open-telemetry/opentelemetry-dotnet/issues/3861.
|
||||
private void IncludeForExportIfFailedActivity(Activity activity)
|
||||
private static void IncludeForExportIfFailedActivity(Activity activity)
|
||||
{
|
||||
if (activity.Status == ActivityStatusCode.Error)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);CA5394;CA2000</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Examples.AspNetCore.Controllers;
|
|||
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Security.Cryptography;
|
||||
using Examples.AspNetCore;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
@ -12,10 +13,10 @@ using Microsoft.AspNetCore.Mvc;
|
|||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching",
|
||||
};
|
||||
private static readonly string[] Summaries =
|
||||
[
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
];
|
||||
|
||||
private static readonly HttpClient HttpClient = new();
|
||||
|
||||
|
@ -23,24 +24,24 @@ public class WeatherForecastController : ControllerBase
|
|||
private readonly ActivitySource activitySource;
|
||||
private readonly Counter<long> freezingDaysCounter;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger, Instrumentation instrumentation)
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger, InstrumentationSource instrumentationSource)
|
||||
{
|
||||
this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
|
||||
ArgumentNullException.ThrowIfNull(instrumentation);
|
||||
this.activitySource = instrumentation.ActivitySource;
|
||||
this.freezingDaysCounter = instrumentation.FreezingDaysCounter;
|
||||
ArgumentNullException.ThrowIfNull(instrumentationSource);
|
||||
this.activitySource = instrumentationSource.ActivitySource;
|
||||
this.freezingDaysCounter = instrumentationSource.FreezingDaysCounter;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
using var scope = this.logger.BeginScope("{Id}", Guid.NewGuid().ToString("N"));
|
||||
using var scope = this.logger.BeginIdScope(Guid.NewGuid().ToString("N"));
|
||||
|
||||
// Making an http call here to serve as an example of
|
||||
// Making a http call here to serve as an example of
|
||||
// how dependency calls will be captured and treated
|
||||
// automatically as child of incoming request.
|
||||
var res = HttpClient.GetStringAsync("http://google.com").Result;
|
||||
var res = HttpClient.GetStringAsync(new Uri("http://google.com")).Result;
|
||||
|
||||
// Optional: Manually create an activity. This will become a child of
|
||||
// the activity created from the instrumentation library for AspNetCore.
|
||||
|
@ -52,22 +53,18 @@ public class WeatherForecastController : ControllerBase
|
|||
// a manual activity using Activity.Current?.SetTag()
|
||||
using var activity = this.activitySource.StartActivity("calculate forecast");
|
||||
|
||||
var rng = new Random();
|
||||
var forecast = Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = rng.Next(-20, 55),
|
||||
Summary = Summaries[rng.Next(Summaries.Length)],
|
||||
TemperatureC = RandomNumberGenerator.GetInt32(-20, 55),
|
||||
Summary = Summaries[RandomNumberGenerator.GetInt32(Summaries.Length)],
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
// Optional: Count the freezing days
|
||||
this.freezingDaysCounter.Add(forecast.Count(f => f.TemperatureC < 0));
|
||||
|
||||
this.logger.LogInformation(
|
||||
"WeatherForecasts generated {count}: {forecasts}",
|
||||
forecast.Length,
|
||||
forecast);
|
||||
this.logger.WeatherForecastGenerated(LogLevel.Information, forecast.Length, forecast);
|
||||
|
||||
return forecast;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue