objectstorage

package
v0.0.0-...-950e6cb Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EnvPromQueryObsTimeoutSecEnv = "PROM_QUERY_OBS_TIMEOUT_SEC"
)

Variables

View Source
var DefaultTransport = func(secure bool) http.RoundTripper {
	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:       5 * time.Second,
			KeepAlive:     15 * time.Second,
			FallbackDelay: 100 * time.Millisecond,
		}).DialContext,
		MaxIdleConns:          1024,
		MaxIdleConnsPerHost:   1024,
		ResponseHeaderTimeout: 60 * time.Second,
		IdleConnTimeout:       60 * time.Second,
		TLSHandshakeTimeout:   10 * time.Second,
		ExpectContinueTimeout: 1 * time.Second,

		DisableCompression: true,
	}

	if secure {
		tr.TLSClientConfig = &tls.Config{

			MinVersion: tls.VersionTLS12,
		}
	}
	return tr
}

DefaultTransport - this default transport is similar to http.DefaultTransport but with additional param DisableCompression is set to true to avoid decompressing content with 'gzip' encoding.

Functions

func ErrInvalidArgument

func ErrInvalidArgument(message string) error

ErrInvalidArgument - Invalid argument response.

func GetObjectStorageFlow

func GetObjectStorageFlow(promURL, bucket, instance string, startTime, endTime time.Time) (int64, error)

func GetObjectStorageSize

func GetObjectStorageSize(client *minio.Client, bucket string) (int64, int64)

func GetUserObjectStorageFlow

func GetUserObjectStorageFlow(client *minio.Client, promURL, username, instance string, startTime, endTime time.Time) (int64, error)

func GetUserObjectStorageSize

func GetUserObjectStorageSize(client *minio.Client, username string) (int64, int64, error)

func ListAllObjectStorageBucket

func ListAllObjectStorageBucket(client *minio.Client) ([]string, error)

func ListUserObjectStorageBucket

func ListUserObjectStorageBucket(client *minio.Client, username string) ([]string, error)

func QueryPrometheus

func QueryPrometheus(host, bucketName, instance string, startTime, endTime time.Time) (int64, error)

Types

type ErrorResponse

type ErrorResponse struct {
	XMLName    xml.Name `xml:"Error" json:"-"`
	Code       string
	Message    string
	BucketName string
	Key        string
	RequestID  string `xml:"RequestId"`
	HostID     string `xml:"HostId"`

	// Region where the bucket is located. This header is returned
	// only in HEAD bucket and ListObjects response.
	Region string
}

ErrorResponse - Is the typed error returned by all API operations.

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error - Returns HTTP error string

type Interface

type Interface interface {
	GetUserObjectStorageSize(client *minio.Client, username string) (int64, int64, error)

	GetUserObjectStorageFlow(client *minio.Client, promURL, username string) (int64, error)
}

type MetricData

type MetricData struct {
	// key: bucket name, value: usage
	Usage map[string]int64
}

type Metrics

type Metrics map[string]MetricData

func QueryUserUsage

func QueryUserUsage(client *MetricsClient) (Metrics, error)

type MetricsClient

type MetricsClient struct {
	// contains filtered or unexported fields
}

MetricsClient implements MinIO metrics operations

func NewMetricsClient

func NewMetricsClient(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*MetricsClient, error)

NewMetricsClient - instantiate minio metrics client honoring Prometheus format

func (*MetricsClient) BucketUsageTotalBytesMetrics

func (client *MetricsClient) BucketUsageTotalBytesMetrics(ctx context.Context) ([]*prom2json.Family, error)

BucketUsageTotalBytesMetrics - returns Bucket Metrics in Prometheus format

Jump to

Keyboard shortcuts

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