diff --git a/internal/dslx/dns.go b/internal/dslx/dns.go index 92c4e850d6..61e6ff3771 100644 --- a/internal/dslx/dns.go +++ b/internal/dslx/dns.go @@ -107,9 +107,8 @@ func DNSLookupGetaddrinfo(rt Runtime) Func[*DomainToResolve, *ResolvedAddresses] } return &Maybe[*ResolvedAddresses]{ - Error: err, - Observations: maybeTraceToObservations(trace), - State: state, + Error: err, + State: state, } }) } @@ -158,9 +157,8 @@ func DNSLookupUDP(rt Runtime, endpoint string) Func[*DomainToResolve, *ResolvedA } return &Maybe[*ResolvedAddresses]{ - Error: err, - Observations: maybeTraceToObservations(trace), - State: state, + Error: err, + State: state, } }) } diff --git a/internal/dslx/fxcore.go b/internal/dslx/fxcore.go index 814e533954..4ed1450dba 100644 --- a/internal/dslx/fxcore.go +++ b/internal/dslx/fxcore.go @@ -22,9 +22,8 @@ type Operation[A, B any] func(ctx context.Context, a A) *Maybe[B] func (op Operation[A, B]) Apply(ctx context.Context, a *Maybe[A]) *Maybe[B] { if a.Error != nil { return &Maybe[B]{ - Error: a.Error, - Observations: a.Observations, - State: *new(B), // zero value + Error: a.Error, + State: *new(B), // zero value } } return op(ctx, a.State) @@ -36,9 +35,6 @@ type Maybe[State any] struct { // Error is either the error that occurred or nil. Error error - // Observations contains the collected observations. - Observations []*Observations - // State contains state passed between function calls. You should // only access State when Error is nil and Skipped is false. State State @@ -47,9 +43,8 @@ type Maybe[State any] struct { // NewMaybeWithValue constructs a Maybe containing the given value. func NewMaybeWithValue[State any](value State) *Maybe[State] { return &Maybe[State]{ - Error: nil, - Observations: []*Observations{}, - State: value, + Error: nil, + State: value, } } @@ -74,9 +69,8 @@ func (h *compose2Func[A, B, C]) Apply(ctx context.Context, a *Maybe[A]) *Maybe[C if mb.Error != nil { return &Maybe[C]{ - Error: mb.Error, - Observations: mb.Observations, - State: *new(C), // zero value + Error: mb.Error, + State: *new(C), // zero value } } @@ -84,8 +78,7 @@ func (h *compose2Func[A, B, C]) Apply(ctx context.Context, a *Maybe[A]) *Maybe[C runtimex.Assert(mc != nil, "h.g.Apply returned a nil pointer") return &Maybe[C]{ - Error: mc.Error, - Observations: append(mb.Observations, mc.Observations...), // merge observations - State: mc.State, + Error: mc.Error, + State: mc.State, } } diff --git a/internal/dslx/fxcore_test.go b/internal/dslx/fxcore_test.go index 182a584120..13238843aa 100644 --- a/internal/dslx/fxcore_test.go +++ b/internal/dslx/fxcore_test.go @@ -27,11 +27,6 @@ func (f *fn) Apply(ctx context.Context, i *Maybe[int]) *Maybe[int] { return &Maybe[int]{ Error: f.err, State: i.State + 1, - Observations: []*Observations{ - { - NetworkEvents: []*model.ArchivalNetworkEvent{{Tags: []string{"apply"}}}, - }, - }, } } @@ -50,9 +45,8 @@ func TestStageAdapter(t *testing.T) { // create input that contains an error input := &Maybe[*DomainToResolve]{ - Error: errors.New("mocked error"), - Observations: []*Observations{}, - State: nil, + Error: errors.New("mocked error"), + State: nil, } // run the pipeline @@ -91,9 +85,6 @@ func TestCompose2(t *testing.T) { if r.Error != tt.err { t.Fatalf("unexpected error") } - if len(r.Observations) != tt.numObs { - t.Fatalf("unexpected number of (merged) observations") - } }) } }) diff --git a/internal/dslx/httpcore.go b/internal/dslx/httpcore.go index 21d853c745..683070a4a0 100644 --- a/internal/dslx/httpcore.go +++ b/internal/dslx/httpcore.go @@ -151,9 +151,8 @@ func HTTPRequest(rt Runtime, options ...HTTPRequestOption) Func[*HTTPConnection, } return &Maybe[*HTTPResponse]{ - Error: err, - Observations: observations, - State: state, + Error: err, + State: state, } }) } diff --git a/internal/dslx/httpquic.go b/internal/dslx/httpquic.go index 2977e032a0..18ffaac4a8 100644 --- a/internal/dslx/httpquic.go +++ b/internal/dslx/httpquic.go @@ -35,9 +35,8 @@ func HTTPConnectionQUIC(rt Runtime) Func[*QUICConnection, *HTTPConnection] { Transport: httpTransport, } return &Maybe[*HTTPConnection]{ - Error: nil, - Observations: nil, - State: state, + Error: nil, + State: state, } }) } diff --git a/internal/dslx/httptcp.go b/internal/dslx/httptcp.go index 9b285e8f20..f281a16235 100644 --- a/internal/dslx/httptcp.go +++ b/internal/dslx/httptcp.go @@ -36,9 +36,8 @@ func HTTPConnectionTCP(rt Runtime) Func[*TCPConnection, *HTTPConnection] { Transport: httpTransport, } return &Maybe[*HTTPConnection]{ - Error: nil, - Observations: nil, - State: state, + Error: nil, + State: state, } }) } diff --git a/internal/dslx/httptls.go b/internal/dslx/httptls.go index 0d41c80d93..3d0ccc63bb 100644 --- a/internal/dslx/httptls.go +++ b/internal/dslx/httptls.go @@ -36,9 +36,8 @@ func HTTPConnectionTLS(rt Runtime) Func[*TLSConnection, *HTTPConnection] { Transport: httpTransport, } return &Maybe[*HTTPConnection]{ - Error: nil, - Observations: nil, - State: state, + Error: nil, + State: state, } }) } diff --git a/internal/dslx/quic.go b/internal/dslx/quic.go index e5baedd0ca..6ab82c0896 100644 --- a/internal/dslx/quic.go +++ b/internal/dslx/quic.go @@ -71,9 +71,8 @@ func QUICHandshake(rt Runtime, options ...TLSHandshakeOption) Func[*Endpoint, *Q } return &Maybe[*QUICConnection]{ - Error: err, - Observations: maybeTraceToObservations(trace), - State: state, + Error: err, + State: state, } }) } diff --git a/internal/dslx/tcp.go b/internal/dslx/tcp.go index fb6628ca16..cc15bd5c69 100644 --- a/internal/dslx/tcp.go +++ b/internal/dslx/tcp.go @@ -55,9 +55,8 @@ func TCPConnect(rt Runtime) Func[*Endpoint, *TCPConnection] { } return &Maybe[*TCPConnection]{ - Error: err, - Observations: maybeTraceToObservations(trace), - State: state, + Error: err, + State: state, } }) } diff --git a/internal/dslx/tls.go b/internal/dslx/tls.go index b3d9bb8150..1add7d578c 100644 --- a/internal/dslx/tls.go +++ b/internal/dslx/tls.go @@ -96,9 +96,8 @@ func TLSHandshake(rt Runtime, options ...TLSHandshakeOption) Func[*TCPConnection } return &Maybe[*TLSConnection]{ - Error: err, - Observations: maybeTraceToObservations(trace), - State: state, + Error: err, + State: state, } }) } diff --git a/internal/tutorial/dslx/chapter02/README.md b/internal/tutorial/dslx/chapter02/README.md index 6cd72d5903..adac8b742e 100644 --- a/internal/tutorial/dslx/chapter02/README.md +++ b/internal/tutorial/dslx/chapter02/README.md @@ -107,21 +107,6 @@ type Subresult struct { ``` -Subresult.mergeObservations merges the observations collected during -a measurement with the Subresult output data format. - -```Go - -func (tk *Subresult) mergeObservations(obs []*dslx.Observations) { - for _, o := range obs { - tk.NetworkEvents = append(tk.NetworkEvents, o.NetworkEvents...) - tk.TCPConnect = append(tk.TCPConnect, o.TCPConnect...) - tk.TLSHandshakes = append(tk.TLSHandshakes, o.TLSHandshakes...) - } -} - -``` - ## The Measurer The `Measurer` performs the measurement and implements `ExperimentMeasurer`; i.e., the @@ -429,20 +414,6 @@ Store the control failure if any. ``` -The measurement result not only contains the potential error, but also -observations that have been collected during each step of the measurement pipeline. -Observations are for example network events like read and write operations, -TLS handshakes, or DNS queries. We as experiment programmers are responsible for -extracting these observations from the dslx measurement result and storing -them in the `TestKeys`, which is precisely what `Subresult.mergeObservations` -(implemented above) does. - -```Go - tk.Target.mergeObservations(targetResult.Observations) - tk.Control.mergeObservations(controlResult.Observations) - -``` - ### Return Finally, we can return, as the measurement ran successfully. diff --git a/internal/tutorial/dslx/chapter02/main.go b/internal/tutorial/dslx/chapter02/main.go index 9c033b30a9..95b398c942 100644 --- a/internal/tutorial/dslx/chapter02/main.go +++ b/internal/tutorial/dslx/chapter02/main.go @@ -106,21 +106,6 @@ type Subresult struct { Cached bool `json:"-"` } -// ``` -// -// Subresult.mergeObservations merges the observations collected during -// a measurement with the Subresult output data format. -// -// ```Go - -func (tk *Subresult) mergeObservations(obs []*dslx.Observations) { - for _, o := range obs { - tk.NetworkEvents = append(tk.NetworkEvents, o.NetworkEvents...) - tk.TCPConnect = append(tk.TCPConnect, o.TCPConnect...) - tk.TLSHandshakes = append(tk.TLSHandshakes, o.TLSHandshakes...) - } -} - // ``` // // ## The Measurer @@ -428,20 +413,6 @@ func (m *Measurer) Run(ctx context.Context, args *model.ExperimentArgs) error { tk.Control.Failure = &failure } - // ``` - // - // The measurement result not only contains the potential error, but also - // observations that have been collected during each step of the measurement pipeline. - // Observations are for example network events like read and write operations, - // TLS handshakes, or DNS queries. We as experiment programmers are responsible for - // extracting these observations from the dslx measurement result and storing - // them in the `TestKeys`, which is precisely what `Subresult.mergeObservations` - // (implemented above) does. - // - // ```Go - tk.Target.mergeObservations(targetResult.Observations) - tk.Control.mergeObservations(controlResult.Observations) - // ``` // // ### Return