Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.
Open
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
78 changes: 78 additions & 0 deletions 3D-microservices-observability/springboot-jersey-app-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Wavefront Distributed Tracing Sample Apps - Springboot Jersey App 2

This is a sample java application using Springboot beachshirts (#[beachops](https://medium.com/@matthewzeier/thoughts-from-an-operations-wrangler-how-we-use-alerts-to-monitor-wavefront-71329c5e57a8))
which makes shirts for the beach. The application is based on spring boot web using rest templates and rest annotations.
- JDK 1.8 and up
- Spring Boot 2.3.0.RC1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can this be updated (and the pom.xml) to a non-RC version? It looks like 2.3.0.RELEASE was released May 2020.


## Running Application locally

- `git clone` this repo and navigate to this dir:

- ```bash
git clone https://github.com/howardyoo/distributed-tracing-sample-apps/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please change github link to wavefronthq.

cd ./distributed-tracing-sample-apps/3D-microservices-observability/springboot-jersey-app-2
```
- Run `mvn clean compile` from the root directory of the project.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Running the command was successful, but gave this warning at the beginning:

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.wavefront:common:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-eureka-server:jar is either LATEST or RELEASE (both of them are being deprecated) @ com.wavefront:springboot-jersey-app-2:0.0.1-SNAPSHOT, /Users/oppegard/workspace/wf/distributed-tracing-sample-apps/3D-microservices-observability/springboot-jersey-app-2/pom.xml, line 88, column 13
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.wavefront:springboot-jersey-app-2:pom:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for org.springframework.cloud:spring-cloud-starter-eureka-server:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 88, column 13
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

Can you take a look and see if this is fixable?


- Now run all the services using below commands from root directory of the project.

```bash
mvn -pl registration spring-boot:run &
mvn -pl delivery spring-boot:run &
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Running the registration app works with no errors. However, this and the remaining two apps fail with:

[INFO]
[INFO] -----------------------< com.wavefront:delivery >-----------------------
[INFO] Building delivery 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.3.0.RC1:run (default-cli) > test-compile @ delivery >>>
[WARNING] The POM for com.wavefront:common:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.006 s
[INFO] Finished at: 2021-08-30T09:10:08-06:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project delivery: Could not resolve dependencies for project com.wavefront:delivery:jar:0.0.1-SNAPSHOT: com.wavefront:common:jar:0.0.1-SNAPSHOT was not found in https://repo.spring.io/milestone during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spring-milestones has elapsed or updates are forced -> [Help 1]
[ERROR]

mvn -pl styling spring-boot:run &
mvn -pl shopping spring-boot:run &
```
- If you are using an IDE like intellij, you can also group these mvn projects together to start them up in a group.

- Now view the shopping menus using HTTP GET request: `curl -X GET http://localhost:4444/menu`

- Order shirts using HTTP POST request:

- ```bash
curl -X POST -d '{"styleName":"style1", "quantity":10}' -H "Content-Type: application/json" http://localhost:4444/order
```

- Use `./loadgen.sh {interval}` in the root directory to send a request of ordering shirts every `{interval}` seconds

- This application uses spring Eureka for service discovery. `registration` is the Eureka server running on port 1111.
Use your browser to open `http://localhost:1111` to monitor the three services `delivery`, `styling`, and `shopping`.

## Enabling Wavefront Spring Boot Starter ##
- Uncomment the following entries in `pom.xml` in order to use Wavefront freemium to track your application performance.
- Uncommenting `wavefront-spring-boot-starter` is mandatory to auto configure metrics, but you need to choose either
SLEUTH or Opentracing depending on your preference. For example, uncomming `<-- for SLEUTH -->` part to enable
`spring-cloud-starter-sleuth` in order to have SLEUTH produce distributed tracing for the application, or you can
use opentracing instead.
```xml
<dependencies>
...
<!-- for SLEUTH
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
-->

<!-- for Observability using Wavefront
<dependency>
<groupId>com.wavefront</groupId>
<artifactId>wavefront-spring-boot-starter</artifactId>
<version>2.0.0-RC1</version>
</dependency>
-->

<!-- for Opentracing
<dependency>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-cloud-starter</artifactId>
<version>LATEST</version>
</dependency>
-->
...
</dependencies>
```
- Follow the instructions in the standard output regarding the access to Wavefront freemium. Once you navigate to your Wavefront UI,
you should be able to see your metrics and traces shown. You may need to wait about a minute for the first flow of metrics to be shown
in the UI, and also make sure to run loadgen.sh with seconds interval e.g. `loadgen.sh 5` in order to produce some test loads.
310 changes: 310 additions & 0 deletions 3D-microservices-observability/springboot-jersey-app-2/common/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading