Skip to content

Commit 6dbacf5

Browse files
committed
Initial commit to upgrade with latest V2.
1 parent 8e4558d commit 6dbacf5

File tree

43 files changed

+883
-372
lines changed

Some content is hidden

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

43 files changed

+883
-372
lines changed

README.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,151 @@ Please note that as per policy, we're providing support via GitHub on a best eff
4646

4747
## Security issue notifications
4848
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
49+
50+
before spans data!!!!!!!:
51+
[SpanData{
52+
spanContext=ImmutableSpanContext{
53+
traceId=674e4054ae4f6dc29558bb93e01c88aa,
54+
spanId=b3e242267283ef6e,
55+
traceFlags=01,
56+
traceState=ArrayBasedTraceState{
57+
entries=[]},
58+
remote=false,
59+
valid=true},
60+
parentSpanContext=ImmutableSpanContext{
61+
traceId=00000000000000000000000000000000,
62+
spanId=0000000000000000,
63+
traceFlags=00,
64+
traceState=ArrayBasedTraceState{
65+
entries=[]},
66+
remote=false,
67+
valid=false},
68+
resource=Resource{
69+
schemaUrl=https://opentelemetry.io/schemas/1.24.0,
70+
attributes={
71+
aws.local.service="aws-sdk-v1",
72+
container.id="5c1a417aec8a09b7a1e687a8a8554292f7a7d383817aaf8dddd07bdacb8e691b",
73+
host.arch="amd64",
74+
host.name="5c1a417aec8a",
75+
os.description="Linux 5.10.228-198.884.amzn2int.x86_64",
76+
os.type="linux",
77+
process.command_line="/usr/lib/jvm/java-21-amazon-corretto/bin/java
78+
-javaagent:/opentelemetry-javaagent-all.jar com.amazon.sampleapp.App",
79+
process.executable.path="/usr/lib/jvm/java-21-amazon-corretto/bin/java",
80+
process.pid=1,
81+
process.runtime.description="Amazon.com Inc. OpenJDK 64-Bit Server VM 21.0.5+11-LTS",
82+
process.runtime.name="OpenJDK Runtime Environment",
83+
process.runtime.version="21.0.5+11-LTS",
84+
service.instance.id="ccb7b47f-ccd5-4cc2-b32c-034b5804694f",
85+
service.name="aws-sdk-v1",
86+
telemetry.distro.name="opentelemetry-java-instrumentation",
87+
telemetry.distro.version="1.33.0-aws-SNAPSHOT",
88+
telemetry.sdk.language="java",
89+
telemetry.sdk.name="opentelemetry",
90+
telemetry.sdk.version="1.44.1"}},
91+
instrumentationScopeInfo=InstrumentationScopeInfo{
92+
name=io.opentelemetry.jetty-8.0,
93+
version=2.10.0-alpha,
94+
schemaUrl=null,
95+
attributes={}},
96+
name=GET /s3/createbucket/:bucketname,
97+
kind=SERVER,
98+
startEpochNanos=1733181524709878370,
99+
endEpochNanos=1733181527659649586,
100+
attributes=AttributesMap{data={
101+
http.route=/s3/createbucket/:bucketname,
102+
server.port=33887,
103+
http.request.method=GET,
104+
url.path=/s3/createbucket/create-bucket, h
105+
ttp.response.status_code=200,
106+
network.peer.address=172.22.0.1,
107+
server.address=localhost,
108+
client.address=172.22.0.1,
109+
thread.id=53,
110+
url.scheme=http,
111+
thread.name=qtp901050607-53,
112+
network.protocol.version=1.1,
113+
network.peer.port=55828,
114+
user_agent.original=armeria/1.26.4},
115+
capacity=128,
116+
totalAddedValues=14},
117+
totalAttributeCount=14,
118+
events=[],
119+
totalRecordedEvents=0,
120+
links=[],
121+
totalRecordedLinks=0,
122+
status=ImmutableStatusData{statusCode=UNSET, description=},
123+
hasEnded=true}]
124+
125+
126+
after modifiedSpans data!!!!!!!:
127+
[DelegatingSpanData{spanContext=ImmutableSpanContext{
128+
traceId=674e4054ae4f6dc29558bb93e01c88aa,
129+
spanId=b3e242267283ef6e,
130+
traceFlags=01,
131+
traceState=ArrayBasedTraceState{
132+
entries=[]},
133+
remote=false,
134+
valid=true},
135+
parentSpanContext=ImmutableSpanContext{
136+
traceId=00000000000000000000000000000000,
137+
spanId=0000000000000000,
138+
traceFlags=00,
139+
traceState=ArrayBasedTraceState{
140+
entries=[]},
141+
remote=false, valid=false},
142+
resource=Resource{
143+
schemaUrl=https://opentelemetry.io/schemas/1.24.0,
144+
attributes={aws.local.service="aws-sdk-v1",
145+
container.id="5c1a417aec8a09b7a1e687a8a8554292f7a7d383817aaf8dddd07bdacb8e691b",
146+
host.arch="amd64",
147+
host.name="5c1a417aec8a",
148+
os.description="Linux 5.10.228-198.884.amzn2int.x86_64",
149+
os.type="linux",
150+
process.command_line="/usr/lib/jvm/java-21-amazon-corretto/bin/java
151+
-javaagent:/opentelemetry-javaagent-all.jar com.amazon.sampleapp.App",
152+
process.executable.path="/usr/lib/jvm/java-21-amazon-corretto/bin/java",
153+
process.pid=1,
154+
process.runtime.description="Amazon.com Inc. OpenJDK 64-Bit Server VM 21.0.5+11-LTS",
155+
process.runtime.name="OpenJDK Runtime Environment",
156+
process.runtime.version="21.0.5+11-LTS",
157+
service.instance.id="ccb7b47f-ccd5-4cc2-b32c-034b5804694f",
158+
service.name="aws-sdk-v1",
159+
telemetry.distro.name="opentelemetry-java-instrumentation",
160+
telemetry.distro.version="1.33.0-aws-SNAPSHOT",
161+
telemetry.sdk.language="java",
162+
telemetry.sdk.name="opentelemetry",
163+
telemetry.sdk.version="1.44.1"}},
164+
instrumentationScopeInfo=InstrumentationScopeInfo{
165+
name=io.opentelemetry.jetty-8.0,
166+
version=2.10.0-alpha,
167+
schemaUrl=null,
168+
attributes={}},
169+
name=GET /s3/createbucket/:bucketname,
170+
kind=SERVER,
171+
startEpochNanos=1733181524709878370,
172+
attributes={
173+
aws.local.operation="GET /s3/createbucket/:bucketname",
174+
aws.local.service="aws-sdk-v1",
175+
aws.span.kind="LOCAL_ROOT",
176+
client.address="172.22.0.1",
177+
http.request.method="GET",
178+
http.response.status_code=200,
179+
http.route="/s3/createbucket/:bucketname",
180+
network.peer.address="172.22.0.1",
181+
network.peer.port=55828,
182+
network.protocol.version="1.1",
183+
server.address="localhost",
184+
server.port=33887,
185+
thread.id=53,
186+
thread.name="qtp901050607-53",
187+
url.path="/s3/createbucket/create-bucket",
188+
url.scheme="http",
189+
user_agent.original="armeria/1.26.4"},
190+
events=[], links=[],
191+
status=ImmutableStatusData{statusCode=UNSET, description=},
192+
endEpochNanos=1733181527659649586,
193+
hasEnded=true,
194+
totalRecordedEvents=0,
195+
totalRecordedLinks=0,
196+
totalAttributeCount=17}]

appsignals-tests/contract-tests/build.gradle.kts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3333

3434
plugins {
3535
java
36-
kotlin("jvm") version "1.8.22"
36+
kotlin("jvm") version "2.1.0-RC2"
3737
}
3838

3939
java {
@@ -73,6 +73,12 @@ tasks {
7373
"-Dio.awsobservability.instrumentation.contracttests.agentPath=${otelAgentJarTask.get().archiveFile.get()
7474
.getAsFile().absolutePath}",
7575
)
76+
77+
println("Agent JAR Path!!!: ${otelAgentJarTask.get().archiveFile.get().asFile.absolutePath}")
78+
testLogging {
79+
events("passed", "skipped", "failed")
80+
showStandardStreams = true
81+
}
7682
}
7783

7884
// Disable the test task from the java plugin

appsignals-tests/contract-tests/src/test/java/software/amazon/opentelemetry/appsignals/test/awssdk/base/AwsSdkBaseTest.java

Lines changed: 56 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import java.util.List;
2424
import java.util.Map;
2525
import java.util.Set;
26+
import java.util.logging.ConsoleHandler;
27+
import java.util.logging.Level;
28+
import java.util.logging.Logger;
2629
import org.assertj.core.api.ThrowingConsumer;
2730
import org.junit.jupiter.api.AfterAll;
2831
import org.junit.jupiter.api.BeforeAll;
@@ -36,6 +39,16 @@
3639

3740
public abstract class AwsSdkBaseTest extends ContractTestBase {
3841

42+
protected static final Logger LOGGER = Logger.getLogger(AwsSdkBaseTest.class.getName());
43+
44+
static {
45+
ConsoleHandler handler = new ConsoleHandler();
46+
handler.setLevel(Level.INFO);
47+
LOGGER.addHandler(handler);
48+
LOGGER.setLevel(Level.INFO);
49+
LOGGER.setUseParentHandlers(false);
50+
}
51+
3952
private final LocalStackContainer localstack =
4053
new LocalStackContainer(DockerImageName.parse("localstack/localstack:3.5.0"))
4154
.withServices(
@@ -214,37 +227,50 @@ private void assertSemanticConventionsAttributes(
214227
List<KeyValue> attributesList,
215228
String service,
216229
String method,
217-
String peerName,
218-
int peerPort,
230+
String address,
231+
int port,
219232
String url,
220-
int statusCode) {
233+
int statusCode,
234+
String awsSpanKind) {
221235
assertThat(attributesList)
222236
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_METHOD, method))
223237
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_SERVICE, service))
224238
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_SYSTEM, "aws-api"))
225-
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_NAME, peerName))
226-
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_PORT, peerPort))
239+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_ADDRESS, address))
240+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_PORT, port))
227241
.satisfiesOnlyOnce(
228-
assertAttribute(SemanticConventionsConstants.HTTP_STATUS_CODE, statusCode))
229-
.satisfiesOnlyOnce(assertAttributeStartsWith(SemanticConventionsConstants.HTTP_URL, url))
242+
assertAttribute(SemanticConventionsConstants.HTTP_RESPONSE_STATUS_CODE, statusCode))
243+
.satisfiesOnlyOnce(assertAttributeStartsWith(SemanticConventionsConstants.URL_FULL, url))
230244
.satisfiesOnlyOnce(assertKeyIsPresent(SemanticConventionsConstants.THREAD_ID));
245+
// // Assertions based on awsSpanKind
246+
// if ("CLIENT".equals(awsSpanKind)) {
247+
// assertThat(attributesList)
248+
// .satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_ADDRESS,
249+
// address))
250+
// .satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_PORT, port));
251+
// } else if ("PRODUCER".equals(awsSpanKind)) {
252+
// assertThat(attributesList)
253+
// .satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.CLIENT_ADDRESS,
254+
// address))
255+
// .satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.CLIENT_PORT, port));
256+
// }
231257
}
232258

233259
/** All the spans of the AWS SDK Should have a RPC properties. */
234260
private void assertSemanticConventionsSqsConsumerAttributes(
235261
List<KeyValue> attributesList,
236262
String service,
237263
String method,
238-
String peerName,
239-
int peerPort,
264+
String address,
265+
int port,
240266
String url) {
241267
assertThat(attributesList)
242268
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_METHOD, method))
243269
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_SERVICE, service))
244270
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.RPC_SYSTEM, "aws-api"))
245-
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_NAME, peerName))
246-
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.NET_PEER_PORT, peerPort))
247-
.satisfiesOnlyOnce(assertAttributeStartsWith(SemanticConventionsConstants.HTTP_URL, url))
271+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_ADDRESS, address))
272+
.satisfiesOnlyOnce(assertAttribute(SemanticConventionsConstants.SERVER_PORT, port))
273+
.satisfiesOnlyOnce(assertAttributeStartsWith(SemanticConventionsConstants.URL_FULL, url))
248274
.satisfiesOnlyOnce(assertKeyIsPresent(SemanticConventionsConstants.THREAD_ID));
249275
}
250276

@@ -258,11 +284,14 @@ private void assertSpanClientAttributes(
258284
String method,
259285
String type,
260286
String identifier,
261-
String peerName,
262-
int peerPort,
287+
String address,
288+
int port,
263289
String url,
264290
int statusCode,
265291
List<ThrowingConsumer<KeyValue>> extraAssertions) {
292+
LOGGER.info("assertSpanClientAttributes!!!!!!: ");
293+
294+
LOGGER.info("Spans!!!!!!: " + spans);
266295

267296
assertSpanAttributes(
268297
spans,
@@ -276,8 +305,8 @@ private void assertSpanClientAttributes(
276305
method,
277306
type,
278307
identifier,
279-
peerName,
280-
peerPort,
308+
address,
309+
port,
281310
url,
282311
statusCode,
283312
extraAssertions);
@@ -293,8 +322,8 @@ private void assertSpanProducerAttributes(
293322
String method,
294323
String type,
295324
String identifier,
296-
String peerName,
297-
int peerPort,
325+
String address,
326+
int port,
298327
String url,
299328
int statusCode,
300329
List<ThrowingConsumer<KeyValue>> extraAssertions) {
@@ -310,8 +339,8 @@ private void assertSpanProducerAttributes(
310339
method,
311340
type,
312341
identifier,
313-
peerName,
314-
peerPort,
342+
address,
343+
port,
315344
url,
316345
statusCode,
317346
extraAssertions);
@@ -324,8 +353,8 @@ private void assertSpanConsumerAttributes(
324353
String operation,
325354
String localService,
326355
String method,
327-
String peerName,
328-
int peerPort,
356+
String address,
357+
int port,
329358
String url,
330359
int statusCode,
331360
List<ThrowingConsumer<KeyValue>> extraAssertions) {
@@ -338,7 +367,7 @@ private void assertSpanConsumerAttributes(
338367
assertThat(span.getKind()).isEqualTo(SpanKind.SPAN_KIND_CONSUMER);
339368
assertThat(span.getName()).isEqualTo(spanName);
340369
assertSemanticConventionsSqsConsumerAttributes(
341-
spanAttributes, rpcService, method, peerName, peerPort, url);
370+
spanAttributes, rpcService, method, address, port, url);
342371
assertSqsConsumerAwsAttributes(span.getAttributesList(), operation);
343372
for (var assertion : extraAssertions) {
344373
assertThat(spanAttributes).satisfiesOnlyOnce(assertion);
@@ -358,8 +387,8 @@ private void assertSpanAttributes(
358387
String method,
359388
String type,
360389
String identifier,
361-
String peerName,
362-
int peerPort,
390+
String address,
391+
int port,
363392
String url,
364393
int statusCode,
365394
List<ThrowingConsumer<KeyValue>> extraAssertions) {
@@ -372,7 +401,7 @@ private void assertSpanAttributes(
372401
assertThat(span.getKind()).isEqualTo(spanKind);
373402
assertThat(span.getName()).isEqualTo(spanName);
374403
assertSemanticConventionsAttributes(
375-
spanAttributes, rpcService, method, peerName, peerPort, url, statusCode);
404+
spanAttributes, rpcService, method, address, port, url, statusCode, awsSpanKind);
376405
assertAwsAttributes(
377406
spanAttributes,
378407
localService,
@@ -540,6 +569,7 @@ protected void assertMetricAttributes(
540569
}
541570

542571
protected void doTestS3CreateBucket() throws Exception {
572+
LOGGER.info("doTestS3CreateBucket!!!!!!: ");
543573
appClient.get("/s3/createbucket/create-bucket").aggregate().join();
544574

545575
var traces = mockCollectorClient.getTraces();

0 commit comments

Comments
 (0)