-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Udp release workflow #1049
Open
Jeel-mehta
wants to merge
66
commits into
main
Choose a base branch
from
udp-release-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Udp release workflow #1049
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
9bae8df
Contribute OTLP UDP Exporter
3dbbae0
Fixing formatting issues
57cf7b3
Adding additional check to SpanExporterBuilder to see if we are alrea…
c8580e2
Adding the unit test for Lambda environment variables and fixing the …
6fb094a
Removing the redundant dependencies
37bf040
Adding the release workflow of UDP exporter and also the sample appli…
77bfd1b
Adding workflow to run on push to create it and run it
418cd43
Changing java version to 17 make it compatible with gradle 8.10
0c68acf
Readjusting the build commands according to directories
e051cc1
Fixing dependencies and changes to workflow
e5380f7
Renaming the package name and making changes to path respectively
1041d4f
Merge branch 'contribute-udp-exporter' into udp-release-workflow
c795fde
Trying to run the gradlew command only in the project directory
292792f
Trying to publish package to mavenlocal in the same directory of project
3e828d2
Testing without building dependency management
e761605
Adding debug to check dependency tree
9fe8eef
Testing it with initializing the local patch
d3f6ca3
test
fb1e818
Testing it with local patch
e7457c4
Trying to publish it to Maven Local without signing
371854f
Testing to publish a package without signing it
3050541
Updating dependencies after the change of naming convention
fab437c
Setting the endpoint correctly
a6c9a92
Updating the version of opentelemetry-bom to match with our lambda layer
c8cf516
Merge branch 'contribute-udp-exporter' into udp-release-workflow
66ee0ec
Just adding refresh dependencies flag to maintain consistency with ou…
2c570a9
removing setting up local m2 repository
425b62b
Updating the bom path
a24e2a5
Reverting back to actual bom dependency
497cb9d
Merge branch 'contribute-udp-exporter' into udp-release-workflow
f8ef822
Merge branch 'main' into udp-release-workflow
yiyuan-he e1889b0
Removing exporter from our rott folder settings.gradle file and addin…
15e8fb8
Merge branch 'contribute-udp-exporter' into udp-release-workflow
8453853
Adding separate settings.gradle.kts file for the sample app and remov…
ca3e1d6
Updating the build.gradle file
21b44e4
Merge branch 'contribute-udp-exporter' into udp-release-workflow
ac7f7e1
Refactoring the workflow file
b46392f
Removing license comment
23e8f27
Merge branch 'contribute-udp-exporter' into udp-release-workflow
7c5a95e
Removing the license comment
65c0595
Adding the bom-dpendency in sample app
b4460e3
Removing the test part for workflow as gradle build already takes car…
cfd4533
Removing the proto dependency and testing it
fce6f40
Merge branch 'contribute-udp-exporter' into udp-release-workflow
a5057df
Changing the bom dependency
b48eb35
Merge branch 'contribute-udp-exporter' into udp-release-workflow
a1753a2
Changing certain dependencies from implementation to compilOnly and t…
f595ab6
Merge branch 'contribute-udp-exporter' into udp-release-workflow
09102ea
Testing with changing dependency of compileOnly to testImplementation
3933da2
Merge branch 'contribute-udp-exporter' into udp-release-workflow
85d21b9
Reverting back the dependencies from testImplementation to implementa…
aca8509
Merge branch 'contribute-udp-exporter' into udp-release-workflow
838a1e3
Testing the same dependencies with both compileOnly and testImplement…
66a34cf
Merge branch 'contribute-udp-exporter' into udp-release-workflow
7497784
Adding OTLP dependency to my sample app build file
507f227
Fixing redundant code in OtlpUdpSpanExporterBuilder file to make a pr…
73587dd
Merge branch 'contribute-udp-exporter' into udp-release-workflow
cb03efd
Fixing the dependency
9bff25a
Test1
41e00ff
Changing the file and directory names acoording to new naming convent…
36a0a81
Merge branch 'contribute-udp-exporter' into udp-release-workflow
993daeb
Making the name and directory name changes to files in this PR
97c060d
Making minor changes
da45a57
Test
2eec48e
Testing1
5eebd18
Making the final name change
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Release ADOT OTLP UDP Exporter | ||
|
||
on: | ||
push: | ||
branches: | ||
- "udp-*" | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version number for deployment e.g. 0.0.1' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
build-test-publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' # or your preferred version | ||
distribution: 'temurin' | ||
cache: 'gradle' # Add gradle caching | ||
|
||
- name: Build, Test and Publish UDP exporter | ||
working-directory: exporters/aws-opentelemetry-xray-udp-span-exporter | ||
run: | | ||
gradle build | ||
gradle publishToMavenLocal | ||
|
||
- name: Download and run X-Ray Daemon | ||
run: | | ||
mkdir xray-daemon | ||
cd xray-daemon | ||
wget https://s3.us-west-2.amazonaws.com/aws-xray-assets.us-west-2/xray-daemon/aws-xray-daemon-linux-3.x.zip | ||
unzip aws-xray-daemon-linux-3.x.zip | ||
./xray -o -n us-west-2 -f ./daemon-logs.log --log-level debug & | ||
|
||
- name: Run Sample App in Background | ||
working-directory: sample-apps/integ-test-app | ||
run: | | ||
gradle build | ||
java -jar build/libs/integ-test-app.jar & | ||
sleep 5 | ||
|
||
- name: Call Sample App Endpoint | ||
run: | | ||
echo "traceId=$(curl localhost:8080/test)" >> $GITHUB_OUTPUT | ||
|
||
- name: Verify X-Ray daemon received traces | ||
run: | | ||
sleep 10 | ||
echo "X-Ray daemon logs:" | ||
cat xray-daemon/daemon-logs.log | ||
|
||
# Check if the daemon received and processed some data | ||
if grep -q "sending.*batch" xray-daemon/daemon-logs.log; then | ||
echo "✅ X-Ray daemon processed trace data (AWS upload errors are expected)" | ||
exit 0 | ||
elif grep -q "processor:.*segment" xray-daemon/daemon-logs.log; then | ||
echo "✅ X-Ray daemon processed segment data (AWS upload errors are expected)" | ||
exit 0 | ||
else | ||
echo "❌ No evidence of traces being received by X-Ray daemon" | ||
exit 1 | ||
fi | ||
|
||
# TODO: Steps to publish to Maven Central | ||
# - name: Publish to Maven Central | ||
# env: | ||
# MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
# MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
# working-directory: exporters/aws-otel-otlp-udp-exporter | ||
# run: ../../gradlew publish |
101 changes: 101 additions & 0 deletions
101
exporters/aws-opentelemetry-xray-udp-span-exporter/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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. | ||
*/ | ||
|
||
plugins { | ||
id("java") | ||
id("java-library") | ||
id("maven-publish") | ||
} | ||
|
||
group = "software.amazon.distro.opentelemetry.exporter.xray.udp.trace" | ||
version = "0.1.0" | ||
|
||
dependencies { | ||
implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom:2.10.0")) | ||
compileOnly("io.opentelemetry:opentelemetry-api") | ||
compileOnly("io.opentelemetry:opentelemetry-sdk") | ||
compileOnly("io.opentelemetry:opentelemetry-exporter-otlp-common") | ||
compileOnly("com.google.code.findbugs:jsr305:3.0.2") | ||
testImplementation("io.opentelemetry:opentelemetry-api") | ||
testImplementation("io.opentelemetry:opentelemetry-sdk") | ||
testImplementation("io.opentelemetry:opentelemetry-exporter-otlp-common") | ||
testImplementation(platform("org.junit:junit-bom:5.9.2")) | ||
testImplementation("org.junit.jupiter:junit-jupiter-api") | ||
testImplementation("org.junit.jupiter:junit-jupiter-engine") | ||
testImplementation("org.mockito:mockito-core:5.3.1") | ||
testImplementation("org.assertj:assertj-core:3.24.2") | ||
testImplementation("org.mockito:mockito-junit-jupiter:5.3.1") | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
} | ||
|
||
tasks.javadoc { | ||
options { | ||
(this as CoreJavadocOptions).addStringOption("Xdoclint:none", "-quiet") | ||
} | ||
isFailOnError = false | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDirs("src/main/java") | ||
} | ||
} | ||
test { | ||
java { | ||
srcDirs("src/test/java") | ||
} | ||
} | ||
} | ||
|
||
tasks.test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
} | ||
} | ||
|
||
tasks.jar { | ||
manifest { | ||
attributes( | ||
"Implementation-Title" to project.name, | ||
"Implementation-Version" to project.version, | ||
) | ||
} | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
tasks.named<Jar>("javadocJar") { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
tasks.named<Jar>("sourcesJar") { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
groupId = project.group.toString() | ||
artifactId = "aws-opentelemetry-xray-udp-span-exporter" | ||
version = project.version.toString() | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
exporters/aws-opentelemetry-xray-udp-span-exporter/settings.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
rootProject.name = "aws-opentelemetry-xray-udp-span-exporter" | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
|
||
maven { | ||
setUrl("https://oss.sonatype.org/content/repositories/snapshots") | ||
} | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
.../software/amazon/distro/opentelemetry/exporter/xray/udp/trace/AwsXrayUdpSpanExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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. | ||
*/ | ||
|
||
package software.amazon.distro.opentelemetry.exporter.xray.udp.trace; | ||
|
||
import io.opentelemetry.exporter.internal.otlp.traces.TraceRequestMarshaler; | ||
import io.opentelemetry.sdk.common.CompletableResultCode; | ||
import io.opentelemetry.sdk.trace.data.SpanData; | ||
import io.opentelemetry.sdk.trace.export.SpanExporter; | ||
import java.io.ByteArrayOutputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Base64; | ||
import java.util.Collection; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
import javax.annotation.concurrent.Immutable; | ||
|
||
/** | ||
* Exports spans via UDP, using OpenTelemetry's protobuf model. The protobuf modelled spans are | ||
* Base64 encoded and prefixed with AWS X-Ray specific information before being sent over to {@link | ||
* UdpSender}. | ||
* | ||
* <p>This exporter is NOT meant for generic use since the payload is prefixed with AWS X-Ray | ||
* specific information. | ||
*/ | ||
@Immutable | ||
public class AwsXrayUdpSpanExporter implements SpanExporter { | ||
|
||
private static final Logger logger = Logger.getLogger(AwsXrayUdpSpanExporter.class.getName()); | ||
|
||
private final AtomicBoolean isShutdown = new AtomicBoolean(); | ||
|
||
private final UdpSender sender; | ||
private final String payloadPrefix; | ||
|
||
AwsXrayUdpSpanExporter(UdpSender sender, String payloadPrefix) { | ||
this.sender = sender; | ||
this.payloadPrefix = payloadPrefix; | ||
} | ||
|
||
@Override | ||
public CompletableResultCode export(Collection<SpanData> spans) { | ||
if (isShutdown.get()) { | ||
return CompletableResultCode.ofFailure(); | ||
} | ||
|
||
TraceRequestMarshaler exportRequest = TraceRequestMarshaler.create(spans); | ||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||
try { | ||
exportRequest.writeBinaryTo(baos); | ||
String payload = payloadPrefix + Base64.getEncoder().encodeToString(baos.toByteArray()); | ||
sender.send(payload.getBytes(StandardCharsets.UTF_8)); | ||
return CompletableResultCode.ofSuccess(); | ||
} catch (Exception e) { | ||
logger.log(Level.SEVERE, "Failed to export spans. Error: " + e.getMessage(), e); | ||
return CompletableResultCode.ofFailure(); | ||
} | ||
} | ||
|
||
@Override | ||
public CompletableResultCode flush() { | ||
// TODO: implement | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
|
||
@Override | ||
public CompletableResultCode shutdown() { | ||
if (!isShutdown.compareAndSet(false, true)) { | ||
logger.log(Level.INFO, "Calling shutdown() multiple times."); | ||
return CompletableResultCode.ofSuccess(); | ||
} | ||
return sender.shutdown(); | ||
} | ||
|
||
// Visible for testing | ||
UdpSender getSender() { | ||
return sender; | ||
} | ||
|
||
// Visible for testing | ||
String getPayloadPrefix() { | ||
return payloadPrefix; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this once we are done with local testing. It shouldn't be included in the actual workflow.