The idea is to provide a manager that spawns mocked agents.
Each of these mocked agents provide the following endpoints:
- Agent ping. Eg:
/com.instana.plugin.golang.12345
- Discovery. Eg:
/com.instana.plugin.golang.discovery
- Traces. Eg:
/com.instana.plugin.golang/traces.12345
We assume default port 9090, but you can change it with the env var MOCK_AGENT_PORT
- Start the app
- To spawn a new mocked agent call
http://localhost:9090/spawn
. The body response and the headerX-MOCK-AGENT-PORT
will give the port number of the spawned agent. - If you want to specify a port, just call
http://localhost:9090/spawn/{SPECIFIC_PORT}
- Run the instrumented application normally, but remember to set the agent port to the new one
- If you want to see the spans that were sent to the agent, call
http://localhost:AGENT-PORT/dump
- To kill a spawned mocked agent call
http://localhost:9090/kill/AGENT-PORT
- If the mocked agent manager dies, all spawns die with it
We assume the first auto generated port 29091
, but you can specify a port by calling http://localhost:9090/spawn/{MY_PORT}
$ curl -D- -X -POST -d "$(cat ./fixtures/span.json)" "http://localhost:29091/com.instana.plugin.nodejs/traces.12345"
$ curl -D- -X -POST -d "$(cat ./fixtures/discovery_req.json)" "http://localhost:29091/com.instana.plugin.nodejs.discovery"
$ curl -D- "http://localhost:29091/com.instana.plugin.golang.12345"
Will start the agent manager with the given port.
Note
This is a pet project and should be treated as one.