Prerequisites
Ensure that you have the required environments and dependencies installed for the respective languages in which the project is implemented. This guide focuses primarily on building and starting the project using Makefile, along with language-specific instructions when necessary.
Step-by-Step Guide
Clone the Repository
First, clone the opentelemetry-demo
repository:
git clone https://github.com/open-telemetry/opentelemetry-demo.git
cd opentelemetry-demo
Using Makefile to Build and Start the Project
The project provides a Makefile
that simplifies the build and run processes across different services. To build and start the demo project, follow these steps:
Navigate to the project directory:
cd opentelemetry-demo
Build the services:
Run the following command, which utilizes the Makefile to handle the build processes for all services:
make build
This command uses environment configurations found in the Makefile to compile the relevant services written in various programming languages.
Start the services:
After the build process is complete, run the following command to start the services:
make run
This command will execute the services defined in the Makefile and allow you to run the entire demo application.
Building and Running Individual Services
If you prefer to build and run specific services, follow these language-specific instructions:
Go Service (Checkout Service)
Build the Go Service:
Navigate to the checkout service directory:
cd src/checkoutservice
Use the following command to build the Go service. Ensure that you do not use the
-mod=vendor
flag:go build .
Run the Go Service:
After building, you can run the service:
./checkoutservice
Java Service
Build the Java Service:
To build the Java service, navigate to the appropriate directory, typically under
src/java
:cd src/java
Use a build tool such as Maven or Gradle to compile the project:
mvn clean install
Run the Java Service:
After building, you can start the service using:
java -jar target/your-jar-name.jar
Python Service
Build the Python Service:
Navigate to the Python service directory:
cd src/python
Install the required dependencies:
pip install -r requirements.txt
Run the Python Service:
Start the service using:
python app.py
Docker Support
If the project or specific services are containerized, you can also build and run using Docker:
Build the Docker Image:
Run the following command from the root directory of the project:
docker build -t opentelemetry-demo .
Run the Docker Container:
After the image is built, you can start a container:
docker run -p 8080:8080 opentelemetry-demo
Summary
By following the above steps, you can successfully build and start the OpenTelemetry demo project along with its services. Multiple languages are supported in the implementation, and building can be done through a unified Makefile
or individually by navigating to specific service directories and executing the necessary build commands.
The information is derived from the project structure and common practices within the OpenTelemetry demo ecosystem.