Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Create a skeleton shipper executable #6

Closed
Tracked by #15
cmacknz opened this issue Mar 16, 2022 · 12 comments
Closed
Tracked by #15

Create a skeleton shipper executable #6

cmacknz opened this issue Mar 16, 2022 · 12 comments
Assignees
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v8.3.0

Comments

@cmacknz
Copy link
Member

cmacknz commented Mar 16, 2022

Create a skeleton shipper executable that:

  • Logs to stdout per the control plane pipeline specification.
  • Starts a gRPC server when run, that exposes the event gRPC service.
  • Can start an HTTP server based on a command line flag that:
    • Exposes the /debug/vars endpoint for metrics (or similar, like the beats /stats endpoint).
    • Exposes the /debug/pprof endpoint for profiling.
  • Consumes a configuration file that can configure the gRPC and HTTP interfaces at a minimum. The configuration file will be a subsection of the Elastic agent policy and should use the same format.

Attempt to reuse as much of the agent code as we can for these tasks: elastic/elastic-agent#276

@cmacknz cmacknz changed the title Create a skeleton shipper executable with all required interfaces Create a skeleton shipper executable Mar 18, 2022
@cmacknz cmacknz added the v8.3.0 label Mar 18, 2022
@jlind23 jlind23 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Mar 21, 2022
@fearful-symmetry
Copy link
Contributor

Okay, finally digging into this and how it should work. I'm kind of working on the assumption that the first PR/commit will literally be a gRPC skeleton with some basic server code. However, I'm not quite sure what the interface between the gRPC server and the memory queue is supposed to look like.

@cmacknz
Copy link
Member Author

cmacknz commented Mar 29, 2022

Let's not worry about the interface to the memory queue yet. Let's just get an executable with a gRPC server running.

We can sort out how the memory queue connects gRPC interface as part of #7.

Once we have all the gRPC scaffolding done, you can move onto #11 and leave the output pipeline as part of #7

@fearful-symmetry
Copy link
Contributor

So, now that I have a basic shipper up, I'm looking at the http/pprof requirement here. The elastic-agent actually has a bunch of the init/management code in internal/pkg/agent/cmd/run.go. I'm kind of wondering if we should library-ize this existing code and the associated config objects, then import them back into agent and the shipper. Thoughts @kvch @cmacknz ?

@cmacknz
Copy link
Member Author

cmacknz commented Mar 30, 2022

I'm kind of wondering if we should library-ize this existing code and the associated config objects, then import them back into agent and the shipper. Thoughts @kvch @cmacknz ?

Not a bad idea, that code already has the signal handling setup and will probably use the agent policy config format (what the shipper should use). Might be a bit of work though, I'd ask the control plane team what they think and if it's a good idea create a separate issue to do it.

@fearful-symmetry
Copy link
Contributor

@elastic/elastic-agent-control-plane Do we have any opinions on this?

So, now that I have a basic shipper up, I'm looking at the http/pprof requirement here. The elastic-agent actually has a bunch of the init/management code in internal/pkg/agent/cmd/run.go. I'm kind of wondering if we should library-ize this existing code and the associated config objects, then import them back into agent and the shipper.

@ph
Copy link

ph commented Mar 30, 2022

Thanks for the ping, this is good timing indeed, last Friday. I was looking at our run and how we are bootstrapping our system in Agent. I am not a super fan of how it's currently made. We have indeed inherited some of the beats cruft and some of our own.. so I've started this experimentation. https://github.com/ph/vif/blob/main/cmd/vif/main.go I wanted to facilitate our development of the v2 and be able to mock inputs/shippers.

  • I wanted to simplify the bootstrap.
  • Separate the signal handling and the execution so we can test the initialization of the application without signals.
  • Having a more sane logger started early and being able to change log level on the fly.
  • Having a more well-defined startup: Metric, Httprof, and other subsystem.
  • Making it composable as a library.

I think having a library that makes little assumption would make a lot of sense.

  • Shipper could use it
  • When we refactor the input it could use it.
  • We can refactor the agent to use it.

@fearful-symmetry creates an issue I would be happy to drop a few things on our side.

@ph
Copy link

ph commented Mar 30, 2022

Note: the code was just an experiment, take it with a grain of salt. :)

@fearful-symmetry
Copy link
Contributor

I think once #29 is merged, we should be able to close this?

@cmacknz
Copy link
Member Author

cmacknz commented Apr 26, 2022

The only additional thing I think we are missing is signal handling for graceful shutdown. This is provided in the libbeat service package for example: https://github.com/elastic/beats/blob/main/libbeat/service/service.go#L42

We could do that under this issue or make a separate issue for it.

@fearful-symmetry
Copy link
Contributor

Ah, I knew I was forgetting something.

@fearful-symmetry
Copy link
Contributor

The merged queue monitor also includes a signal handler for shutdown, so we should be good here?

@cmacknz
Copy link
Member Author

cmacknz commented May 2, 2022

Yes, closing. Thanks!

@cmacknz cmacknz closed this as completed May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team v8.3.0
Projects
None yet
Development

No branches or pull requests

4 participants