View jaegerspring-boot-start.cmd
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
java -jar \ | |
target/Distributed-Service-0.0.1-SNAPSHOT.jar \ | |
--spring.application.name=Service-1 \ | |
--server.port=8080 | |
java -jar \ | |
target/Distributed-Service-0.0.1-SNAPSHOT.jar \ | |
--spring.application.name=Service-2 \ | |
--server.port=8090 |
View jaeger-application.yml
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
opentracing: | |
jaeger: | |
http-sender: | |
url: http://localhost:14268/api/traces |
View jaeger-docker-compose.yml
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
version: '3.3' | |
services: | |
jaeger-allinone: | |
image: jaegertracing/all-in-one:1.42 | |
ports: | |
- 6831:6831/udp | |
- 6832:6832/udp | |
- 16686:16686 | |
- 14268:14268 |
View Jeager-Controller.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
@RestController | |
@RequestMapping("/service") | |
public class Controller { | |
private static final Logger logger = LoggerFactory.getLogger(Controller.class); | |
private RestTemplate restTemplate; | |
@Value("${spring.application.name}") | |
private String applicationName; |
View Jaeger-dependency-spring-boot-3-build.gradle
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
implementation group: 'io.opentracing.contrib', name: 'opentracing-spring-jaeger-cloud-starter', version: '3.3.1' | |
implementation('io.projectreactor:reactor-core') { | |
version { | |
strictly '3.4.26' | |
} | |
} |
View Jaeger-dependency-spring-boot-3.xml
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
<dependency> | |
<groupId>io.opentracing.contrib</groupId> | |
<artifactId>opentracing-spring-jaeger-cloud-starter</artifactId> | |
<version>3.3.1</version> | |
<exclusions> | |
<exclusion> | |
<groupId>io.projectreactor</groupId> | |
<artifactId>reactor-core</artifactId> | |
</exclusion> | |
</exclusions> |
View Jaeger-dependency-spring-boot-2.xml
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
<dependency> | |
<groupId>io.opentracing.contrib</groupId> | |
<artifactId>opentracing-spring-jaeger-cloud-starter</artifactId> | |
<version>3.3.1</version> | |
</dependency> |
View parameter-object-design-pattern-after-usage.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
... | |
searchService.search(ParameterObject.build() | |
.withType("type1") | |
.sortBy("ASC") | |
.build()); | |
... |
View parameter-object-design-pattern-after.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
public class SearchService { | |
/* Parameter Object example. Default values are abstracted into the Parameter Object | |
at the time of Object creation */ | |
public String search(ParameterObject parameterObject) { | |
return getQuerySummary(parameterObject.getType(), parameterObject.getSortBy(), | |
parameterObject.getSortOrder()); | |
} | |
private String getQuerySummary(String type, String sortBy, SortOrder sortOrder) { |
View parameter-object-design-pattern-before.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
public class SearchService { | |
//Method Overloading example. SortOrder is defaulted in this method | |
public String search(String type, String sortBy) { | |
return getQuerySummary(type, sortBy, SortOrder.DESC); | |
} | |
/* Method Overloading example. SortBy is defaulted in this method. Note that the type has to be | |
different here to overload the method */ | |
public String search(String type, SortOrder sortOrder) { | |
return getQuerySummary(type, "price", sortOrder); |