Documentation ¶
Index ¶
- Constants
- func ConnectDatastore(base64Config string) (*datastore.Client, string, error)
- func ConnectStackdriver(base64Config string) (*monitoring.Service, string, error)
- func Run(log *logrus.Logger, prettyPrint bool, version string)
- func StackdriverData(resp *monitoring.ListTimeSeriesResponse) ([]map[string]interface{}, error)
- func StackdriverResp(s *monitoring.Service, projectId string, metric string) (*monitoring.ListTimeSeriesResponse, error)
- type ClientDatastore
- type DatastoreClient
- type DatastoreKind
- type EventData
- type InventoryData
- type MetricData
- type PluginData
- type StackdriverMetric
Constants ¶
const ( NAME = "datastore" ProtocolVersion = "1" )
Variables ¶
This section is empty.
Functions ¶
func ConnectDatastore ¶
ConnectDatastore establishes a datastore.Client from a base64 encoding JSON credentials file.
func ConnectStackdriver ¶
ConnectStackdriver establishes a monitoring.Service from a base64 encoding JSON credentials file.
func StackdriverData ¶
StackdriverData converts a ListTimeSeriesResponse to a []map[string]interface{} to be used for the final output to be sent to new relic
func StackdriverResp ¶
func StackdriverResp(s *monitoring.Service, projectId string, metric string) (*monitoring.ListTimeSeriesResponse, error)
StackdriverResp gets the data of the wanted metric from the stackdriver API. Start time is set at -3 minutes to act as a Timestamp as data from stackdriver is always 3 minutes old and refreshed every 1 minute. This timing also ensures we only ever get 1 point back at a time.
Types ¶
type ClientDatastore ¶
type ClientDatastore struct { Dsc DatastoreClient // contains filtered or unexported fields }
ClientDatastore stores a DatastoreClient and corresponding projectId
func NewDatastoreClient ¶
func NewDatastoreClient(base64Creds string) (ClientDatastore, error)
NewDatastoreClient creates a client for datastore, it primarily exists for testing purposes
func (*ClientDatastore) DatastoreData ¶
func (c *ClientDatastore) DatastoreData(kinds []DatastoreKind) []map[string]interface{}
DatastoreData converts a []DatastoreKind to a []map[string]interface{} to be used for the final output to new relic
func (*ClientDatastore) KindStats ¶
func (c *ClientDatastore) KindStats() ([]DatastoreKind, error)
KindStats return the results of a query against datastore using __Stat_Kind__
type DatastoreClient ¶
type DatastoreClient interface {
GetAll(ctx context.Context, q *datastore.Query, dst interface{}) (keys []*datastore.Key, err error)
}
DatastoreClient is used for testing purposes
type DatastoreKind ¶
type DatastoreKind struct { BuiltinIndexBytes int `datastore:"builtin_index_bytes"` BuiltinIndexCount int `datastore:"builtin_index_count"` CompositeIndexBytes int `datastore:"composite_index_bytes"` CompositeIndexCount int `datastore:"composite_index_count"` EntityBytes int `datastore:"entity_bytes"` Bytes int `datastore:"bytes"` Count int `datastore:"count"` KindName string `datastore:"kind_name"` Timestamp time.Time `datastore:"timestamp"` }
DatastoreKind represents the fields for a datastore Query
type EventData ¶
type EventData map[string]interface{}
EventData is the data type for single shot events
type InventoryData ¶
type InventoryData map[string]interface{}
InventoryData is the data type for inventory data produced by a plugin data source and emitted to the agent's inventory data store
type MetricData ¶
type MetricData map[string]interface{}
MetricData is the data type for events produced by a plugin data source and emitted to the agent's metrics data store
type PluginData ¶
type PluginData struct { Name string `json:"name"` ProtocolVersion string `json:"protocol_version"` PluginVersion string `json:"plugin_version"` Metrics []MetricData `json:"metrics"` Inventory map[string]InventoryData `json:"inventory"` Events []EventData `json:"events"` Status string `json:"status"` }
PluginData defines the format of the output JSON that plugins will return
type StackdriverMetric ¶
type StackdriverMetric struct { TimeSeries []struct { Metric struct { Labels struct { ApiMethod string `json:"api_method"` ResponseCode string `json:"response_code"` Type string `json:"type"` Op string `json:"op"` } `json:"labels"` Type string `json:"type"` } `json:"metric"` MetricKind string `json:"metricKind"` Points []struct { Interval struct { EndTime time.Time `json:"endTime"` StartTime time.Time `json:"startTime"` } `json:"interval"` Value struct { Int64Value int64 `json:"int64Value,string"` DistributionValue struct { BucketCounts []string `json:"bucketCounts"` BucketOptions struct { ExponentialBuckets struct { GrowthFactor int64 `json:"growthFactor"` NumFiniteBuckets int64 `json:"numFiniteBuckets"` Scale int64 `json:"scale"` } `json:"exponentialBuckets"` } `json:"bucketOptions"` Count int64 `json:"count,string"` Mean float64 `json:"mean"` } `json:"distributionValue"` } `json:"value"` } `json:"points"` Resource struct { Labels struct { ModuleID string `json:"module_id"` ProjectID string `json:"project_id"` VersionID string `json:"version_id"` } `json:"labels"` Type string `json:"type"` } `json:"resource"` ValueType string `json:"valueType"` } `json:"timeSeries"` }
StackdriverMetric represents fields for stackdriver returns