-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose the instrumentHTTP function as part of the module's public API
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import http from "k6/http"; | ||
import { check } from "k6"; | ||
import tracing from "k6/experimental/tracing"; | ||
|
||
// instrumentHTTP will ensure that all requests made by the http module | ||
// will be traced. The first argument is a configuration object that | ||
// can be used to configure the tracer. | ||
// | ||
// Currently supported HTTP methods are: get, post, put, patch, head, | ||
// del, options, and request. | ||
tracing.instrumentHTTP({ | ||
propagator: "w3c", | ||
}); | ||
|
||
export default () => { | ||
let res = http.get("http://httpbin.org/get", { | ||
headers: { | ||
"X-Example-Header": "instrumented/get", | ||
}, | ||
}); | ||
check(res, { | ||
"status is 200": (r) => r.status === 200, | ||
}); | ||
}; |