-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[data streams] Test kafka confluent instrumentation
- Loading branch information
1 parent
882cddb
commit 0538d5d
Showing
8 changed files
with
205 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016 Datadog, Inc. | ||
|
||
package mocktracer | ||
|
||
import ( | ||
"compress/gzip" | ||
"net/http" | ||
|
||
"github.com/tinylib/msgp/msgp" | ||
|
||
"gopkg.in/DataDog/dd-trace-go.v1/internal/datastreams" | ||
) | ||
|
||
type mockDSMTransport struct { | ||
backlogs []datastreams.Backlog | ||
} | ||
|
||
// RoundTrip does nothing and returns a dummy response. | ||
func (t *mockDSMTransport) RoundTrip(req *http.Request) (*http.Response, error) { | ||
// You can customize the dummy response if needed. | ||
gzipReader, err := gzip.NewReader(req.Body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
var p datastreams.StatsPayload | ||
err = msgp.Decode(gzipReader, &p) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, bucket := range p.Stats { | ||
t.backlogs = append(t.backlogs, bucket.Backlogs...) | ||
} | ||
return &http.Response{ | ||
StatusCode: 200, | ||
Proto: "HTTP/1.1", | ||
ProtoMajor: 1, | ||
ProtoMinor: 1, | ||
Request: req, | ||
ContentLength: -1, | ||
Body: http.NoBody, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.