odigos-io / odigos

Distributed tracing without code changes. 🚀 Instantly monitor any application using OpenTelemetry and eBPF

Home Page:https://odigos.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odigos cli: start odigos ui from code instead of downloading and executing a binary file

blumamir opened this issue · comments

Current State

When a user executes odigos ui in the odigos cli, what currently happens is:

  1. the odigos UI executable is downloaded and extracted into the user file system here
  2. the odigos executable is started here

Drawbacks

  1. We need to interact with the machine FS, doing os.Stat, os.MkdirAll, os.Create, os.Chmod etc. While this works for normal users, it is not very robust, as os operations might fail. For example, when running the command inside a docker container, I get an error: Error downloading latest UI version: failed to create file: open /ko-app/odigos-ui: permission denied.
  2. If the CLI version is upgraded later on, then the odigos UI executable is not being updated as well, which means that users may very likely run an incompatible or old version of the UI, lacking new features and bug fixes.
  3. The cli needs to maintain a bulk of code to do all these operations, which I think can be simplified.

Suggested Change

Since the odigos-ui code is already written in go, and resides in the same repo, I want to suggest refactoring the UI module so that it can be started as an executable as it is now (with cli flags), and in addition, also expose a public function to start the UI from code.
I think that we can extract the actual functionality from the main function here into a different function, which will be called from main, but can also be called directly from the cli module. This function should get the flags and start an http server which will serve the browser.

How to Test

  1. setup a cluster and install odigos.
  2. run the cli from code as explained here
  3. Make sure you can start the UI from the cli after the change, open it, and execute operations on odigos.
  4. Verify odigos UI is able to run inside a docker container. We use ko to build a docker image and run it.

Getting Help

If you want to work on this issue, please feel free to ask any questions and share technical problems that you need help with. I can reply here, or in odigos slack

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.