otel-profiling-agent icon indicating copy to clipboard operation
otel-profiling-agent copied to clipboard

Make packages `internal` to separate public and internal APIs

Open rockdaboot opened this issue 1 year ago • 6 comments

Every package that is not meant to be used externally, should be made private explicitly.

We possibly start making everything private (= putting under internal/) except

  • libpf/
  • reporter/
  • tracer/
  • hostmetadata/
  • times/
  • tracehandler/ and then iterate on further improvements/restrictions from there.

It would be good to know, which parts of the profiler code needs to be accessible from custom agents (@felixge @brancz).

rockdaboot avatar Aug 23 '24 08:08 rockdaboot

~The list looks good, except for reporter, which should definitely be public: its interface is one of the primary customization points.~ (nvm, misread OP)

athre0z avatar Aug 23 '24 11:08 athre0z

It might be worth consindering to make github.com/open-telemetry/opentelemetry-ebpf-profiler/host private. This package provides types that are only internal to the agent and should not be part of a public API. Besides the unfortunate naming, using the package github.com/open-telemetry/opentelemetry-ebpf-profiler/host without having more insight knowledge might just be confusing.

Is there an overall idea how public APIs for public packages should look like, that can be discussed upfront?

florianl avatar Aug 23 '24 12:08 florianl

It might be worth consindering to make github.com/open-telemetry/opentelemetry-ebpf-profiler/host private.

:+1: Removed from the list

rockdaboot avatar Aug 23 '24 13:08 rockdaboot

Thanks for raising this. We'll discuss it and provide feedback. Sorry for the delay.

felixge avatar Aug 28 '24 08:08 felixge

We're currently using util to be able to implement the Reporter interface which requires util.SourceLineno: https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/dd98f7080855cea3a2c03dda99283fbec964b105/reporter/iface.go#L75-L76

Would it be possible to also expose util or alternatively move util.SourceLineno to a publicly exported package?

Gandem avatar Aug 28 '24 09:08 Gandem

We're currently using util to be able to implement the Reporter interface which requires util.SourceLineno:

@Gandem Thanks for pointing out, makes much sense. See #156

rockdaboot avatar Sep 16 '24 06:09 rockdaboot