Skip to content

Commit c808f7c

Browse files
authored
feat: Otel TracingHook implementation and repo skeleton (#1)
**Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [x] I have validated my changes against all supported platform versions **Related issues** 236794 **Describe the solution you've provided** Implementation of SDK Hook interface that records spans and events for feature flag evaluations using the OpenTelemetry API.
1 parent 17bf47d commit c808f7c

30 files changed

+1155
-0
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Support request
4+
url: https://support.launchdarkly.com/hc/en-us/requests/new
5+
about: File your support requests with LaunchDarkly's support team
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: 'Bug report for the java-server-sdk-otel package'
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'package: java-server-sdk-otel, bug'
6+
assignees: ''
7+
---
8+
9+
**Is this a support request?**
10+
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing [email protected].
11+
12+
Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
13+
14+
**Describe the bug**
15+
A clear and concise description of what the bug is.
16+
17+
**To reproduce**
18+
Steps to reproduce the behavior.
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Logs**
24+
If applicable, add any log output related to your problem.
25+
26+
**SDK version**
27+
The version of this SDK that you are using.
28+
29+
**Language version, developer tools**
30+
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.
31+
32+
**OS/platform**
33+
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.
34+
35+
**Additional context**
36+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request for the java-server-sdk-otel package
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'package: java-server-sdk-otel, enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.

.github/actions/ci/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is a composite to allow sharing these steps into other workflows.
2+
# It isn't a shared workflow, because then it isn't convenient to add
3+
# additional package specific steps.
4+
name: Shared CI Workflow
5+
inputs:
6+
workspace_path:
7+
description: 'Path to the package.'
8+
required: true
9+
run_tests:
10+
description: 'If true, run unit tests, otherwise skip them.'
11+
required: false
12+
default: 'true'
13+
java_version:
14+
description: 'The Java version to use.'
15+
required: true
16+
java_distribution:
17+
description: 'The Java distribution to use.'
18+
required: false
19+
default: 'temurin'
20+
21+
runs:
22+
using: composite
23+
steps:
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: ${{ inputs.java_distribution }}
28+
java-version: ${{ inputs.java_version }}
29+
30+
- name: Restore dependencies
31+
shell: bash
32+
id: restore
33+
run: ${{ inputs.workspace_path }}/gradlew dependencies -p ${{ inputs.workspace_path }}
34+
35+
- name: Build
36+
shell: bash
37+
id: build
38+
run: ${{ inputs.workspace_path }}/gradlew jar -p ${{ inputs.workspace_path }}
39+
40+
- name: Run Tests
41+
if: steps.build.outcome == 'success' && inputs.run_tests == 'true'
42+
shell: bash
43+
run: ${{ inputs.workspace_path }}/gradlew test -p ${{ inputs.workspace_path }}

.github/actions/publish/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Package
2+
description: 'Publish the package to Sonatype'
3+
inputs:
4+
workspace_path:
5+
description: 'Path to the workspace.'
6+
required: true
7+
dry_run:
8+
description: 'Is this a dry run. If so no package will be published.'
9+
required: true
10+
prerelease:
11+
description: 'Is this a prerelease. If so then it will be published to the staging repository only.'
12+
required: true
13+
signing_key_id:
14+
description: 'Signing key ID'
15+
required: true
16+
signing_key_passphrase:
17+
description: 'Signing key passphrase'
18+
required: true
19+
code_signing_keyring:
20+
description: 'The path of the code signing keyring.'
21+
required: true
22+
sonatype_username:
23+
description: 'Sonatype repo username.'
24+
required: true
25+
sonatype_password:
26+
description: 'Sonatype repo password.'
27+
required: true
28+
29+
runs:
30+
using: composite
31+
steps:
32+
- name: Publish Library
33+
shell: bash
34+
env:
35+
WORKSPACE_PATH: ${{ inputs.workspace_path }}
36+
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
37+
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry_run }}
38+
SIGNING_KEY_ID: ${{ inputs.signing_key_id }}
39+
SIGNING_KEY_PASSPHRASE: ${{ inputs.signing_key_passphrase }}
40+
SIGNING_SECRET_KEY_RING_FILE: ${{ inputs.code_signing_keyring }}
41+
SONATYPE_USER_NAME: ${{ inputs.sonatype_username }}
42+
SONATYPE_PASSWORD: ${{ inputs.sonatype_password }}
43+
run: source $GITHUB_ACTION_PATH/publish.sh

.github/actions/publish/publish.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -ue
4+
5+
if $LD_RELEASE_IS_DRYRUN ; then
6+
echo "Doing a dry run of publishing."
7+
else
8+
echo "Publishing to Sonatype"
9+
if [ "${LD_RELEASE_IS_PRERELEASE}" == "true" ]; then
10+
echo "PRERELEASE"
11+
${WORKSPACE_PATH}/gradlew publishToSonatype -p ${WORKSPACE_PATH} -Psigning.keyId="${SIGNING_KEY_ID}" -Psigning.password="${SIGNING_KEY_PASSPHRASE}" -Psigning.secretKeyRingFile="${SIGNING_SECRET_KEY_RING_FILE}" -PsonatypeUsername="${SONATYPE_USER_NAME}" -PsonatypePassword="${SONATYPE_PASSWORD}" || {
12+
echo "Gradle publish/release failed" >&2
13+
exit 1
14+
}
15+
else
16+
echo "RELEASE"
17+
${WORKSPACE_PATH}/gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -p ${WORKSPACE_PATH} -Psigning.keyId="${SIGNING_KEY_ID}" -Psigning.password="${SIGNING_KEY_PASSPHRASE}" -Psigning.secretKeyRingFile="${SIGNING_SECRET_KEY_RING_FILE}" -PsonatypeUsername="${SONATYPE_USER_NAME}" -PsonatypePassword="${SONATYPE_PASSWORD}" || {
18+
echo "Gradle publish/release failed" >&2
19+
exit 1
20+
}
21+
fi
22+
fi

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
**Requirements**
2+
3+
- [ ] I have added test coverage for new or changed functionality
4+
- [ ] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
5+
- [ ] I have validated my changes against all supported platform versions
6+
7+
**Related issues**
8+
9+
Provide links to any issues in this repository or elsewhere relating to this pull request.
10+
11+
**Describe the solution you've provided**
12+
13+
Provide a clear and concise description of what you expect to happen.
14+
15+
**Describe alternatives you've considered**
16+
17+
Provide a clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
21+
Add any other context about the pull request here.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: java-server-sdk-otel
2+
3+
on:
4+
push:
5+
branches: [main, 'feat/**']
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, 'feat/**']
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test-java-server-sdk-otel:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Shared CI Steps
20+
uses: ./.github/actions/ci
21+
with:
22+
workspace_path: 'lib/java-server-sdk-otel'
23+
java_version: 8

.github/workflows/lint-pr-title.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
name: Verify the PR title matches conventional commit spec.
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: amannn/action-semantic-pull-request@v5
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/manual-publish.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish Package
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
workspace_path:
6+
description: 'The workspace to publish'
7+
required: true
8+
type: choice
9+
options:
10+
- lib/libotel
11+
prerelease:
12+
description: 'Is this a prerelease.'
13+
type: boolean
14+
required: true
15+
dry_run:
16+
description: 'Is this a dry run. If so no package will be published.'
17+
type: boolean
18+
required: true
19+
run_tests:
20+
description: 'If true, run unit tests, otherwise skip them.'
21+
type: boolean
22+
default: true
23+
24+
jobs:
25+
build-and-publish:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
id-token: write
29+
contents: read
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Shared CI Steps
34+
uses: ./.github/actions/ci
35+
with:
36+
workspace_path: ${{ inputs.workspace_path }}
37+
java_version: 8
38+
39+
- uses: launchdarkly/gh-actions/actions/[email protected]
40+
name: Get secrets
41+
with:
42+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
43+
ssm_parameter_pairs: '/production/common/releasing/sonatype/username = SONATYPE_USER_NAME,
44+
/production/common/releasing/sonatype/password = SONATYPE_PASSWORD,
45+
/production/common/releasing/android_code_signing/private_key_id = SIGNING_KEY_ID,
46+
/production/common/releasing/android_code_signing/private_key_passphrase = SIGNING_KEY_PASSPHRASE'
47+
s3_path_pairs: 'launchdarkly-releaser/android/code-signing-keyring.gpg = code-signing-keyring.gpg'
48+
49+
- name: Publish
50+
uses: ./.github/actions/publish
51+
with:
52+
workspace_path: ${{ inputs.workspace_path }}
53+
dry_run: ${{ inputs.dry_run }}
54+
prerelease: ${{ inputs.prerelease }}
55+
code_signing_keyring: 'code-signing-keyring.gpg'

0 commit comments

Comments
 (0)