opamp-go icon indicating copy to clipboard operation
opamp-go copied to clipboard

Ability to get a default configuration for agents in internal/examples/server

Open xrmx opened this issue 2 months ago • 5 comments

I would like to add some e2e tests for a python client and it would be handy being able to pass a default config via an option to the cli command instead of the UI so that I can run everything in CI.

xrmx avatar Oct 06 '25 08:10 xrmx

@xrmx Which CLI are you referring to?

juandemanjon avatar Oct 09 '25 04:10 juandemanjon

Instead of a CLI, the server can expose a REST API to accept the config and the Python test can do a POST to the server like for example:

curl -X POST localhost:4321/api/save_config -H "Content-Type: application/json" -d '{"instance_id":"0199c79
4738b7895bb6c5f7fbbf7b3d0", "body":"Zm9vLWJhcg=="}'

juandemanjon avatar Oct 09 '25 06:10 juandemanjon

@xrmx Which CLI are you referring to?

The internal/examples/server binary

Instead of a CLI, the server can expose a REST API to accept the config and the Python test can do a POST to the server like for example:

That would require to call it after the client has connected which should not be a problem. Said that I think the server atm is not showing plain http (no websocket) clients in the ui so not sure if that's only an ui issue or these client are just forgot.

xrmx avatar Oct 09 '25 07:10 xrmx

A complete solution could be:

  • Adding a flag to the server like --default-config <<filepath>> to initialize the default config for all the clients connections
  • Providing a REST api to set the config for a particular client/instance_id at runtime

juandemanjon avatar Oct 09 '25 22:10 juandemanjon

@xrmx Does any of the above solutions work for you?

juandemanjon avatar Oct 29 '25 17:10 juandemanjon