Categorygithub.com/WavefrontHQ/go-wavefront-management-api/v2

# README

Golang Wavefront Client

Golang SDK for interacting with the Wavefront v2 REST API, and sending metrics through a Wavefront proxy.

Usage

API Client

Supports most public API paths. Refer to the documentation for further information.

package main

import (
    "fmt"
    "log"
    "os"

    wavefront "github.com/WavefrontHQ/go-wavefront-management-api/v2"
)

func main() {
    client, err := wavefront.NewClient(
        &wavefront.Config{
            Address: os.Getenv("WAVEFRONT_ADDRESS"),
            Token:     os.Getenv("WAVEFRONT_TOKEN"),
        },
    )

    query := client.NewQuery(
        wavefront.NewQueryParams(`ts("cpu.load.1m.avg", dc=dc1)`),
    )

    result, err := query.Execute()

    if err != nil {
        log.Fatal(err)
    }

    if len(result.TimeSeries) > 0 {
        fmt.Println(result.TimeSeries[0].Label)
        fmt.Println(result.TimeSeries[0].DataPoints[0])
    } else {
        fmt.Println("No matching data.")
    }
}

Writer

Writer has full support for metric tagging etc.

Again, see examples for a more detailed explanation.

package main

import (
    "log"
    "os"

    wavefront "github.com/WavefrontHQ/go-wavefront-management-api/v2/writer"
)

func main() {
    source, _ := os.Hostname()

    wf, err := wavefront.NewWriter("wavefront-proxy.example.com", 2878, source, nil)
    if err != nil {
        log.Fatal(err)
    }
    defer wf.Close()

    wf.Write(wavefront.NewMetric("something.very.good.count", 33))
}

Contributing

Pull requests are welcomed.

If you'd like to contribute to this project, please raise an issue and indicate that you'd like to take on the work prior to submitting a pull request.

# Packages

No description provided by the author

# Functions

NewClient returns a new Wavefront client according to the given Config.
NewQueryParams takes a query string and returns a set of QueryParams with a query window of one hour since now and a set of sensible default values.
No description provided by the author
NewTimeRange returns a *TimeRange encompassing the period seconds before the given endTime.
NotFound returns true if err is because the resource doesn't exist.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
some constants provided for time convenience.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
Alert represents a single Wavefront Alert.
No description provided by the author
Alerts is used to perform alert-related operations against the Wavefront API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Chart represents a single Chart, on a single Row with in Section of a Wavefront Dashboard.
ChartSetting represents various custom settings for a Chart.
Client is used to generate API requests against the Wavefront API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Config is used to hold configuration, used when constructing a Client.
Dashboard represents a single Wavefront Dashboard.
Dashboards is used to perform Dashboard-related operations against the Wavefront API.
No description provided by the author
No description provided by the author
No description provided by the author
Event represents a single Wavefront Event.
Events is used to perform event-related operations against the Wavefront API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
MaintenanceWindow represents a maintenance window in Wavefront.
MaintenanceWindowOptions represents the configurable options for a maintenance window.
MaintenanceWindows is used to perform maintenance window related operations against the Wavefront API.
MetricsPolicy represents the global metrics policy for a given Wavefront domain.
MetricsPolicyAPI is used to perform MetricsPolicy-related operations against the Wavefront API.
No description provided by the author
No description provided by the author
No description provided by the author
ParameterDetail represents a parameter to dashboard that can be consumed in queries.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Query represents a query to be made against the Charts API.
QueryParams represents parameters that will be passed when making a Query.
QueryResponse is used to represent a Wavefront query response.
No description provided by the author
No description provided by the author
Row represents a single Row withing a Section of a Wavefront Dashboard.
Search represents a search to be made against the Search API.
SearchCondition represents a single search condition.
SearchParams represents paramaters used to effect a Search.
SearchResponse represents the result of a successful search operation.
Section Represents a Single section within a Dashboard.
ServiceAccount represents a ServiceAccount which exists in Wavefront.
ServiceAccountOptions represents the options for creating or updating a ServiceAccount in Wavefront.
ServiceAccounts is used to perform service account related operations against the Wavefront API.
Source represents a single Source for a Chart.
No description provided by the author
Target represents a Wavefront Alert Target, for routing notifications associated with Alerts.
Targets is used to perform target-related operations against the Wavefront API.
No description provided by the author
TimeRange represents a range of times to search between.
TimeSeries represents a single TimeSeries as returned by Wavefront.
Token represents an API token in Wavefront.
TokenOptions represents the options for creating or modifying tokens.
Tokens is used to perform service account token related operations against the Wavefront API.
No description provided by the author
User represents a Wavefront User.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Users is used to perform user-related operations against the Wavefront API.
No description provided by the author

# Interfaces

Wavefronter is an interface that a Wavefront client must satisfy (generally this is abstracted for easier testing).

# Type aliases

DataPoint represents a single timestamp/value data point as returned by Wavefront.