-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP]Integrate the observability (#726)
* Integrate the observability * Update code to clean up unused resources and optimize the configuration * Enrich labels for Metrics, Logs * Apply observability to all services * Fix newline ending * Cleanup and update dashboard for Metrics --------- Co-authored-by: Loi Nguyen Xuan <loinguyenx@nashtechglobal.com>
- Loading branch information
1 parent
58880ea
commit 4da68a0
Showing
72 changed files
with
16,709 additions
and
1,043 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,83 @@ | ||
COMPOSE_FILE=docker-compose.yml:docker-compose.search.yml:docker-compose.o11y.yml | ||
|
||
# Demo Platform | ||
ENV_PLATFORM=local | ||
|
||
# OpenTelemetry Collector | ||
OTEL_COLLECTOR_HOST=collector | ||
OTEL_COLLECTOR_PORT_GRPC=5555 | ||
OTEL_COLLECTOR_PORT_HTTP=6666 | ||
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC} | ||
OTEL_LOGS_EXPORTER=otlp | ||
OTEL_TRACES_EXPORTER=otlp | ||
OTEL_METRICS_EXPORTER=otlp | ||
OTEL_EXPORTER_OTLP_INSECURE=true | ||
OTEL_JAVAAGENT_LOGGING=application | ||
OTEL_JAVAAGENT_ENABLED=true | ||
OTEL_JAVAAGENT_DEBUG=false | ||
OTEL_INSTRUMENTATION_MESSAGING_EXPERIMENTAL_RECEIVE_TELEMETRY_ENABLED=true | ||
# OpenTelemetry Resource Definitions | ||
OTEL_RESOURCE_ATTRIBUTES="service.namespace=yas-msa" | ||
|
||
# Metrics Temporality | ||
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=cumulative | ||
OTEL_INSTRUMENTATION_LOGBACK-MDC_ADD-BAGGAGE=true | ||
|
||
# ****************** | ||
# Services | ||
# ****************** | ||
# Kafka | ||
KAFKA_SERVICE_HOST=kafka | ||
KAFKA_SERVICE_PORT=9092 | ||
KAFKA_SERVICE_ADDR=kafka:${KAFKA_SERVICE_PORT} | ||
KAFKA_BROKER_ID=1 | ||
KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 | ||
KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://${KAFKA_SERVICE_ADDR},PLAINTEXT_HOST://kafka:29092 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT | ||
KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1 | ||
|
||
# Postgres | ||
POSTGRES_USER=admin | ||
POSTGRES_PASSWORD=admin | ||
POSTGRES_HOST=postgres | ||
POSTGRES_PORT=5432 | ||
|
||
# ******************** | ||
# Telemetry Components | ||
# ******************** | ||
# Grafana | ||
GRAFANA_SERVICE_PORT=3000 | ||
GRAFANA_SERVICE_HOST=grafana | ||
|
||
# Jaeger | ||
JAEGER_SERVICE_PORT=16686 | ||
JAEGER_SERVICE_HOST=jaeger | ||
|
||
# Prometheus | ||
PROMETHEUS_SERVICE_PORT=9090 | ||
PROMETHEUS_SERVICE_HOST=prometheus | ||
PROMETHEUS_ADDR=${PROMETHEUS_SERVICE_HOST}:${PROMETHEUS_SERVICE_PORT} | ||
|
||
|
||
# ******************************************************* | ||
# Environment Variables are injected to the microservices | ||
# ******************************************************* | ||
JAVA_TOOL_OPTIONS=-javaagent:opentelemetry-javaagent.jar | ||
LOGGING_CONFIG=/app-config/logback-spring.xml | ||
|
||
# The API Endpoint | ||
YAS_PUBLIC_API_URL=http://api.yas.local | ||
YAS_SERVICES_CART=http//cart/cart | ||
YAS_SERVICES_CUSTOMER=http://customer/customer | ||
YAS_SERVICES_PRODUCT=http://product/product | ||
YAS_SERVICES_TAX=http://tax/tax | ||
YAS_SERVICES_ORDER=http://order/order | ||
YAS_SERVICES_PAYMENT=http://payment/payment | ||
YAS_SERVICES_LOCATION=http://location/location | ||
YAS_SERVICES_MEDIA=http://media/media | ||
YAS_SERVICES_PROMOTION=http://promotion/promotion | ||
YAS_SERVICES_INVENTORY=http://inventory/inventory | ||
YAS_SERVICES_RATING=http://rating/rating | ||
SERVER_PORT=80 | ||
# Swagger UI | ||
URLS=[{ url: 'http://api.yas.local/product/v3/api-docs', name: 'Product' },{ url: 'http://api.yas.local/media/v3/api-docs', name: 'Media' },{ url: 'http://api.yas.local/customer/v3/api-docs', name: 'Customer' },{ url: 'http://api.yas.local/cart/v3/api-docs', name: 'Cart'},{ url: 'http://api.yas.local/rating/v3/api-docs', name: 'Rating' }, { url: 'http://api.yas.local/order/v3/api-docs', name: 'Order'},{ url: 'http://api.yas.local/payment/v3/api-docs', name: 'Payment'},{ url: 'http://api.yas.local/payment-paypal/v3/api-docs', name: 'Payment-paypal'},{ url: 'http://api.yas.local/location/v3/api-docs', name: 'Location'}, { url: 'http://api.yas.local/inventory/v3/api-docs', name: 'Inventory'},{ url: 'http://api.yas.local/tax/v3/api-docs', name: 'Tax' },{ url: 'http://api.yas.local/promotion/v3/api-docs', name: 'Promotion'},{ url: 'http://api.yas.local/search/v3/api-docs', name: 'Search'}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# fix line ending | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<include resource="org/springframework/boot/logging/logback/base.xml" /> | ||
<springProperty scope="context" name="appName" source="spring.application.name"/> | ||
<property name="ENCODING" value="UTF-8" /> | ||
<property name="LOG_LEVEL" value="DEBUG" /> | ||
<include | ||
resource="org/springframework/boot/logging/logback/base.xml" /> | ||
<springProperty scope="context" name="appName" | ||
source="spring.application.name" /> | ||
<!-- Reuse the log from Spring --> | ||
<include | ||
resource="org/springframework/boot/logging/logback/defaults.xml" /> | ||
<include | ||
resource="org/springframework/boot/logging/logback/console-appender.xml" /> | ||
<!-- Define own appender to be used in the logger to append the data into --> | ||
<appender name="JSON_CONSOLE" | ||
class="ch.qos.logback.core.ConsoleAppender"> | ||
<Target>${user-system}.out</Target> | ||
<encoder | ||
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"> | ||
<providers> | ||
<mdc /> | ||
<pattern> | ||
<pattern> | ||
{ | ||
"timestamp": "%date{yyyy-MM-dd'T'HH:mm:ss.SSS,UTC}", | ||
"log.level": "%level", | ||
"thread": "%thread", | ||
"logger": "%logger", | ||
"message": "%message", | ||
"host": "${HOSTNAME}" | ||
} | ||
</pattern> | ||
</pattern> | ||
<stackTrace> | ||
<throwableConverter | ||
class="net.logstash.logback.stacktrace.ShortenedThrowableConverter"> | ||
<rootCauseFirst>true</rootCauseFirst> | ||
</throwableConverter> | ||
</stackTrace> | ||
</providers> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="LOKI" class="com.github.loki4j.logback.Loki4jAppender"> | ||
<http> | ||
<url>http://loki:3100/loki/api/v1/push</url> | ||
</http> | ||
<format> | ||
<label> | ||
<pattern>app=${appName},host=${HOSTNAME},traceID=%X{traceId:-NONE},level=%level</pattern> | ||
</label> | ||
<message> | ||
<pattern>${FILE_LOG_PATTERN}</pattern> | ||
</message> | ||
<sortByTime>true</sortByTime> | ||
</format> | ||
</appender> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="LOKI"/> | ||
</root> | ||
</configuration> | ||
<!-- This appender is to define the log to console that human friendly on | ||
dev machine --> | ||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<Target>${user-system}.out</Target> <encoder> <pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
<charset>${ENCODING}</charset> </encoder> </appender> | ||
<!-- Define the logger and the log level to use (TRACE, DEBUG, INFO, WARN, | ||
ERROR, FATAL) --> | ||
<logger | ||
name="org.springframework.web.filter.CommonsRequestLoggingFilter" | ||
level="DEBUG" /> | ||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.