I want the eclipse ditto metrics to be viewed in localhost:9095
. In order to get I did
things:
image: docker.io/eclipse/ditto-things:${DITTO_VERSION:-latest}
mem_limit: 512m
restart: always
networks:
default:
aliases:
- ditto-cluster
depends_on:
- policies
environment:
- TZ=Europe/Berlin
- BIND_HOSTNAME=0.0.0.0
# Set additional configuration options here appending JAVA_TOOL_OPTIONS: -Dditto.things...
- JAVA_TOOL_OPTIONS=-XX:ActiveProcessorCount=2 -XX:+ExitOnOutOfMemoryError -XX:+UseContainerSupport -XX:+UseStringDeduplication -Xss512k -XX:MaxRAMPercentage=50 -XX:+UseG1GC -XX:MaxGCPauseMillis=150 -Dakka.coordinated-shutdown.exit-jvm=on -Dakka.cluster.shutdown-after-unsuccessful-join-seed-nodes=180s -Dakka.cluster.failure-detector.threshold=15.0 -Dakka.cluster.failure-detector.expected-response-after=10s -Dakka.cluster.failure-detector.acceptable-heartbeat-pause=20s -Dakka.cluster.downing-provider-class=
- MONGO_DB_HOSTNAME=mongodb
# in order to write logs into a file you can enable this by setting the following env variable
# the log file(s) can be found in /var/log/ditto directory on the host machine
- DITTO_LOGGING_FILE_APPENDER=true
- DITTO_METRICS_ENABLED=true
ports:
- "9095:9095"
volumes:
- ditto_log_files:/var/log/ditto
healthcheck:
test: curl --fail `hostname`:8558/alive || exit 1
interval: 30s
timeout: 15s
retries: 4
start_period: 120s'
But the problem with this method is that I need to assign separate ports for other services namely things
things-search
and so on. I tried that also but that is not working at all. So, I tried
things:
image: docker.io/eclipse/ditto-things:${DITTO_VERSION:-latest}
mem_limit: 512m
restart: always
networks:
default:
aliases:
- ditto-cluster
depends_on:
- policies
environment:
- TZ=Europe/Berlin
- BIND_HOSTNAME=0.0.0.0
# Set additional configuration options here appending JAVA_TOOL_OPTIONS: -Dditto.things...
- JAVA_TOOL_OPTIONS=-XX:ActiveProcessorCount=2 -XX:+ExitOnOutOfMemoryError -XX:+UseContainerSupport -XX:+UseStringDeduplication -Xss512k -XX:MaxRAMPercentage=50 -XX:+UseG1GC -XX:MaxGCPauseMillis=150 -Dakka.coordinated-shutdown.exit-jvm=on -Dakka.cluster.shutdown-after-unsuccessful-join-seed-nodes=180s -Dakka.cluster.failure-detector.threshold=15.0 -Dakka.cluster.failure-detector.expected-response-after=10s -Dakka.cluster.failure-detector.acceptable-heartbeat-pause=20s -Dakka.cluster.downing-provider-class=
- MONGO_DB_HOSTNAME=mongodb
- SYSTEM_METRICS_ENABLED=true
- PROMETHEUS_ENABLED=true
- PROMETHEUS_HOSTNAME=0.0.0.0
- PROMETHEUS_PORT=9095
# in order to write logs into a file you can enable this by setting the following env variable
# the log file(s) can be found in /var/log/ditto directory on the host machine
- DITTO_LOGGING_FILE_APPENDER=true
# only needed if DITTO_LOGGING_FILE_APPENDER is set
volumes:
- ditto_log_files:/var/log/ditto
healthcheck:
test: curl --fail `hostname`:8558/alive || exit 1
interval: 30s
timeout: 15s
retries: 4
start_period: 120s'
But it is still not working. Please suggest something to get all the metrics at one single port i.e. localhost:9095
.
You won't be able to map all of the 5 different Eclipse Ditto service's metrics endpoint to you local machine at the same port 9095
.
But you also don't need to.
What you probably need and want to do is to also add prometheus to your docker-compose.yaml
and to scrape the different metrics endpoints from all Ditto services.
Therefore, you don't need to map the port to be available on your local machine, so you can remove that from your docker-compose.yaml:
ports:
- "9095:9095"
If you add prometheus to your docker-compose.yaml, you can simply reach the Ditto prometheus metrics endpoints by using their DNS name. So you can (and need to) configure Prometheus to scrape e.g. endpoints:
http://policies:9095/metrics
http://things:9095/metrics
http://gateway:9095/metrics
...