Skip to content

Commit

Permalink
added log group creation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
bardabun committed Nov 20, 2024
1 parent d39b343 commit 0fd7cfa
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 48 deletions.
45 changes: 27 additions & 18 deletions docs/shipping/Code/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ Give your traces time to process, after which they'll be available in your [Trac
This guide provides an overview of deploying your Java application on Amazon ECS, using OpenTelemetry to collect and send tracing data to Logz.io. It offers a step-by-step process for setting up OpenTelemetry instrumentation and deploying both the application and OpenTelemetry Collector sidecar in an ECS environment.
#### **Prerequisites**
#### Prerequisites
Before you begin, ensure you have the following prerequisites in place:
Expand All @@ -1173,7 +1173,7 @@ Before you begin, ensure you have the following prerequisites in place:
For a complete example, refer to [this repo](https://github.com/logzio/opentelemetry-examples/tree/main/java/traces/ecs-service).
:::
#### **Architecture Overview**
#### Architecture Overview
The deployment will involve two main components:
Expand All @@ -1200,7 +1200,7 @@ project-root/
└── Dockerfile # Dockerfile for the Collector
```
#### **Steps to Deploy the Application**
#### Steps to Deploy the Application
1. Project Structure Setup
Expand Down Expand Up @@ -1233,25 +1233,25 @@ Add the following dependencies in your `pom.xml` (or equivalent Gradle build fil
Include the Java agent when running your application to enable tracing.
see here for more details: https://opentelemetry.io/docs/zero-code/java/agent/getting-started/
#### **Integrating OpenTelemetry Java Agent**
#### Integrating OpenTelemetry Java Agent
1. **Download the OpenTelemetry Java Agent**
1. Download the OpenTelemetry Java Agent
Get the latest version of `opentelemetry-javaagent.jar` from the [OpenTelemetry Java Agent GitHub releases](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases).
2. **Add the Agent to Your Application**
2. Add the Agent to Your Application
Place the `opentelemetry-javaagent.jar` in your project as mentioned in the atchitectre structure above.
3. **Modify the Application's Startup Command**
3. Modify the Application's Startup Command
Include the `-javaagent` flag when starting your Java application to load the OpenTelemetry agent:
```shell
java -javaagent:/path/to/opentelemetry-javaagent.jar -jar your-app.jar
```
4. **Set Environment Variables for OpenTelemetry**
4. Set Environment Variables for OpenTelemetry
Use environment variables to configure the agent, such as the OTLP endpoint and resource attributes:
Expand All @@ -1261,11 +1261,11 @@ see here for more details: https://opentelemetry.io/docs/zero-code/java/agent/ge
export OTEL_RESOURCE_ATTRIBUTES="service.name=java-app"
```
#### **Dockerize Your Application**
#### Dockerize Your Application
Create a Dockerfile to build a Docker image of your Java application. Below is the essential Dockerfile to get started:
#### **Dockerfile**
#### Dockerfile
```dockerfile
# Use a Maven image to build the application
Expand Down Expand Up @@ -1304,15 +1304,15 @@ ENTRYPOINT ["java", "-javaagent:/app/opentelemetry-javaagent.jar", "-jar", "app.
```
#### **Configure the OpenTelemetry Collector**
#### Configure the OpenTelemetry Collector
The OpenTelemetry Collector receives traces from the application and exports them to Logz.io. Create a `collector-config.yaml` file to define how the Collector should handle traces.
**collector-config.yaml**
collector-config.yaml
{@include: ../../_include/tracing-shipping/collector-config.md}
#### **Build Docker Images**
#### Build Docker Images
Build Docker images for both the Java application and the OpenTelemetry Collector:
Expand All @@ -1325,7 +1325,7 @@ docker build --platform linux/amd64 -t java-app:latest .
cd ../otel-collector/
docker build --platform linux/amd64 -t otel-collector:latest .
```
#### **Push Docker Images to Amazon ECR**
#### Push Docker Images to Amazon ECR
Push both images to your Amazon ECR repository:
Expand All @@ -1341,11 +1341,20 @@ docker tag otel-collector:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/otel-collector:latest
```
#### **Define ECS Task**
##### Log Group Creation:
Create log groups for your Java application and OpenTelemetry Collector in CloudWatch.
```shell
aws logs create-log-group --log-group-name /ecs/java-app
aws logs create-log-group --log-group-name /ecs/otel-collector
```
#### Define ECS Task
Create a task definition (`task-definition.json`) for ECS that defines both the Java application container and the OpenTelemetry Collector container.
#### **task-definition.json**
#### task-definition.json
```json
{
Expand Down Expand Up @@ -1406,7 +1415,7 @@ Create a task definition (`task-definition.json`) for ECS that defines both the
}
```
#### **Deploy to ECS**
#### Deploy to ECS
Create an ECS Cluster: Create a cluster to deploy your containers:
Expand All @@ -1432,6 +1441,6 @@ aws ecs create-service \
--network-configuration "awsvpcConfiguration={subnets=[\"YOUR_SUBNET_ID\"],securityGroups=[\"YOUR_SECURITY_GROUP_ID\"],assignPublicIp=ENABLED}"
```
#### **Verify Application and Tracing**
#### Verify Application and Tracing
After deploying, run your application to generate activity that will create tracing data. Wait a few minutes, then check the Logz.io dashboard to confirm that traces are being sent correctly.
35 changes: 22 additions & 13 deletions docs/shipping/Code/node-js.md
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ helm uninstall logzio-k8s-telemetry

This guide provides an overview of deploying your Node.js application on Amazon ECS, using OpenTelemetry to collect and send tracing data to Logz.io. It offers a step-by-step process for setting up OpenTelemetry instrumentation and deploying both the application and OpenTelemetry Collector sidecar in an ECS environment.

##### **Prerequisites**
##### Prerequisites

Before you begin, ensure you have the following prerequisites in place:

Expand All @@ -946,7 +946,7 @@ Before you begin, ensure you have the following prerequisites in place:
For a complete example, refer to [this repo](https://github.com/logzio/opentelemetry-examples/tree/main/nodejs/traces/ecs-service).
:::

##### **Architecture Overview**
##### Architecture Overview

The deployment will involve two main components:

Expand All @@ -969,7 +969,7 @@ project-root/
```

#### **Steps to Deploy the Application**
#### Steps to Deploy the Application

1. Project Structure Setup

Expand All @@ -979,7 +979,7 @@ project-root/

Add OpenTelemetry instrumentation to your Node.js application by including a tracing setup `tracing.js`. This file will initialize OpenTelemetry and configure the trace exporter to send traces to the OpenTelemetry Collector.

##### **tracing.js**
##### tracing.js

```javascript
"use strict";
Expand Down Expand Up @@ -1028,7 +1028,7 @@ The `tracing.js` file initializes OpenTelemetry tracing, configuring the OTLP ex

Include the tracing setup at the entry point of your application `app.js`, ensuring tracing starts before any other logic.

##### **Dockerfile**
##### Dockerfile

```dockerfile
# Use Node.js LTS version
Expand Down Expand Up @@ -1058,15 +1058,15 @@ CMD ["npm", "start"]

The Dockerfile installs the necessary dependencies, sets the environment variables required for OpenTelemetry configuration, and starts the application.

##### **Configure the OpenTelemetry Collector**
##### Configure the OpenTelemetry Collector

The OpenTelemetry Collector receives traces from the application and exports them to Logz.io. Create a `collector-config.yaml` file to define how the Collector should handle traces.

##### **collector-config.yaml**
##### collector-config.yaml

{@include: ../../_include/tracing-shipping/collector-config.md}

##### **Build Docker Images**
##### Build Docker Images

Build Docker images for both the Node.js application and the OpenTelemetry Collector:

Expand All @@ -1080,7 +1080,7 @@ cd ../otel-collector/
docker build --platform linux/amd64 -t otel-collector:latest .
```

##### **Push Docker Images to Amazon ECR**
##### Push Docker Images to Amazon ECR

Push both images to your Amazon ECR repository:

Expand All @@ -1096,11 +1096,20 @@ docker tag otel-collector:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/otel-collector:latest
```

##### **Define ECS Task**
##### Log Group Creation:

Create log groups for your Nodejs application and OpenTelemetry Collector in CloudWatch.

```shell
aws logs create-log-group --log-group-name /ecs/nodejs-app
aws logs create-log-group --log-group-name /ecs/otel-collector
```

##### Define ECS Task

Create a task definition (task-definition.json) for ECS that defines both the Node.js application container and the OpenTelemetry Collector container.

##### **task-definition.json**
##### task-definition.json

```json
{
Expand Down Expand Up @@ -1161,7 +1170,7 @@ Create a task definition (task-definition.json) for ECS that defines both the No
}
```

##### **Deploy to ECS**
##### Deploy to ECS

- Create an ECS Cluster: Create a cluster to deploy your containers:

Expand All @@ -1188,7 +1197,7 @@ Create a task definition (task-definition.json) for ECS that defines both the No
--region <aws-region> \
```

###### **Verify Application and Tracing**
##### Verify Application and Tracing

After deploying, run your application to generate activity that will create tracing data. Wait a few minutes, then check the Logz.io dashboard to confirm that traces are being sent correctly.

Expand Down
43 changes: 26 additions & 17 deletions docs/shipping/Code/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -1348,11 +1348,11 @@ Give your traces time to process, after which they'll be available in your [Trac
</TabItem>
<TabItem value="python-traces-ecs" label="ECS" default>
### Python Application Setup for ECS Service with OpenTelemetry
## Python Application Setup for ECS Service with OpenTelemetry
This guide provides an overview of deploying your Python application on Amazon ECS, using OpenTelemetry to collect and send tracing data to Logz.io. It offers a step-by-step process for setting up OpenTelemetry instrumentation and deploying both the application and OpenTelemetry Collector sidecar in an ECS environment.
##### **Prerequisites**
#### Prerequisites
Before you begin, ensure you have the following prerequisites in place:
Expand All @@ -1366,7 +1366,7 @@ Before you begin, ensure you have the following prerequisites in place:
For a complete example, refer to [this repo](https://github.com/logzio/opentelemetry-examples/tree/main/python/traces/ecs-service).
:::
##### **Architecture Overview**
#### Architecture Overview
The deployment will involve two main components:
Expand All @@ -1393,7 +1393,7 @@ project-root/
└── Dockerfile # Dockerfile for the Collector
```
##### **Steps to Deploy the Application**
#### Steps to Deploy the Application
1. Project Structure Setup
Expand All @@ -1405,7 +1405,7 @@ project-root/
Install dependencies:
##### **requirements.txt**
#### requirements.txt
```
flask
Expand All @@ -1416,11 +1416,11 @@ opentelemetry-instrumentation-flask
The package `opentelemetry-instrumentation-flask` handles the automatic instrumentation of Flask at runtime.
##### **Dockerize Your Application**
#### Dockerize Your Application
Create a Dockerfile to build a Docker image of your Python application. Below is the Dockerfile to get started:
#### **Dockerfile**
#### Dockerfile
```dockerfile
FROM python:3.8-slim
Expand All @@ -1441,15 +1441,15 @@ EXPOSE 5000
CMD ["opentelemetry-instrument", "python", "app.py"]
```
##### **Configure the OpenTelemetry Collector**
#### Configure the OpenTelemetry Collector
The OpenTelemetry Collector receives traces from the application and exports them to Logz.io. Create a `collector-config.yaml` file to define how the Collector should handle traces.
##### **collector-config.yaml**
#### collector-config.yaml
{@include: ../../_include/tracing-shipping/collector-config.md}
##### **Build Docker Images**
#### Build Docker Images
Build Docker images for both the Node.js application and the OpenTelemetry Collector:
Expand All @@ -1463,7 +1463,7 @@ cd ../otel-collector/
docker build --platform linux/amd64 -t otel-collector:latest .
```
##### **Push Docker Images to Amazon ECR**
#### Push Docker Images to Amazon ECR
Push both images to your Amazon ECR repository:
Expand All @@ -1479,11 +1479,20 @@ docker tag otel-collector:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com
docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/otel-collector:latest
```
##### **Define ECS Task**
##### Log Group Creation:
Create log groups for your Python application and OpenTelemetry Collector in CloudWatch.
```shell
aws logs create-log-group --log-group-name /ecs/python-app
aws logs create-log-group --log-group-name /ecs/otel-collector
```
#### Define ECS Task
Create a task definition (task-definition.json) for ECS that defines both the Node.js application container and the OpenTelemetry Collector container.
##### **task-definition.json**
#### task-definition.json
```json
{
Expand Down Expand Up @@ -1544,7 +1553,7 @@ Create a task definition (task-definition.json) for ECS that defines both the No
}
```
##### **Deploy to ECS**
#### Deploy to ECS
- Create an ECS Cluster: Create a cluster to deploy your containers:
Expand All @@ -1571,7 +1580,7 @@ Create a task definition (task-definition.json) for ECS that defines both the No
--region <aws-region> \
```
###### **Verify Application and Tracing**
#### Verify Application and Tracing
After deploying, run your application to generate activity that will create tracing data. Wait a few minutes, then check the Logz.io dashboard to confirm that traces are being sent correctly.
Expand Down Expand Up @@ -1632,9 +1641,9 @@ logzio-monitoring logzio-helm/logzio-monitoring -n monitoring
Typically, the service name will be `logzio-k8s-telemetry.default.svc.cluster.local`, where `default` is the namespace where you deployed the helm chart and `svc.cluster.name` is your cluster domain name. If you're unsude what your cluster domain name is, run the following command to find it:
```sh
```shell
kubectl run -it --image=k8s.gcr.io/e2e-test-images/jessie-dnsutils:1.3 --restart=Never shell -- \
shell -c 'nslookup kubernetes.default | grep Name | sed "s/Name:\skubernetes.default//"'
sh -c 'nslookup kubernetes.default | grep Name | sed "s/Name:\skubernetes.default//"'
```
This command deploys a pod to extract your cluster domain name, which can be removed after.
Expand Down

0 comments on commit 0fd7cfa

Please sign in to comment.