Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit d9043db

Browse files
feat: System.Diagnostics Tracing Hook (#196)
This commit adds support for an System.Diagnostics Tracing hook, using the existing Hooks API. It can be used with OpenTelemetry to instrument the SDK. BEGIN_COMMIT_OVERRIDE feat: add support for a Tracing hook implemented via System.Diagnostics, compatible with OpenTelemetry chore: refactor repo to contain separate base SDK and Telemetry projects END_COMMIT_OVERRIDE --------- Co-authored-by: Todd Anderson <127344469+tanderson-ld@users.noreply.github.com>
1 parent 7870a6e commit d9043db

File tree

265 files changed

+1055
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+1055
-261
lines changed
Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
name: Build Documentation
22
description: 'Build Documentation.'
3+
inputs:
4+
workspace_path:
5+
description: 'Path to the workspace.'
6+
required: true
37

48
runs:
59
using: composite
610
steps:
11+
- name: Setup dotnet build tools
12+
uses: actions/setup-dotnet@v4
13+
with:
14+
dotnet-version: 6.0
715
- name: Install docfx
816
shell: bash
917
run: dotnet tool update -g docfx
10-
- name: Run docfx metadata
11-
shell: bash
12-
run: docfx metadata
13-
- name: Run docfx build
18+
19+
# Note: in the docfx.json file, the 'Configuration' property is set to Debug so that we don't require
20+
# signing to happen just to build docs.
21+
- name: Build docs
1422
shell: bash
15-
# Note: in the docfx.json file, the 'Configuration' property is set to Debug so that we don't require
16-
# signing to happen just to build docs.
17-
run: docfx build
23+
run: |
24+
pushd ${{ inputs.workspace_path }}
25+
docfx metadata
26+
docfx build
27+
popd

.github/actions/build-release/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Build Action
22
description: 'Dotnet Server SDK Build action.'
3+
inputs:
4+
project_file:
5+
description: 'Path to the project file.'
6+
required: true
37

48
runs:
59
using: composite
@@ -15,4 +19,4 @@ runs:
1519

1620
- name: Build
1721
shell: bash
18-
run: dotnet build /p:Configuration=Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
22+
run: dotnet build /p:Configuration=Release ${{ inputs.project_file }}

.github/actions/ci/action.yml

Lines changed: 12 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
name: CI
22
description: Runs CI for the .NET Server SDK
33
inputs:
4-
run_tests:
5-
description: 'If true, run unit tests, otherwise skip them.'
4+
project_file:
5+
description: 'Path to the project file.'
6+
required: true
7+
test_project_file:
8+
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
69
required: false
7-
default: 'true'
8-
run_contract_tests:
9-
description: 'If true, run contract tests, otherwise skip them.'
10-
required: false
11-
default: 'true'
12-
aws_role_arn:
13-
description: 'The ARN of the role to assume for downloading secrets, used for building docs.'
14-
required: false
15-
default: ''
16-
token:
17-
description: 'Github token, used for contract tests'
18-
required: false
19-
default: ''
2010

2111
runs:
2212
using: composite
@@ -28,41 +18,23 @@ runs:
2818

2919
- name: Restore Dependencies
3020
shell: bash
31-
run: dotnet restore src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
21+
run: dotnet restore ${{ inputs.project_file }}
3222

3323
- name: Build for NetStandard2.0
3424
shell: bash
35-
run: dotnet build -p:Configuration=debug -p:TargetFramework=netstandard2.0 src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
25+
run: dotnet build -p:Configuration=debug -p:TargetFramework=netstandard2.0 ${{ inputs.project_file }}
3626

3727
- name: Build for Net6
3828
shell: bash
39-
run: dotnet build -p:Configuration=debug -p:TargetFramework=net6.0 src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
29+
run: dotnet build -p:Configuration=debug -p:TargetFramework=net6.0 ${{ inputs.project_file }}
4030

4131
- name: Build for Net462
4232
shell: bash
43-
run: dotnet build -p:Configuration=debug -p:TargetFramework=net462 src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
33+
run: dotnet build -p:Configuration=debug -p:TargetFramework=net462 ${{ inputs.project_file }}
4434

4535
- name: Run Unit Tests for Net6
46-
if: ${{ inputs.run_tests == 'true' }}
36+
if: ${{ inputs.test_project_file != '' }}
4737
shell: bash
4838
run: |
49-
dotnet restore test/LaunchDarkly.ServerSdk.Tests
50-
dotnet test --framework=net6.0 test/LaunchDarkly.ServerSdk.Tests/LaunchDarkly.ServerSdk.Tests.csproj
51-
52-
- name: Build Contract Tests
53-
if: ${{ inputs.run_contract_tests == 'true' }}
54-
shell: bash
55-
run: dotnet build /p:Configuration=debug contract-tests/TestService.csproj
56-
57-
- name: Launch Contract Tests
58-
if: ${{ inputs.run_contract_tests == 'true' }}
59-
id: launch-contract-tests
60-
shell: bash
61-
run: dotnet contract-tests/bin/debug/net6.0/ContractTestService.dll > test-service.log 2>&1 & disown
62-
63-
- name: Run Contract Tests
64-
if: ${{ inputs.run_contract_tests == 'true' }}
65-
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.0
66-
with:
67-
test_service_port: 8000
68-
token: ${{ inputs.token }}
39+
dotnet restore ${{ inputs.test_project_file }}
40+
dotnet test --framework=net6.0 ${{ inputs.test_project_file }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Contract Tests
2+
description: Runs CI for the .NET Server SDK
3+
inputs:
4+
service_project_file:
5+
description: 'Path to the contract test service project file.'
6+
required: true
7+
service_dll_file:
8+
description: 'Path where compiled dll will be found.'
9+
required: true
10+
token:
11+
description: 'Github token, used for contract tests'
12+
required: false
13+
default: ''
14+
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Setup dotnet build tools
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: 6.0
22+
23+
- name: Build Contract Tests
24+
shell: bash
25+
run: dotnet build /p:Configuration=debug ${{ inputs.service_project_file }}
26+
27+
- name: Launch Contract Tests
28+
id: launch-contract-tests
29+
shell: bash
30+
run: dotnet ${{ inputs.service_dll_file }} > test-service.log 2>&1 & disown
31+
32+
- name: Run Contract Tests
33+
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.0
34+
with:
35+
test_service_port: 8000
36+
token: ${{ inputs.token }}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build, Test, and Publish
2+
description: 'Execute the full release process for a workspace.'
3+
inputs:
4+
workspace_path:
5+
description: 'Path to the workspace being released.'
6+
required: true
7+
project_file:
8+
description: 'Path to the project file.'
9+
required: true
10+
test_project_file:
11+
description: 'Path to the test project file. If provided, run unit tests, otherwise skip them.'
12+
required: false
13+
build_output_path:
14+
description: 'Build output path.'
15+
required: true
16+
dll_name:
17+
description: 'Build output dll name.'
18+
required: true
19+
dry_run:
20+
description: 'Is this a dry run. If so no package will be published.'
21+
type: boolean
22+
required: true
23+
24+
runs:
25+
using: composite
26+
steps:
27+
- name: CI check
28+
uses: ./.github/actions/ci
29+
with:
30+
project_file: ${{ inputs.project_file }}
31+
test_project_file: ${{ inputs.test_project_file }}
32+
33+
- uses: launchdarkly/gh-actions/actions/release-secrets@release-secrets-v1.1.0
34+
name: Get secrets
35+
with:
36+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
37+
ssm_parameter_pairs: '/production/common/releasing/digicert/host = DIGICERT_HOST,
38+
/production/common/releasing/digicert/api_key = DIGICERT_API_KEY,
39+
/production/common/releasing/digicert/client_cert_file_b64 = DIGICERT_CLIENT_CERT_FILE_B64,
40+
/production/common/releasing/digicert/client_cert_password = DIGICERT_CLIENT_CERT_PASSWORD,
41+
/production/common/releasing/digicert/code_signing_cert_sha1_hash = DIGICERT_CODE_SIGNING_CERT_SHA1_HASH'
42+
s3_path_pairs: 'launchdarkly-releaser/dotnet/LaunchDarkly.snk = LaunchDarkly.snk'
43+
44+
- name: Release build
45+
uses: ./.github/actions/build-release
46+
with:
47+
project_file: pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj
48+
49+
- name: Sign DLLs
50+
uses: launchdarkly/gh-actions/actions/sign-dlls@sign-dlls-v1.0.0
51+
with:
52+
build_output_path: ${{ inputs.build_output_path }}
53+
dll_name: ${{ inputs.dll_name }}
54+
55+
- name: Publish Nupkg
56+
uses: ./.github/actions/publish-package
57+
with:
58+
dry_run: ${{ inputs.dry_run }}
59+
60+
- name: Build Documentation
61+
uses: ./.github/actions/build-docs
62+
with:
63+
workspace_path: ${{ inputs.workspace_path }}
64+
65+
- name: Publish Documentation
66+
uses: ./.github/actions/publish-docs
67+
with:
68+
workspace_path: ${{ inputs.workspace_path }}
69+
token: ${{secrets.GITHUB_TOKEN}}

.github/actions/publish-docs/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Publish Documentation
22
description: 'Publish the documentation to Github pages'
33
inputs:
4+
workspace_path:
5+
description: 'Path to the workspace being released.'
6+
required: true
47
token:
58
description: 'Token to use for publishing.'
69
required: true
@@ -11,5 +14,5 @@ runs:
1114
- uses: launchdarkly/gh-actions/actions/publish-pages@publish-pages-v1.0.1
1215
name: 'Publish to Github pages'
1316
with:
14-
docs_path: docs
17+
docs_path: ${{ inputs.workspace_path }}/docs
1518
github_token: ${{ inputs.token }}

.github/actions/publish-package/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Publish Package
22
description: 'Packs DLLs into unsigned Nuget package and publishes to Nuget.'
33
inputs:
4+
project_file:
5+
description: 'Path to the project file.'
6+
required: true
47
dry_run:
58
description: 'Is this a dry run. If so no package will be published.'
69
required: true
@@ -12,7 +15,7 @@ runs:
1215
shell: bash
1316
run: |
1417
dotnet restore
15-
dotnet pack --no-build --output nupkgs --configuration Release src/LaunchDarkly.ServerSdk/LaunchDarkly.ServerSdk.csproj
18+
dotnet pack --no-build --output nupkgs --configuration Release ${{ inputs.project_file }}
1619
1720
- name: Publish Package
1821
if: ${{ inputs.dry_run == 'false' }}

.github/workflows/ci.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Manual Publish Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
pkg_name:
6+
description: 'The package to publish'
7+
required: true
8+
type: choice
9+
options:
10+
- LaunchDarkly.ServerSdk
11+
- LaunchDarkly.ServerSdk.Telemetry
12+
dry_run:
13+
description: 'Is this a dry run. If so no package will be published.'
14+
type: boolean
15+
required: true
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
id-token: write
22+
contents: write
23+
steps:
24+
- uses: ./.github/workflows/full-release.yml
25+
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk' }}
26+
with:
27+
workspace_path: 'pkgs/sdk/server'
28+
project_file: 'pkgs/sdk/server/src/LaunchDarkly.ServerSdk.csproj'
29+
test_project_file: 'pkgs/sdk/server/test/LaunchDarkly.ServerSdk.Tests.csproj'
30+
build_output_path: 'pkgs/sdk/server/src/bin/Release/'
31+
dll_name: 'LaunchDarkly.ServerSdk.dll'
32+
dry_run: false
33+
34+
- uses: ./.github/workflows/full-release.yml
35+
if: ${{ inputs.pkg_name == 'LaunchDarkly.ServerSdk.Telemetry' }}
36+
with:
37+
workspace_path: 'pkgs/telemetry'
38+
project_file: 'pkgs/telemetry/src/LaunchDarkly.ServerSdk.Telemetry.csproj'
39+
test_project_file: 'pkgs/telemetry/test/LaunchDarkly.ServerSdk.Telemetry.Tests.csproj'
40+
build_output_path: 'pkgs/telemetry/src/bin/Release/'
41+
dll_name: 'LaunchDarkly.ServerSdk.Telemetry.dll'
42+
dry_run: false

0 commit comments

Comments
 (0)