Documentation ¶
Overview ¶
Copyright 2022 Fortio Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Remote API to trigger load tests package (REST API).
Index ¶
- Constants
- Variables
- func AddHandlers(mux *http.ServeMux, uiPath, datadir string)
- func AddRun(ro *periodic.RunnerOptions) int64
- func DataList() (dataList []string)
- func Error(w http.ResponseWriter, msg string, err error)
- func FormValue(r *http.Request, json map[string]interface{}, key string) string
- func GetAllRuns() []*periodic.RunnerOptions
- func GetConfigAtPath(path string, data []byte) (map[string]interface{}, error)
- func GetDataDir() string
- func GetRun(id int64) *periodic.RunnerOptions
- func RESTRunHandler(w http.ResponseWriter, r *http.Request)
- func RESTStatusHandler(w http.ResponseWriter, r *http.Request)
- func RESTStopHandler(w http.ResponseWriter, r *http.Request)
- func RemoveRun(id int64)
- func Run(w http.ResponseWriter, r *http.Request, jd map[string]interface{}, ...)
- func SaveJSON(name string, json []byte) string
- func SendTSVDataIndex(urlPrefix string, w http.ResponseWriter)
- func SetDataDir(datadir string)
- func StopByRunID(runid int64) int
- type AsyncReply
- type StatusReply
Constants ¶
const (
ModeGRPC = "grpc"
)
Variables ¶
var ( // Default percentiles when not otherwise specified. DefaultPercentileList []float64 )
Functions ¶
func AddHandlers ¶
AddHandlers adds the REST Api handlers for run, status and stop. uiPath must end with a /.
func AddRun ¶
func AddRun(ro *periodic.RunnerOptions) int64
func DataList ¶
func DataList() (dataList []string)
DataList returns the .json files/entries in data dir.
func Error ¶
func Error(w http.ResponseWriter, msg string, err error)
Error writes serialized ServerReply marked as error, to the writer.
func FormValue ¶
FormValue gets the value from the query arguments/url parameter or from the provided map (json data).
func GetAllRuns ¶ added in v1.35.0
func GetAllRuns() []*periodic.RunnerOptions
func GetConfigAtPath ¶
GetConfigAtPath deserializes the bytes as JSON and extracts the map at the given path (only supports simple expression: . is all the json .foo.bar.blah will extract that part of the tree.
func GetDataDir ¶
func GetDataDir() string
func GetRun ¶ added in v1.35.0
func GetRun(id int64) *periodic.RunnerOptions
func RESTRunHandler ¶
func RESTRunHandler(w http.ResponseWriter, r *http.Request)
RESTRunHandler is api version of UI submit handler.
func RESTStatusHandler ¶
func RESTStatusHandler(w http.ResponseWriter, r *http.Request)
RESTStatusHandler will print the state of the runs.
func RESTStopHandler ¶
func RESTStopHandler(w http.ResponseWriter, r *http.Request)
RESTStopHandler is the api to stop a given run by runid or all the runs if unspecified/0.
func Run ¶
func Run(w http.ResponseWriter, r *http.Request, jd map[string]interface{}, runner, url string, ro periodic.RunnerOptions, httpopts *fhttp.HTTPOptions, )
Run executes the run (can be called async or not, writer is nil for async mode).
func SendTSVDataIndex ¶
func SendTSVDataIndex(urlPrefix string, w http.ResponseWriter)
format for gcloud transfer https://cloud.google.com/storage/transfer/create-url-list
func SetDataDir ¶
func SetDataDir(datadir string)
func StopByRunID ¶
StopByRunID stops all the runs if passed 0 or the runid provided.
Types ¶
type AsyncReply ¶ added in v1.35.0
type AsyncReply struct { jrpc.ServerReply RunID int64 Count int }
AsyncReply is returned when async=on is passed.
type StatusReply ¶ added in v1.35.0
type StatusReply struct { AsyncReply Runs []*periodic.RunnerOptions }