Documentation ¶
Overview ¶
Copyright 2018 Google Inc. 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.
Index ¶
Constants ¶
const ( MaxTimeseriesesPerRequest = 200 MonitoringWriteScope = "https://www.googleapis.com/auth/monitoring.write" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client allows reading and writing from/to a remote gRPC endpoint. The implementation may hit a single backend, so the application should create a number of these clients.
func (*Client) Store ¶
func (c *Client) Store(req *monitoring.CreateTimeSeriesRequest) error
Store sends a batch of samples to the HTTP endpoint.
type ClientConfig ¶
type ClientConfig struct { Logger log.Logger ProjectId string // The Stackdriver project id in "projects/name-or-number" format. URL *url.URL Timeout time.Duration Resolver *manual.Resolver }
ClientConfig configures a Client.
type CreateTimeSeriesRequestWriterCloser ¶ added in v0.4.3
type CreateTimeSeriesRequestWriterCloser struct {
// contains filtered or unexported fields
}
CreateTimeSeriesRequestWriterCloser allows writing protobuf message monitoring.CreateTimeSeriesRequest as wire format into the writerCloser.
func NewCreateTimeSeriesRequestWriterCloser ¶ added in v0.4.3
func NewCreateTimeSeriesRequestWriterCloser(writeCloser io.WriteCloser, logger log.Logger) *CreateTimeSeriesRequestWriterCloser
func (*CreateTimeSeriesRequestWriterCloser) Close ¶ added in v0.4.3
func (c *CreateTimeSeriesRequestWriterCloser) Close() error
func (*CreateTimeSeriesRequestWriterCloser) Store ¶ added in v0.4.3
func (c *CreateTimeSeriesRequestWriterCloser) Store(req *monitoring.CreateTimeSeriesRequest) error
Store writes protobuf message monitoring.CreateTimeSeriesRequest as wire format into the writeCloser.
type QueueManager ¶
type QueueManager struct {
// contains filtered or unexported fields
}
QueueManager manages a queue of samples to be sent to the Storage indicated by the provided StorageClient.
func NewQueueManager ¶
func NewQueueManager(logger log.Logger, cfg config.QueueConfig, clientFactory StorageClientFactory, tailer *tail.Tailer) (*QueueManager, error)
NewQueueManager builds a new QueueManager.
func (*QueueManager) Append ¶
func (t *QueueManager) Append(hash uint64, sample *monitoring_pb.TimeSeries) error
Append queues a sample to be sent to the remote storage. It drops the sample on the floor if the queue is full. Always returns nil.
func (*QueueManager) Start ¶
func (t *QueueManager) Start() error
Start the queue manager sending samples to the remote storage. Does not block.
func (*QueueManager) Stop ¶
func (t *QueueManager) Stop() error
Stop stops sending samples to the remote storage and waits for pending sends to complete.
type StorageClient ¶
type StorageClient interface { // Store stores the given metric families in the remote storage. Store(*monitoring_pb.CreateTimeSeriesRequest) error // Release the resources allocated by the client. Close() error }
StorageClient defines an interface for sending a batch of samples to an external timeseries database.
type StorageClientFactory ¶
type StorageClientFactory interface { New() StorageClient Name() string }