-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbfea14
commit 2b48965
Showing
8 changed files
with
135 additions
and
15 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
44 changes: 44 additions & 0 deletions
44
docker-compose/mount/otel-collector-config-prometheus-jaeger.yaml
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,44 @@ | ||
# This OTEL collector configuration file that aims is to export metrics to Prometheus and traces to Zipkin. | ||
# It exposes a single OTLP receiver for this purpose. | ||
|
||
# Receivers' configuration section | ||
# See for more details following documentation: https://opentelemetry.io/docs/collector/configuration/#receivers | ||
receivers: | ||
otlp: | ||
protocols: | ||
http: | ||
endpoint: 0.0.0.0:4418 | ||
|
||
# Processors' configuration section | ||
# See fore more details following documentation: https://opentelemetry.io/docs/collector/configuration/#processors | ||
processors: | ||
# Data sources: traces, metrics, logs | ||
memory_limiter: | ||
check_interval: 1s | ||
limit_mib: 4000 | ||
spike_limit_mib: 500 | ||
|
||
|
||
# Exporters' configuration section | ||
# See for more details following documentation: https://opentelemetry.io/docs/collector/configuration/#exporters | ||
exporters: | ||
# Data sources: traces | ||
otlphttp: | ||
endpoint: http://jaeger:4318 | ||
|
||
# Data sources: metrics | ||
prometheus: | ||
endpoint: 0.0.0.0:9094 | ||
namespace: products_service | ||
|
||
# Services configuration section | ||
# See for more details following documentation: https://opentelemetry.io/docs/collector/configuration/#services | ||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [memory_limiter] | ||
exporters: [otlphttp] | ||
metrics: | ||
receivers: [otlp] | ||
exporters: [prometheus] |
69 changes: 69 additions & 0 deletions
69
docker-compose/setup-otel-collector-publishing-filter.yaml
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,69 @@ | ||
# Docker compose to demonstrate publishing of metrics and traces to monitoring backend though OTEL collector. | ||
# Run with the following command: docker-compose -f docker-compose/setup-otel-collector-publishing.yaml up -d | ||
version: "3.9" | ||
services: | ||
elasticsearch: | ||
extends: | ||
file: common-environment.yaml | ||
service: elasticsearch | ||
hostname: elasticsearch | ||
networks: | ||
- products | ||
|
||
postgres: | ||
extends: | ||
file: common-environment.yaml | ||
service: postgres | ||
hostname: postgres | ||
networks: | ||
- products | ||
|
||
jaeger: | ||
extends: | ||
file: common-monitoring-prometheus-jeager.yml | ||
service: jaeger | ||
hostname: jaeger | ||
networks: | ||
- products | ||
|
||
prometheus: | ||
extends: | ||
file: common-monitoring-prometheus-jeager.yml | ||
service: prometheus-collector | ||
hostname: prometheus | ||
networks: | ||
- products | ||
|
||
products-service: | ||
extends: | ||
file: common-products-service.yaml | ||
service: products-service | ||
depends_on: | ||
- postgres | ||
- elasticsearch | ||
hostname: products-service | ||
environment: | ||
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/products | ||
- SPRING_DATASOURCE_USERNAME=products_user | ||
- SPRING_DATASOURCE_PASSWORD=products_password | ||
- SPRING_ELASTICSEARCH_REST_URI=elasticsearch:9200 | ||
- OTEL_SERVICE_NAME=products_service | ||
- OTEL_METRICS_EXPORTER=otlp | ||
- OTEL_TRACES_EXPORTER=otlp | ||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4418 | ||
networks: | ||
- products | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib:0.93.0 | ||
hostname: otel-collector | ||
volumes: | ||
- ./mount/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml | ||
ports: | ||
- "9094:9094" # Prometheus http exporter | ||
- "4418:4418" # OTLP http receiver | ||
networks: | ||
- products | ||
|
||
networks: | ||
products: |
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
17 changes: 17 additions & 0 deletions
17
...ava/io/github/ivankurchenko/blogoteldecoupledmonitoring/controllers/HealthController.java
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,17 @@ | ||
package io.github.ivankurchenko.blogoteldecoupledmonitoring.controllers; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class HealthController { | ||
private static final Logger logger = LoggerFactory.getLogger(HealthController.class); | ||
|
||
@GetMapping("/health") | ||
public String health() { | ||
logger.info("Health check API invoked!"); | ||
return "OK"; | ||
} | ||
} |
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