Skip to content

The five windows onto the engine that every ACM lab uses, set up in M0-S2. Names are Larkspur Lab’s: cluster lk-lab, release lk, namespace larkspur, datastores in namespace datastores, bus virtual host lk, platform databases prefixed lk-. Keep this page open during every lab.

Terminal window
export BASE=http://localhost # Larkspur Lab; use your Larkspur Dev address for Dev
read -rs TOKEN && export TOKEN # the Larkspur Workbench token; never in a file
export values="-f lk-values.yaml -f lk-secrets.yaml -f pack-values.yaml"
R="-s -u lab:lab-only-rabbit -H content-type:application/json" # the bus tap's management calls

Port-forwards, each in its own terminal: RabbitMQ management kubectl -n datastores port-forward svc/rabbitmq 15672:15672 · Mailpit kubectl -n datastores port-forward svc/mailpit 8025:8025.

JobCommand
A call with your own trace idcurl -s -H "x-app-token: $TOKEN" -H "x-correlation-id: lk-<you>-<n>" "$BASE/api/…"
The modulescurl -s -H "x-app-token: $TOKEN" "$BASE/api/v1/data-module" | jq '.result[] | {id, normalizedName}'
An entity’s idcurl -s -G -H "x-app-token: $TOKEN" "$BASE/api/v1/entities" --data-urlencode 'filter={"where":{"normalizedName":"<entity>"}}' | jq -r '.result[0].id'
An entity’s recordscurl -s -H "x-app-token: $TOKEN" "$BASE/api/v2/entities/<entity id>/entries" | jq (by id: on 1.10 a list by normalized name answers empty unless you have Edit at system level)
One recordcurl -s -H "x-app-token: $TOKEN" "$BASE/api/v1/entities/<entity>/entries/<id>" | jq
Headers and status tooadd -i (or -D - to print headers before a piped body)

Read the answer before the body: success: true with result, or success: false with error.code, error.message and error.traceId. A /v3 GET answers with the bare body. The workbench credential is for GET only.

JobCommand
One id in every podkubectl -n larkspur logs -l app.kubernetes.io/instance=lk --all-containers --prefix --since=10m --max-log-requests=30 | grep <id>
One service onlykubectl -n larkspur logs deploy/<deployment> --since=10m | grep <id>
Readable linesappend | sed 's/^[^{]*//' | jq -c '{service, level, msg, correlationId}'
A crashed containerkubectl -n larkspur logs <pod> --previous

Every line is one JSON object with service, level, msg, and inside a request or a message handler, correlationId, userId and spaceId. Work that carries no id logs NO-TRACE-ID.

JobCommand
Tracer onkubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_on -p lk
Create the tap (once)curl $R -X PUT http://localhost:15672/api/queues/lk/acm-tap -d '{"durable":false,"arguments":{"x-max-length":500}}'
Bind it (once)curl $R -X POST http://localhost:15672/api/bindings/lk/e/amq.rabbitmq.trace/q/acm-tap -d '{"routing_key":"publish.#"}'
Also catch deliveries (once; M2-S2)curl $R -X POST http://localhost:15672/api/bindings/lk/e/amq.rabbitmq.trace/q/acm-tap -d '{"routing_key":"deliver.#"}'
Empty it before a testcurl $R -X DELETE http://localhost:15672/api/queues/lk/acm-tap/contents
Read what it caughtcurl $R -X POST http://localhost:15672/api/queues/lk/acm-tap/get -d '{"count":20,"ackmode":"ack_requeue_false","encoding":"auto"}' | jq
Just exchange and keyappend | jq '.[] | {x: .properties.headers.exchange_name, k: .properties.headers.routing_keys}'
One line per trace (publish.<exchange> or deliver.<queue>)append | jq -r '.[].routing_key'
Payloadsappend | jq '.[].payload | fromjson'
Who published (pod address)jq '.[0].properties.headers.connection', then kubectl -n larkspur get pods -o wide
Queues, consumers, depthkubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl list_queues -p lk name consumers messages
Tracer offkubectl -n datastores exec deploy/rabbitmq -- rabbitmqctl trace_off -p lk

Never take messages from a platform queue (…-service-queue): only from acm-tap. Switch the tracer off when you finish a lab; it copies every message.

JobCommand
Open the data databasekubectl -n datastores exec -it mongo-0 -- mongosh --quiet lk-data
Which databasesshow dbs (each platform database starts with lk-)
An entity’s recordsdb.<entity normalized name>.find({}, {id:1, state:1, value:1}).limit(5)
A definitiondb.DataEntity.findOne({normalizedName: "<entity>"})
How manydb.<entity>.countDocuments({state: 1})
Applied migrationsdb.Migration.find().sort({_id:-1}).limit(5)
See the pipeline a read ran (M3-S2)db.setProfilingLevel(2), run the read, then db.system.profile.find({ns: "lk-data.<entity>"}).sort({ts:-1}).limit(1).forEach(p => printjson(p.command.pipeline)); always db.setProfilingLevel(0) after

Only find, findOne, countDocuments, aggregate, explain and show, plus the profiler switch in the lab. Never insert, update, delete, drop or createIndex: the platform changes its own data, so every engine sees the change.

Signed in as rami.aziz. The designer: Administration › Applications › Modules. Run histories: Administration › Monitoring. Each record’s own history is on the record.

ToDo
Reset the suite’s datanode larkspur-pack/seed/seed.mjs --base-url $BASE --reset
Rebuild the whole labkind delete cluster --name lk-lab, then M0-S2 from step 1
  • Write to MongoDB, flush Redis, or delete a queue or a migration record to make an error go away.
  • Put a token or password in a file, a command line or a screenshot.
  • Use the workbench credential, the tracer or these lab passwords anywhere but your lab.