To showcase an end-to-end scenario including distributed tracing we'll instrument this demo weather application that comprises two Android UI fragments and a simple local backend service based on Spring Boot.
Located in the backend module. This is a simple local backend service based on Spring Boot that provides APIs for the application and helps showcasing the the distributed tracing use case.
Located in the app module. The first screen will have a dropdown list with some city names and also a button that takes you to the second one, where you’ll see the selected city’s current temperature. If you pick a non-European city on the first screen, you’ll get an error from the (local) backend when you head to the second screen. This is to demonstrate how network and backend errors are captured and correlated.
It collects telemetry from both the application and backend service and stores it in Elasticsearch. The edot-collector module in this project is a helper tool that takes care of setting up an EDOT Collector for testing purposes. Refer to the EDOT Collector docs for more information.
- Java 17 or higher.
 - An Elasticsearch + Kibana setup with version 
8.19.0or higher. If you don't have one yet, you can quickly create it with start-local. - An Elasticsearch API Key. Take a look at how to create one here.
 - An Android emulator.
 
Note
The reason why is recommended using an emulator is because the
endpoints set here and
here point to
local services via the emulator's localhost IP (10.0.2.2).
If you wanted to use a real device, you'd need to replace the 10.0.2.2 host by the one of the
machine where you'll start the services mentioned in the steps below.
You must set your Elasticsearch endpoint URL and API Key into the elasticsearch.properties file.
endpoint=YOUR_ELASTICSEARCH_ENDPOINT
api_key=YOUR_ELASTICSEARCH_API_KEYReplace YOUR_ELASTICSEARCH_ENDPOINT and YOUR_ELASTICSEARCH_API_KEY with the respective values.
We're going to use the edot-collector-launcher script, which will:
- Download the latest EDOT Collector build.
 - Create a configuration file using the values from the elasticsearch.properties file.
 - Launch the EDOT Collector service and leave it running until manually stopped.
 
Once the EDOT Collector is running, its endpoint will be http://localhost:4318.
You don't need to set it for this demo application, as it has already been done here. So, for this demo application use case, once the EDOT Collector is running, you're ready to go to the next step.
Execute the edot-collector-launcher.ps1 script with PowerShell. You can learn how to do so by taking a look at this guide.
Execute the edot-collector-launcher script. You can do so by opening up a terminal, navigating to this directory and running the following command:
./edot-collector-launcherWe're going to use the backend-launcher script, which will build and run the Spring Boot backend
service.
Once the backend service is running, its endpoint will be http://localhost:8080/v1/.
You don't need to set it for this demo application, as it has already been done here. So, for this demo application use case, once the backend service is running, you're ready to go to the next step.
Execute the backend-launcher.ps1 script with PowerShell. You can learn how to do so by taking a look at this guide.
Execute the backend-launcher script. You can do so by opening up a terminal, navigating to this directory and running the following command:
./backend-launcherOpen up this project with Android Studio and run the application in an Android Emulator. Once everything is running, navigate around in the app to generate some load that we would like to observe in Elastic APM. So, select a city, click Next and repeat it multiple times. Please, also make sure to select New York at least once. You will see that the weather forecast won’t work for New York as the city.
After launching the app and navigating through it, you should be able to start seeing telemetry data coming into your configured Kibana instance. For a more detailed overview, take a look at how to Visualize telemetry in the docs.
