Skip to content
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

Micrometer Observation instrumentation #4980

Merged
merged 37 commits into from
Aug 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
55fa451
WIP
marcingrzejszczak Jun 21, 2023
78d62eb
WIP - context propagation tests failing
marcingrzejszczak Jun 22, 2023
ecbc899
Fixed copyrights
marcingrzejszczak Jun 22, 2023
cd72deb
fix failing tests
jrhee17 Jun 27, 2023
d3c2bc2
minor cleanups
jrhee17 Jun 27, 2023
6562ff5
minor fixes
jrhee17 Jun 27, 2023
214b6fc
remove unused spi
jrhee17 Jun 27, 2023
8018775
Applied changes from the review + added automatic docs generation
marcingrzejszczak Jun 28, 2023
b3fc09d
add documentation
jrhee17 Jun 29, 2023
8bec68e
revive scope decorator test
jrhee17 Jun 29, 2023
23f016d
expose contexts
jrhee17 Jun 29, 2023
abacc55
context is exposed publicly, more documentation
jrhee17 Jun 29, 2023
5495d42
lint
jrhee17 Jun 29, 2023
dc3ee88
add unstable annotations
jrhee17 Jun 29, 2023
ecc9eb2
Removed remote address setting
marcingrzejszczak Jun 30, 2023
c9d2e8d
Update observation/src/main/java/com/linecorp/armeria/client/observat…
jrhee17 Jul 3, 2023
e5d0a17
move observation to the core module
jrhee17 Jul 10, 2023
ff965e8
fix build failure
jrhee17 Jul 11, 2023
399bf53
remove unused test
jrhee17 Jul 11, 2023
0394860
Update core/src/main/java/com/linecorp/armeria/server/observation/Mic…
marcingrzejszczak Jul 14, 2023
340ce15
Update core/src/main/java/com/linecorp/armeria/client/observation/Mic…
marcingrzejszczak Jul 14, 2023
c7691b6
Apply suggestions from code review
marcingrzejszczak Jul 14, 2023
9a2cee0
Applied changes following the review
marcingrzejszczak Jul 14, 2023
103f564
fix failing build
jrhee17 Jul 25, 2023
d8721a6
lint
jrhee17 Jul 25, 2023
ea6930c
lint
jrhee17 Jul 25, 2023
a176311
Update core/src/main/java/com/linecorp/armeria/client/observation/Def…
marcingrzejszczak Jul 30, 2023
ee94f5f
Update core/src/main/java/com/linecorp/armeria/client/observation/Cli…
marcingrzejszczak Jul 30, 2023
c3fb07f
Update core/src/main/java/com/linecorp/armeria/client/observation/Obs…
marcingrzejszczak Jul 30, 2023
792b26e
Update core/src/main/java/com/linecorp/armeria/client/observation/Obs…
marcingrzejszczak Jul 30, 2023
26c3af5
Update core/src/main/java/com/linecorp/armeria/server/observation/Def…
marcingrzejszczak Jul 30, 2023
4e2500f
Update core/src/main/java/com/linecorp/armeria/server/observation/Obs…
marcingrzejszczak Jul 30, 2023
6d75d8b
Update core/src/main/java/com/linecorp/armeria/server/observation/Obs…
marcingrzejszczak Jul 30, 2023
202a97a
Apply suggestions from code review
marcingrzejszczak Aug 14, 2023
9653ad0
Added some javadocs + reformatted the code
marcingrzejszczak Aug 14, 2023
581ef5d
Updated toml entry for micrometer tracing
marcingrzejszczak Aug 14, 2023
868c8ea
fix build
jrhee17 Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
jrhee17 authored and marcingrzejszczak committed Aug 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit d8721a6f01ddd7d6bfa2094482c1ac424000f4ba
Original file line number Diff line number Diff line change
@@ -131,8 +131,9 @@ public HttpResponse execute(ClientRequestContext ctx, HttpRequest req) throws Ex
return observation.scopedChecked(() -> unwrap().execute(ctx, newReq));
}

private static void enrichObservation(ClientRequestContext ctx, ClientObservationContext clientObservationContext,
Observation observation) {
private static void enrichObservation(ClientRequestContext ctx,
ClientObservationContext clientObservationContext,
Observation observation) {
if (observation.isNoop()) {
// For no-op spans, we only need to inject into headers and don't set any other attributes.
return;
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ public KeyValues getLowCardinalityKeyValues(ServiceObservationContext context) {
serializationFormat = LowCardinalityKeys.HTTP_SERIALIZATION_FORMAT.withValue(serFmt);
}
}
ImmutableList.Builder<KeyValue> builder = ImmutableList.builderWithExpectedSize(expectedSize);
final ImmutableList.Builder<KeyValue> builder = ImmutableList.builderWithExpectedSize(expectedSize);
builder.add(LowCardinalityKeys.HTTP_METHOD.withValue(ctx.method().name()));
addIfNotNull(protocol, builder);
addIfNotNull(statusCode, builder);
@@ -104,9 +104,10 @@ public KeyValues getHighCardinalityKeyValues(ServiceObservationContext context)
error = HighCardinalityKeys.ERROR.withValue(log.responseStatus().codeAsText());
}
}
ImmutableList.Builder<KeyValue> builder = ImmutableList.builderWithExpectedSize(expectedSize);
final ImmutableList.Builder<KeyValue> builder = ImmutableList.builderWithExpectedSize(expectedSize);
builder.add(HighCardinalityKeys.HTTP_PATH.withValue(ctx.path()),
HighCardinalityKeys.HTTP_HOST.withValue(firstNonNull(context.httpRequest().authority(), "UNKNOWN")),
HighCardinalityKeys.HTTP_HOST.withValue(firstNonNull(context.httpRequest().authority(),
"UNKNOWN")),
HighCardinalityKeys.HTTP_URL.withValue(ctx.uri().toString()));
addIfNotNull(addressRemote, builder);
addIfNotNull(addressLocal, builder);
Original file line number Diff line number Diff line change
@@ -133,7 +133,8 @@ public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exc
return observation.scopedChecked(() -> unwrap().serve(ctx, req));
}

private void enrichObservation(ServiceRequestContext ctx, ServiceObservationContext serviceObservationContext,
private void enrichObservation(ServiceRequestContext ctx,
ServiceObservationContext serviceObservationContext,
Observation observation) {
if (observation.isNoop()) {
// For no-op spans, we only need to inject into headers and don't set any other attributes.
@@ -142,7 +143,8 @@ private void enrichObservation(ServiceRequestContext ctx, ServiceObservationCont

ctx.log()
.whenAvailable(RequestLogProperty.REQUEST_FIRST_BYTES_TRANSFERRED_TIME)
.thenAccept(requestLog -> observation.event(HttpServiceObservationDocumentation.Events.WIRE_RECEIVE));
.thenAccept(requestLog -> observation.event(
HttpServiceObservationDocumentation.Events.WIRE_RECEIVE));

ctx.log()
.whenAvailable(RequestLogProperty.RESPONSE_FIRST_BYTES_TRANSFERRED_TIME)