# Monitoring
Monitoring is one of the most important activities to be performed to ensure the efficiency and continuity of our cloud applications. Having access to reliable information on the performance of the systems allows us to make better decisions about the critical points that require attention.
Modyo Connect includes real-time monitoring capabilities of the health of your infrastructure and applications, which generates metrics aggregated into dashboards that are used to determine the overall health of the service.
Modyo Connect is a managed service, so the vast majority of these metrics are managed internally by our operations teams. As part of the service, only alerts related to your particular applications, such as problems with external services or errors within the application, are escalated to the customer.
# Application Metrics
The monitoring of application metrics is a type of "white box" monitoring in which agents are implemented to report the behavior of the internal elements of each application. Application monitoring detects response times of services such as APIs, databases, caching systems, among others, providing a 360° view of the application status.
Modyo Connect implements its application metrics monitoring service with NewRelic APM (opens new window). NewRelic APM captures real-time performance metrics and centralizes them in dashboards that can be accessed from the Web, among which we can highlight:
Average response times and percentiles
Error rate
Status of external services or APIs
Slow traces within the application
# Steps to activate
To enable application monitoring with NewRelic within a microservice, you must ensure that the Java agent is installed and properly initialized as part of the service, as shown in the following example:
FROM adoptopenjdk/openjdk11-openj9:jdk-11.0.10_9_openj9-0.24.0
WORKDIR /usr/app
COPY build/libs/<microservice-name>.jar .
CMD java -XX:MaxRAMPercentage=75.0 -XX:MinRAMPercentage=75.0 -XX:InitialRAMPercentage=75.0 -jar -Dhttps.protocols=TLSv1.2 -javaagent:./newrelic/newrelic.jar -Dnewrelic.environment=$STAGE_NAME <microservice-name>.jar
In the above example, the following parameters are the ones that trigger monitoring:
-javaagent:./newrelic/newrelic.jar -Dnewrelic.environment=$STAGE_NAME
The $STAGE_NAME variable is used to notify NewRelic which environment configuration to use (production, certification, staging, etc.).
NewRelic Token
The NewRelic API token, used to import metrics into the service, is automatically injected as part of the microservice environment variables.
Basic and full users in NewRelic
The access granted by Modyo Connect is of the "basic" type and restricted exclusively to the dashboards defined for each service. Modyo does not grant "full" access to any user of the service.
# Infrastructure Metrics
Infrastructure metrics monitoring comprises all the details about the cloud dependencies configured for the service.
Modyo Connect implements infrastructure monitoring using AWS CloudWatch (opens new window).
# Steps to activate
AWS CloudWatch monitoring is active by default on all infrastructure managed by Modyo Connect. It is accessed through the service accounts.
Monitoring with NewRelic
The most relevant infrastructure monitoring metrics are sent to NewRelic using AWS CloudWatch Metric Streams (opens new window), for centralization and cross-referencing with application metrics.
# Logging
Logging refers to the sequential recording in a file or database of all events or actions that affect a particular process. It thus constitutes evidence of the system's behavior.
Modyo Connect implements its log logging using AWS CloudWatch Logs (opens new window), which enables centralization of logs and thus a unified view of all log records generated by the infrastructure components.
# Steps to activate
AWS CloudWatch Logs are active by default across the infrastructure managed by Modyo Connect. They are accessed through the service's accounts.
Log obfuscation
It will be the responsibility of the user who generates the logs to obfuscate the parameters and sensitive information included in the logs.