package
0.43.0
Repository: https://github.com/wtfutil/wtf.git
Documentation: pkg.go.dev

# README

GoDoc Build
status

New Relic API library for Go

This is a Go library that wraps the New Relic REST API. It provides the needed types to interact with the New Relic REST API.

It's still in progress and I haven't finished the entirety of the API, yet. I plan to finish all GET (read) operations before any POST (create) operations, and then PUT (update) operations, and, finally, the DELETE operations.

The API documentation can be found from New Relic, and you'll need an API key (for some operations, an Admin API key is required).

USAGE

This library will provide a client object and any operations can be performed through it. Simply import this library and create a client to get started:

package main

import (
  "github.com/yfronto/newrelic"
)

var api_key = "..." // Required

func main() {
  // Create the client object
  client := newrelic.NewClient(api_key)

  // Get the applciation with ID 12345
  myApp, err := client.GetApplication(12345)
  if err != nil {
    // Handle error
  }

  // Work with the object
  fmt.Println(myApp.Name)

  // Some operations accept options
  opts := &newrelic.AlertEventOptions{
    // Only events with "MyProduct" as the product name
    Filter: newRelic.AlertEventFilter{
      Product: "MyProduct",
    },
  }
  // Get a list of recent events for my product
  events, err := client.GetAlertEvents(opts)
  if err != nil {
    // Handle error
  }
  // Display each event with some information
  for _, e := range events {
    fmt.Printf("%d -- %d (%s): %s\n", e.Timestamp, e.Id, e.Priority, e.Description)
  }
}

Contributing

As I work to populate all actions, bugs are bound to come up. Feel free to send me a pull request or just file an issue. Staying up to date with an API is hard work and I'm happy to accept contributors.

DISCLAIMER: I am in no way affiliated with New Relic and this work is merely a convenience project for myself with no guarantees. It should be considered "as-is" with no implication of responsibility. See the included LICENSE for more details.

# Functions

NewClient returns a new Client object for interfacing with the New Relic API.
NewMetricClient creates and returns a new MetricClient.
NewWithHTTPClient returns a new Client object for interfacing with the New Relic API, allowing for override of the http.Client object.

# Structs

AlertCondition describes what triggers an alert for a specific policy.
AlertConditionOptions define filters for GetAlertConditions.
AlertConditionTerm defines thresholds that trigger an AlertCondition.
AlertEvent describes a triggered event.
AlertEventFilter provides filters for AlertEventOptions when calling GetAlertEvents.
AlertEventOptions is an optional means of filtering AlertEvents when calling GetAlertEvents.
AlertUserDefined describes user-defined behavior for an AlertCondition.
Application describes a New Relic Application.
ApplicationDeployment contains information about a New Relic Application Deployment.
ApplicationDeploymentLinks represents links that apply to an ApplicationDeployment.
ApplicationDeploymentOptions provide a means to filter when calling GetApplicationDeployments.
ApplicationFilter provides a means to filter requests through ApplicaitonOptions when calling GetApplications.
ApplicationHost describes a New Relic Application Host.
ApplicationHostEndUserSummary describes the end user summary component of an ApplicationHost.
ApplicationHostLinks list IDs associated with an ApplicationHost.
ApplicationHostsFilter provides a means to filter requests through ApplicationHostsOptions when calling GetApplicationHosts.
ApplicationHostsOptions provide a means to filter results when calling GetApplicationHosts.
ApplicationHostSummary describes an Application's host.
ApplicationInstance describes a New Relic Application instance.
ApplicationInstanceEndUserSummary describes the end user summary component of an ApplicationInstance.
ApplicationInstanceLinks lists IDs associated with an ApplicationInstances.
ApplicationInstancesFilter provides a means to filter requests through ApplicationInstancesOptions when calling GetApplicationInstances.
ApplicationInstancesOptions provides a means to filter results when calling GetApplicationInstances.
ApplicationInstanceSummary describes an Application's instance.
ApplicationOptions provides a means to filter results when calling GetApplicaitons.
ApplicationSummary describes the brief summary component of an Application.
An Array is a type expected by the NewRelic API that differs from a comma- separated list.
BrowserApplication describes a New Relic Browser Application.
BrowserApplicationsFilter is the filtering component of BrowserApplicationsOptions.
BrowserApplicationsOptions provides a filtering mechanism for GetBrowserApplications.
Client provides a set of methods to interact with the New Relic API.
EndUserSummary describes the end user summary component of an Application.
KeyTransaction represents a New Relic Key Transaction.
KeyTransactionLinks link KeyTransactions to the objects to which they pertain.
KeyTransactionsFilter is the filtering component of KeyTransactionsOptions.
KeyTransactionsOptions provides a filtering mechanism for GetKeyTransactions.
LegacyAlertPolicy describes a New Relic alert policy.
LegacyAlertPolicyCondition describes conditions that trigger an LegacyAlertPolicy.
LegacyAlertPolicyFilter provides filters for LegacyAlertPolicyOptions.
LegacyAlertPolicyLinks describes object links for Alert Policies.
LegacyAlertPolicyOptions is an optional means of filtering when calling GetLegacyAlertPolicies.
Links list IDs associated with an Application.
Metric describes a New Relic metric.
MetricClient implements a generic New Relic metrics client.
MetricData describes the data for a particular metric.
MetricDataOptions allow filtering when getting data about a particular set of New Relic metrics.
MetricDataResponse is the response received from New Relic for any request for metric data.
MetricsOptions options allow filtering when getting lists of metric names associated with an entity.
MetricTimeslice describes the period to which a Metric pertains.
MobileApplication describes a New Relic Application Host.
MobileApplicationCrashSummary describes a MobileApplication's crash data.
MobileApplicationSummary describes an Application's host.
NotificationChannel describes a New Relic notification channel.
NotificationChannelLinks describes object links for notification channels.
NotificationChannelsFilter provides filters for NotificationChannelsOptions.
NotificationChannelsOptions is an optional means of filtering when calling GetNotificationChannels.
Server represents a New Relic Server.
ServerLinks link Servers to the objects to which they pertain.
ServersFilter is the filtering component of ServersOptions.
ServersOptions provides a filtering mechanism for GetServers.
ServerSummary describes the summary component of a Server.
Settings describe settings for an Application.
Usage describes usage over a single time period.
UsageData represents usage data for a product over a time frame, including a slice of Usages.