Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class GrpcClientObservationContext extends RequestReplySenderContext<Meta
@Nullable
private Code statusCode;

private String authority;

public GrpcClientObservationContext(Setter<Metadata> setter) {
super(setter);
}
Expand Down Expand Up @@ -88,4 +90,12 @@ public void setStatusCode(Code statusCode) {
this.statusCode = statusCode;
}

public String getAuthority() {
return this.authority;
}

public void setAuthority(String authority) {
this.authority = authority;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class GrpcServerObservationContext extends RequestReplyReceiverContext<Me
@Nullable
private Code statusCode;

@Nullable
private String authority;

public GrpcServerObservationContext(Getter<Metadata> getter) {
super(getter);
}
Expand Down Expand Up @@ -88,4 +91,13 @@ public void setStatusCode(Code statusCode) {
this.statusCode = statusCode;
}

@Nullable
public String getAuthority() {
return this.authority;
}

public void setAuthority(@Nullable String authority) {
this.authority = authority;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT
}
context.setFullMethodName(fullMethodName);
context.setMethodType(methodType);

context.setAuthority(next.authority());
return context;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public <ReqT, RespT> Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call,
}
context.setFullMethodName(fullMethodName);
context.setMethodType(methodType);
context.setAuthority(call.getAuthority());

return context;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ void verifyServerContext(String serviceName, String methodName, String contextua
assertThat(serverContext.getMethodName()).isEqualTo(methodName);
assertThat(serverContext.getFullMethodName()).isEqualTo(contextualName);
assertThat(serverContext.getMethodType()).isEqualTo(methodType);
assertThat(serverContext.getAuthority()).isEqualTo("localhost");
});
}

Expand All @@ -411,6 +412,7 @@ void verifyClientContext(String serviceName, String methodName, String contextua
assertThat(clientContext.getMethodName()).isEqualTo(methodName);
assertThat(clientContext.getFullMethodName()).isEqualTo(contextualName);
assertThat(clientContext.getMethodType()).isEqualTo(methodType);
assertThat(clientContext.getAuthority()).isEqualTo("localhost");
});
}

Expand Down