-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Probes #1105
Comments
That's a great idea. |
Yeah I think a refined, exposed Probe interface inherently provides the mechanism for custom probes. But calling out that that is intentional is good to do |
I'm happy to have this issue be the place we discuss the needed probe changes. 👍 |
I'll try to list the main points I was thinking about: Changes to the current functions
|
@RonFed this is a great overview, thanks for writing that up
Different types of probes makes sense too. Could you generalize it even further to something like |
From the sig meeting, my thinking of basing Probe config off the k8s scheduler framework (specifically the Plugin API) If we have 2 types of probe So our root API would provide (something like) // go.otel.io/auto/api
// Base types for probe and config
type Config interface {
Package() string
}
type Probe interface {
ApplyConfig(Config)
} And we also require a standard Then a user (or us) could import it and implement their custom probe // github.com/me/foo-auto
// ProbeA implementations
type ProbeA interface {
Probe
DoProbeAThing()
}
type ProbeAConfig struct {
CustomA string
CustomSetting int
}
func (a *ProbeAConfig) Package() string {
return a.CustomA
}
func New(otelauto.Config probeConfig) otelauto.Probe {
probeAconfig := probeConfig.(*ProbeAConfig)
doThing(probeAconfig.CustomSetting)
return ProbeA{...}
} There's some examples of this in place in this scheduler repo. I've just always thought it was a cool approach and think it fits here too |
@damemi I'm not sure I understood your suggestion. Assuming our current probe for simplicity, can you give an example of how configuration of HTTP or DB will look? |
@RonFed I'll try to put together a more concrete prototype, I was looking into it and got kind of sidetracked just thinking about the overall structure. On that note, I have some ideas of what the final layout could look like for the Probe api that might help as an end goal:
Something like: import (
"go.opentelemetry.io/auto"
"go.opentelemetry.io/auto/probes/net/http"
"github.com/damemi/customprobe"
)
func main() {
inst, err := auto.NewInstrumentation(ctx,
auto.WithProbes(
http.New(),
customprobe.New())
)
...
} Is this kind of what people were thinking for a public Probe api? |
@damemi Yes, that is what I was thinking about as well in terms of our end goal in this issue. |
as part of this (and shifting Probes to |
@damemi The configuration example looks great to me. |
@RonFed yeah I just used Overall this is really pretty much exactly how the Collector does config for different components. It's kind of similar to the k8s scheduler like I mentioned. But yes I think it's better to have the configuration exposed in a concrete type that's owned by the Probe itself, so that's the main idea with this approach |
SIG meeting notes:
|
An interesting thought: with custom probes, this opens up the possibility to start instrumenting binaries other than Go (i.e. Rust, C++). Especially if the offsets are self contained in the probe. |
@damemi I think we can try and add the configuration layer similar to your example as a first step. |
The current type Probe interface {
// ...
Run(tracesChan chan<- ptrace.ScopeSpans)
Close() error
} IssuesThe channel passed to
|
Having this include an // Telemetry is the data read by a probe.
type Telemetry struct {
ScopeSpans ptrace.ScopeSpans
// Error is the error encountered when reading the telemetry data.
Error error
} |
Based on #1248, this proposal should be revised to: type Probe interface {
// ...
Run(func(Telemetry))
Close() error
} |
@MrAlias and I were talking about this last week, and I think the points we came up with for the design were (let me know if I missed anything):
Tyler suggested a factory pattern for this, and I agree that would probably check all the boxes. I can work on a POC for that this week. I'd like to implement this in a way that first wraps the current Probes so that we can transition one by one in smaller PRs. |
The factory pattern will be good to start internally. To fully support this from external users we will need to support multi-target running (#197). |
I think the Probe interface should have a way of stating which versions it supports - |
Is this something you see the |
Yea, that makes sense. We can add library version support and Go version support as part of the Manifest. |
There are many packages that are not instrumented by this project. Some open-source and others closed-source. There should be a way to configure a custom
Probe
definition that users can provide and would provide instrumentation for these unsupported packages.The text was updated successfully, but these errors were encountered: