rapi

package
v1.35.0-pre1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2022 License: Apache-2.0 Imports: 23 Imported by: 2

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

View Source
const (
	ModeGRPC = "grpc"
)

Variables

View Source
var (

	// Default percentiles when not otherwise specified.
	DefaultPercentileList []float64
)

Functions

func AddHandlers

func AddHandlers(mux *http.ServeMux, uiPath, datadir string)

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

func FormValue(r *http.Request, json map[string]interface{}, key string) string

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

func GetConfigAtPath(path string, data []byte) (map[string]interface{}, error)

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 RemoveRun

func RemoveRun(id int64)

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 SaveJSON

func SaveJSON(name string, json []byte) string

SaveJSON save Json bytes to give file name (.json) in data-path dir.

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

func StopByRunID(runid int64) int

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL