Codhale metrics not coming in prometheus

42 Views Asked by At

I am new to working with containers.

I have an application that utilizes Hive Metastore in a Docker file. This application is relatively old, and upon inspecting the code, I noticed the following snippet. While I can observe metrics being generated in the EKS (Elastic Kubernetes Service) containers, I am not witnessing the same metrics in the ECS (Elastic Container Service) containers.

To address this issue, I believe I need to enable the CodahaleMetrics in my ECS container. It seems that incorporating the jmx_prometheus_javaagent is the key to achieving this.

This is the open source project: https://github.com/ExpediaGroup/apiary-metastore-docker/blob/master/files/startup.sh

This is my configuration

if [ -n "$ENABLE_METRICS" ]; then
    update_property.py hive.metastore.metrics.enabled true /etc/hive/conf/hive-site.xml
    #configure to send metrics to cloudwatch when running on ECS
    if [ -n "$ECS_CONTAINER_METADATA_URI" ]; then
        export CLOUDWATCH_NAMESPACE="${INSTANCE_NAME}-metastore"
        export ECS_TASK_ID=$(wget -q -O - ${ECS_CONTAINER_METADATA_URI}/task|jq -r .TaskARN|awk -F/ '{ print $NF }')
        update_property.py hive.service.metrics.class com.expediagroup.apiary.extensions.metastore.metrics.CodahaleMetrics /etc/hive/conf/hive-site.xml
    fi
    #enable prometheus jmx agent when running on kubernetes
    if [ -n "$KUBERNETES_SERVICE_HOST" ]; then
        export EXPORTER_OPTS="-javaagent:/usr/lib/apiary/jmx_prometheus_javaagent-${EXPORTER_VERSION}.jar=8080:/etc/hive/conf/jmx-exporter.yaml"
    fi
fi

ENABLE_METRICS is set to true

I also tried setting these, but it did not work.

export EXPORTER_OPTS="-javaagent:/usr/lib/apiary/jmx_prometheus_javaagent-${EXPORTER_VERSION}.jar=8080:/etc/hive/conf/jmx-exporter.yaml"
0

There are 0 best solutions below