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

Add HTTP method to http-path operation name #125

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions spec/src/main/asciidoc/microprofile-opentracing.asciidoc
Expand Up @@ -133,8 +133,10 @@ The operation name can be configured via key `mp.opentracing.server.operation-na
The implementation has to provide two operation name providers:

* `class-method` - the provider for the default operation name.
* `http-path` - the operation name consists of values provided to `@Path` annotation. For example
if the class is annotated with `@Path(service)` and method `@Path(endpoint)` then the operation name is `/service/endpoint`.
* `http-path` - the operation name has the following form
`<HTTP method>:<@Path value of endpoint's class>/<@Path value of endpoint's method>`.
For example if the class is annotated with `@Path(service)` and method `Path@(endpoint)` then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo Path@(endpoint)

the operation name is `GET:/service/endpoint`.

If no operation name provider is specified then `class-method` is used.

Expand Down
Expand Up @@ -75,7 +75,7 @@ public static WebArchive createDeployment() {
@Override
protected String getOperationName(String spanKind, String httpMethod, Class<?> clazz, Method method) {
if (spanKind.equals(Tags.SPAN_KIND_SERVER)) {
StringBuilder operationName = new StringBuilder();
StringBuilder operationName = new StringBuilder(httpMethod.toUpperCase() + ":");
Path classPath = clazz.getAnnotation(Path.class);
if (classPath == null) {
throw new IllegalArgumentException("Supplied clazz is not JAX-RS resource");
Expand Down