forked from AxonFramework/extension-tracing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AxonFramework#46: add configurable span operation name
- Loading branch information
1 parent
80d3633
commit 05477ea
Showing
5 changed files
with
215 additions
and
19 deletions.
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
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
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
121 changes: 121 additions & 0 deletions
121
tracing/src/main/java/org/axonframework/extensions/tracing/TracingProperties.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,121 @@ | ||
/* | ||
* Copyright (c) 2010-2020. Axon Framework | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License 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 org.axonframework.extensions.tracing; | ||
|
||
/** | ||
* Properties for tracing customizations. | ||
*/ | ||
public class TracingProperties { | ||
|
||
//fixme which coordinates are better? | ||
//axon.tracing.{dispatch/handle}.{command/query} | ||
// vs | ||
//axon.tracing.{command/query}.{dispatch/handle} | ||
|
||
public TracingProperties() { | ||
setDefaults(); | ||
} | ||
|
||
private Handle handle = new Handle(); | ||
|
||
private Dispatch dispatch = new Dispatch(); | ||
|
||
public Handle getHandle() { | ||
return handle; | ||
} | ||
|
||
public void setHandle(Handle handle) { | ||
this.handle = handle; | ||
} | ||
|
||
public Dispatch getDispatch() { | ||
return dispatch; | ||
} | ||
|
||
public void setDispatch(Dispatch dispatch) { | ||
this.dispatch = dispatch; | ||
} | ||
|
||
private void setDefaults() { | ||
dispatch.getOperationNamePrefix().setCommand("fire_"); | ||
dispatch.getOperationNamePrefix().setQuery("ask_"); | ||
handle.getOperationNamePrefix().setCommand("handle_"); | ||
handle.getOperationNamePrefix().setQuery("serve_"); | ||
} | ||
|
||
private static abstract class HasOperationNamePrefix { | ||
|
||
private OperationNamePrefix operationNamePrefix = new OperationNamePrefix(); | ||
|
||
public OperationNamePrefix getOperationNamePrefix() { | ||
return operationNamePrefix; | ||
} | ||
|
||
public void setOperationNamePrefix(OperationNamePrefix operationNamePrefix) { | ||
this.operationNamePrefix = operationNamePrefix; | ||
} | ||
} | ||
|
||
/** | ||
* Customizations for message dispatching. | ||
*/ | ||
public static class Dispatch extends HasOperationNamePrefix { | ||
} | ||
|
||
/** | ||
* Customizations for message dispatching. | ||
*/ | ||
public static class Handle extends HasOperationNamePrefix { | ||
|
||
} | ||
|
||
/** | ||
* Span operation name for messages. | ||
*/ | ||
public static class OperationNamePrefix { | ||
|
||
/** | ||
* Span operation name prefix for commands. | ||
* <p/> | ||
* E.g. given it's {@code "send_"}, the name would be {@code "send_MyCommand"} | ||
*/ | ||
private String command; | ||
|
||
/** | ||
* Span operation name prefix for queries. | ||
* <p/> | ||
* E.g. given it's {@code "send_"}, the name would be {@code "send_MyQuery"} | ||
*/ | ||
private String query; | ||
|
||
public String getCommand() { | ||
return command; | ||
} | ||
|
||
public void setCommand(String command) { | ||
this.command = command; | ||
} | ||
|
||
public String getQuery() { | ||
return query; | ||
} | ||
|
||
public void setQuery(String query) { | ||
this.query = query; | ||
} | ||
} | ||
} |
Oops, something went wrong.