Skip to content

A.1. Reference and Troubleshooting

Overview​

This chapter gathers the full list of auto-instrumentation labels and annotations, injected environment variables, and HPA metrics, together with frequently asked questions and the commands used for checking.

1. Label and Annotation Reference (Auto-Instrumentation)​

One label selects the instrumentation target; every detail setting is an annotation.

Label -- spec.template.metadata.labels​

LabelRequiredDefaultAllowed values / example
openmaru.io/was-agentrequired—'true'

Annotations -- spec.template.metadata.annotations​

AnnotationRequiredDefaultAllowed values / example
openmaru.io/container-namesoptionalallComma-separated container names (e.g. testapp, app,sidecar)
openmaru.io/was-agent-versionoptionalset at install timeImage tag (e.g. 5.1.0-11.1)
openmaru.io/was-agent-image-pull-policyoptionalIfNotPresentIfNotPresent / Always

These three are still read from labels for existing deployments. When the same key is present as both a label and an annotation, the annotation wins.

2. Injected Environment Variable Reference​

One of the same name that already exists is not overwritten. JAVA_TOOL_OPTIONS alone is appended.

Environment variableDefault behaviour
OMAPM_HOSTThe Operator's OMAPM_HOST when unset
OMAPM_PORTThe Operator's OMAPM_PORT when unset
OMAPM_APPLICATION_NAME<container>-${HOSTNAME:-:2}
OMAPM_INSTANCE_ID<container>-${HOSTNAME:-:2}-${HOSTNAME:-:3}
OMAPM_TRANSACTION_TRACE_THRESHOLD500 (ms)
JAVA_TOOL_OPTIONS-javaagent:/khan-agent/khan-agent-<version>.jar (appended)

CATALINA_OPTS_APPEND, JAVA_OPTS_APPEND and JAVA_OPTS are left alone. Whatever the application sets stays as it is.

The default of OMAPM_APPLICATION_NAME contains the ReplicaSet hash, so it changes on every redeploy. If you autoscale on it, set the value yourself to pin it (302 section 3.1).

3. Operator Installation Environment Variable Reference​

KeyComponentMeaning
IMAGE_REGISTRYAgentThe registry for the khan-agent image to inject
IMAGE_NAMESPACEAgentThe namespace within the registry (leading / included)
OMAPM_HOST / OMAPM_PORTAgentThe default APM server for the instrumented target
Each name/value in envHpaHPAThe apmAlias → APM server URL mapping
DEFAULT_AGENT_VERSIONAgentThe default image tag of the agent to inject
<apmAlias>_ACCESS_KEYHPAThat APM server's API access key. Pair one with every alias -- without it APM answers HTTP 403
TLS_CERT_FILE / TLS_KEY_FILEbothPaths to the server certificate and key. The chart mounts the secret and fills these in

4. HPA Metric Reference​

Metricselector labelsWhat is queried
tpsapmAlias, groupNameThe TPS from {APM}/monitoring/api/metrics/apps/info/{groupName}

5. Frequently Asked Questions (FAQ)​

Q. Do I have to change the application image?

No. Adding the label is enough. The agent is injected by an init container and the original image is untouched.

Q. I already use -javaagent or OMAPM_HOST.

The environment variables you set win (they are not overwritten). JAVA_TOOL_OPTIONS is appended after the existing value.

Q. What about a pod with several containers?

Name the containers to instrument with the openmaru.io/container-names annotation.

Q. Can it be used alongside a CPU/memory HPA?

Yes. A standard HPA's metrics array can hold Resource (cpu/memory) and External (tps) together.

Q. I have several APM servers.

Register each under its alias (name) in envHpa and select with apmAlias in the HPA (see 302 Autoscaling).

6. Troubleshooting at a Glance​

AreaSymptomWhat to do
InstallationThe Operator pods do not come upCheck the state and logs with kubectl get pod -n openmaru-apm, and check Helm enabled: true
InstrumentationThe agent is not injectedCheck the label position (spec.template.metadata.labels) and the value 'true'
InstrumentationThe image fails to pullCheck the image built from IMAGE_REGISTRY/IMAGE_NAMESPACE plus was-agent-version exists
InstrumentationNot shown in the APM consoleCheck OMAPM_HOST/OMAPM_PORT are reachable
HPATARGETS <unknown>kubectl describe hpa <name> shows the reason in Events
HPAScaling stopped after a redeployThe group name has most likely changed. Pin OMAPM_APPLICATION_NAME
HPAHTTP 403Check that <apmAlias>_ACCESS_KEY is paired with the alias
HPAScaling on apdex moves the wrong wayUse apdexDeficit
HPAIt does not scaleReview minReplicas/maxReplicas and target.value
Installhelm stops saying caBundle/tlsCrt/tlsKey are emptyThe certificate values have to be supplied (201 section 5)

7. Commands for Checking​

# Operator state
kubectl get pod -n openmaru-apm
kubectl logs deploy/openmaru-operator-apm-agent -n openmaru-apm
kubectl logs deploy/openmaru-operator-apm-hpa -n openmaru-apm

# confirm instrumentation applied
kubectl describe pod <pod> | grep -E "khan-agent-init|khan-data"
kubectl set env pod/<pod> --list | grep -E "OMAPM_|JAVA_TOOL_OPTIONS"

# HPA / external metrics
kubectl get hpa
kubectl get --raw "/apis/external.metrics.k8s.io/v1beta1/namespaces/<ns>/tps" | jq .