Visit Support

Monitoring Cloud Native Compiler

You can monitor your Cloud Native Compiler using the standard Kubernetes monitoring tools: Prometheus and Grafana. Cloud Native Compiler service components are already configured to expose key metrics for scraping by Prometheus.

Installing the Grafana Dashboard

<cnc-install-dir/grafana/cnc_dashabord.json is a Grafana configuration file for a dashboard of key Cloud Native Compiler metrics. You can import the dashbaord into your existing Grafana installation

Retrieving Cloud Native Compiler Logs

All Cloud Native Compiler components, including third-party ones, log some information to stdout. These logs are very important for diagnosing problems.

You can extract individual logs with the following command:

kubectl -n <my-namespace> logs <pod>

However by default Kubernetes keeps only the last 10 MB of logs for every container, which means that in a cluster under load the important diagnostic information can be quickly overwritten by subsequent logs.

You should configure log aggregation from all CNC components, so that logs are moved to some persistent storage and then extracted when some issue needs to be analyzed. You can use any log aggregation One suggested way is to use Loki. You can query the Loki logs using the logcli tool.

Here are some common commands you can run to retrieve logs:

  • Find out host and port where Loki is listening

    export LOKI_ADDR=http://<ip-adress>:<port>
  • Get logs of all pods in the selected namespace

    logcli query --since 24h --forward --limit=10000 '{namespace="zvm-dev-3606"}'
  • Get logs of a single application in the selected namespace

    logcli query --since 24h --forward --limit=10000 '{namespace="zvm-dev-3606" app="compile-broker"}'
  • Get logs of a single pod in the selected namespace

    logcli query --since 24h --forward --limit=10000 '{namespace="zvm-dev-3606",pod="compile-broker-5fd956f44f-d5hb2"}'

Extracting Compilation Artifacts

Cloud Native Compiler stores a record of every compilation request and its processing result in a Compilation Index. Also it stores logs of compiler engine executions. By default these logs only include information about failed compilations.

You can retrieve information from the Compilation Index using a special REST endpoint on the gateway:

  • /testing/compilations — returns JSON containing all compilations performed in the life of the serer

  • /testing/compilations?vmid=<VM_ID> — Returns the compilation history for a single VM identified by VM_ID ??? Ho do I get the VM_ID?

  • /testing/diagnostic-dump — returns a ZIP archive containing both compilation metadata and compiler engine logs (including crashdumps and coredumps if present) for all compilations that the service ever performed

  • /testing/diagnostic-dump?vmid=<VM_ID> — the same as above, but only for a single VM identified by VM_ID

It is recommended to only query these endpoints using the vmid=<VM_ID> parameter, as returning information for the entire history of the service can lead your Cloud Native Compiler service performance to degrade.