Documentation ¶
Index ¶
- Constants
- func AddFileToTar(tw *tar.Writer, name string, content []byte) error
- func AddFileToZip(zw *zip.Writer, name string, content []byte) error
- func CreateNamespace(ctx context.Context, client client.Client, namespaceName string) error
- func CreateObject(ctx context.Context, c client.Client, kind, namespace, name string, ...) error
- func DeleteNamespace(ctx context.Context, client client.Client, namespaceName string) error
- func DeleteObject(ctx context.Context, c client.Client, kind, namespace, name string) error
- func ExportResources(ctx context.Context, c client.Client, resInfoList []*ResourceLocator) (*bytes.Buffer, error)
- func ForObject(kind string) (client.Object, error)
- func GetDataSet(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.DataSet, error)
- func GetObject(ctx context.Context, c client.Client, kind, namespace, name string) (client.Object, error)
- func GetObjectList(ctx context.Context, c client.Client, kind string) (client.ObjectList, error)
- func GetSampleDataSet(ctx context.Context, c client.Client, namespace string, datasetName string) (string, *bytes.Buffer, error)
- func GetSchema(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.Schema, error)
- func ListKinds() []string
- func ListNamespaces(ctx context.Context, client client.Client) (*corev1.NamespaceList, error)
- func UpdateObject(ctx context.Context, c client.Client, kind, namespace, name string, ...) error
- type BiChanDataPoint
- type BiChanResponse
- type ChanType
- type CheckHTTPHealthRequest
- type ErrorResponse
- type ImportStatistics
- type LabelSelector
- type PromRequest
- type QueryAgent
- func (qa *QueryAgent) PromQuery(ctx context.Context, req *PromRequest) (*BiChanResponse, error)
- func (qa *QueryAgent) PromQueryRange(ctx context.Context, req *PromRequest) (*TriChanResponse, error)
- func (qa *QueryAgent) RedisGet(ctx context.Context, req *RedisRequest) (*RawResponse, error)
- func (qa *QueryAgent) RedisTSMultiGet(ctx context.Context, req *RedisTSRequest) (*BiChanResponse, error)
- func (qa *QueryAgent) RedisTSMultiRange(ctx context.Context, req *RedisTSRequest) (*TriChanResponse, error)
- type RawResponse
- type RedisRequest
- type RedisTSRequest
- type ResourceLocator
- type SourceType
- type TriChanDataPoint
- type TriChanResponse
- type UnixTimestamp
Constants ¶
const ( SchemaKind string = "Schema" DatasetKind string = "DataSet" LoadPatternKind string = "LoadPattern" PipelineKind string = "Pipeline" ExperimentKind string = "Experiment" PlantDCoreKind string = "PlantDCore" CostExporterKind string = "CostExporter" )
Constants defining the possible Kind names that can be used in the schema.GroupVersionKind struct.
Variables ¶
This section is empty.
Functions ¶
func AddFileToTar ¶
AddFileToTar adds a file with the given content to a tar.Writer.
func AddFileToZip ¶ added in v1.1.0
AddFileToZip adds a file with the given content to a zip.Writer.
func CreateNamespace ¶
CreateNamespace creates a new namespace with the provided name.
func CreateObject ¶
func CreateObject(ctx context.Context, c client.Client, kind, namespace, name string, obj client.Object) error
CreateObject creates a new object of the provided kind, namespace, name. Only the spec field of the obj parameter will be used.
func DeleteNamespace ¶
DeleteNamespace deletes the namespace with the provided name.
func DeleteObject ¶
DeleteObject deletes an existing object of the provided kind, namespace, name.
func ExportResources ¶ added in v1.1.0
func GetDataSet ¶ added in v1.1.0
func GetDataSet(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.DataSet, error)
GetDataSet retrieves a DataSet object by namespace and name.
func GetObject ¶
func GetObject(ctx context.Context, c client.Client, kind, namespace, name string) (client.Object, error)
GetObject retrieves an object of the provided kind, namespace, name.
func GetObjectList ¶
GetObjectList retrieves a list of objects of the provided kind.
func GetSampleDataSet ¶ added in v1.1.0
func GetSampleDataSet(ctx context.Context, c client.Client, namespace string, datasetName string) (string, *bytes.Buffer, error)
GetSampleDataSet generates a sample dataset based on the provided dataset name.
func GetSchema ¶
func GetSchema(ctx context.Context, c client.Client, namespace string, name string) (*windtunnelv1alpha1.Schema, error)
GetSchema retrieves a Schema object by namespace and name.
func ListNamespaces ¶
ListNamespaces retrieves a list of all namespaces.
Types ¶
type BiChanDataPoint ¶ added in v1.3.0
BiChanDataPoint defines the data point in bi-channel data. Using `*float64` instead of `float64` to avoid getting empty result from JSON marshaling.
type BiChanResponse ¶ added in v1.3.0
type BiChanResponse struct { // Result is a list of BiChanDataPoint Result []*BiChanDataPoint `json:"result"` }
BiChanResponse defines the response to send for bi-channel data.
type ChanType ¶ added in v1.3.0
type ChanType int8
ChanType is the type of channel number per data point in response data
type CheckHTTPHealthRequest ¶ added in v1.3.0
type CheckHTTPHealthRequest struct {
URL string `json:"url,omitempty"`
}
CheckHTTPHealthRequest defines the request to check health of a URL using HTTP protocol.
type ErrorResponse ¶ added in v1.3.0
type ErrorResponse struct {
Message string `json:"message,omitempty"`
}
ErrorResponse defines the response to send when error occurs.
type ImportStatistics ¶ added in v1.4.0
type ImportStatistics struct { // NumSucceeded is the number of resources that are successfully imported NumSucceeded int `json:"numSucceeded"` // NumFailed is the number of resources that failed to be imported NumFailed int `json:"numFailed"` // ErrorMessages contains the error messages if any ErrorMessages []string `json:"errors"` }
ImportStatistics contains the statistical result of importing resources.
func ImportResources ¶ added in v1.1.0
type LabelSelector ¶
type LabelSelector struct { TargetLabels []string // contains filtered or unexported fields }
func NewLabelSelector ¶
func NewLabelSelector(labels []string) *LabelSelector
func (*LabelSelector) GetSeriesFromPromMetric ¶ added in v1.3.0
func (ls *LabelSelector) GetSeriesFromPromMetric(m model.Metric) (string, error)
func (*LabelSelector) GetSeriesFromRedisRange ¶ added in v1.3.0
func (ls *LabelSelector) GetSeriesFromRedisRange(r redistimeseries.Range) (string, error)
type PromRequest ¶ added in v1.3.0
type PromRequest struct { Query string `json:"query,omitempty"` StartTimestamp UnixTimestamp `json:"start,omitempty"` EndTimestamp UnixTimestamp `json:"end,omitempty"` Step int64 `json:"step,omitempty"` LabelSelector []string `json:"labelSelector,omitempty"` }
PromRequest contains the parameters for making a "Query" or "QueryRange" request to Prometheus.
type QueryAgent ¶
type QueryAgent struct { PromAPI prometheusv1.API RedisClient *redis.Client RedisTSClient *redistimeseries.Client }
func NewQueryAgent ¶
func NewQueryAgent() (*QueryAgent, error)
func (*QueryAgent) PromQuery ¶ added in v1.3.0
func (qa *QueryAgent) PromQuery(ctx context.Context, req *PromRequest) (*BiChanResponse, error)
func (*QueryAgent) PromQueryRange ¶ added in v1.3.0
func (qa *QueryAgent) PromQueryRange(ctx context.Context, req *PromRequest) (*TriChanResponse, error)
func (*QueryAgent) RedisGet ¶ added in v1.4.0
func (qa *QueryAgent) RedisGet(ctx context.Context, req *RedisRequest) (*RawResponse, error)
func (*QueryAgent) RedisTSMultiGet ¶ added in v1.3.0
func (qa *QueryAgent) RedisTSMultiGet(ctx context.Context, req *RedisTSRequest) (*BiChanResponse, error)
func (*QueryAgent) RedisTSMultiRange ¶ added in v1.3.0
func (qa *QueryAgent) RedisTSMultiRange(ctx context.Context, req *RedisTSRequest) (*TriChanResponse, error)
type RawResponse ¶ added in v1.4.0
type RawResponse struct { // Result is a string Result string `json:"result"` }
RawResponse defines the response to send for raw data.
type RedisRequest ¶ added in v1.4.0
type RedisRequest struct {
Key string `json:"key,omitempty"`
}
RedisRequest contains the parameters for executing a "Get" command on Redis.
type RedisTSRequest ¶ added in v1.3.0
type RedisTSRequest struct { Filters []string `json:"filters,omitempty"` StartTimestamp UnixTimestamp `json:"start,omitempty"` EndTimestamp UnixTimestamp `json:"end,omitempty"` LabelSelector []string `json:"labelSelector,omitempty"` }
RedisTSRequest contains the parameters for executing a "MultiGet" or "MultiRange" command to Redis Time Series.
type ResourceLocator ¶ added in v1.4.0
type ResourceLocator struct { Kind string `json:"kind,omitempty"` Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` }
ResourceLocator contains the kind, namespace, and name that are necessary to locate a unique resource to export. Note that the group and version are fixed across all resources and are thus omitted.
func ListResources ¶ added in v1.4.0
type SourceType ¶ added in v1.3.0
type SourceType int8
SourceType is the type of data source
const ( Prometheus SourceType = iota Redis RedisTimeSeries )
type TriChanDataPoint ¶ added in v1.3.0
type TriChanDataPoint struct { Series string `json:"series"` ValueY *float64 `json:"y"` ValueX *float64 `json:"x"` }
TriChanDataPoint defines the data point in tri-channel data. Using `*float64` instead of `float64` to avoid getting empty result from JSON marshaling.
type TriChanResponse ¶ added in v1.3.0
type TriChanResponse struct { // Result is a list of TriChanDataPoint Result []*TriChanDataPoint `json:"result"` }
TriChanResponse defines the response to send for tri-channel data.
type UnixTimestamp ¶
UnixTimestamp is the Unix timestamp in second.
func (*UnixTimestamp) UnmarshalJSON ¶
func (ts *UnixTimestamp) UnmarshalJSON(b []byte) error