---
# System prepended metadata

title: Zurich Insurance workshop - Application Signals

---

# Zurich Insurance workshop

## Application architecture - EKS

![image](https://hackmd.io/_uploads/rJZGN00HC.png)


## Application Signals on EC2

docs ref: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Application-Signals-Enable-EC2.html
blog post: https://aws.amazon.com/blogs/mt/monitor-java-apps-running-on-tomcat-server-with-amazon-cloudwatch-application-signals-preview/

**Manual Instrumentation (code-based)**
otel docs ref: https://opentelemetry.io/docs/concepts/instrumentation/code-based/

![Screenshot 2024-06-15 at 12.39.20](https://hackmd.io/_uploads/HJNrqrRrA.png)

**Automatic Instrumentation (zero-code)**
otel docs ref: https://opentelemetry.io/docs/concepts/instrumentation/zero-code/

![Screenshot 2024-06-15 at 12.39.48](https://hackmd.io/_uploads/Sy3M9SCBC.png)
### 
Java application auto-instrumentation on EC2

Application Signals doesn't autodiscover the names of your services or the hosts or clusters they run on. You must specify these names during the custom setup, and the names that you specify are what is displayed on Application Signals dashboards.

![image](https://hackmd.io/_uploads/ry3KNA0H0.png)
e

#### Install tomact

```
sudo yum install git -y
git clone https://github.com/aws-samples/amazon-cloudwatch-application-signals-java-tomcat-monitoring
cd amazon-cloudwatch-application-signals-java-tomcat-monitoring
sudo chmod +x get_requirements.sh
TOMCAT_VER=10.1.24
MAVEN_VER=3.9.7
sudo ./get_requirements.sh $TOMCAT_VER $MAVEN_VER

```

**Cloud Agent configuration**

```
{
    "agent": {
      "credentials": {
        "role_arn": "arn:aws:iam::target-account-ID:role/agent-role-in-target-account"
      }
    },
    "traces": {
        "traces_collected": {
            "app_signals": {}
        }
    },
    "logs": {
        "metrics_collected": {
            "app_signals": {}
        },
        "logs_collected": {
            "files": {
                "collect_list": [{
                    "file_path": "/opt/tomcat/logs/**.log",
                    "log_group_name": "Tomcat-Server-Logs",
                    "retention_in_days": 1
                },
                {
                    "file_path": "/opt/tomcat/logs/**.txt",
                    "log_group_name": "Tomcat-Access-logs",
                    "retention_in_days": 1
                }]
            }
        }
    }
}
```

**Environment variables for Tomcat and ADOT java agent**


```
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/aws/aws-opentelemetry-agent.jar"
export OTEL_JAVAAGENT_DEBUG=false
export OTEL_METRICS_EXPORTER=none
export OTEL_LOGS_EXPORT=none
export OTEL_AWS_APPLICATION_SIGNALS_ENABLED=true
export OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT=http://localhost:4316/v1/metrics
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4316/v1/traces
export OTEL_RESOURCE_ATTRIBUTES=aws.hostedin.environment=EC2,service.name=petclinic-test
```

>The CATALINA_OPTS environment variable is **used to pass configuration flags and system properties to the JVM that runs the Tomcat server**.


Otel java agent docs ref: https://opentelemetry.io/docs/zero-code/java/agent/server-config/


