plugins

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

Package plugins provides a programmatic API for interacting with the New Relic Plugins product. It can be used for a variety of operations, including:

- Reading plugins

- Reading plugin components

- Reading plugin component metric data

Authentication

You will need a Personal API key to communicate with the backend New Relic APIs that provide this functionality. See the API key documentation below for more information on how to locate this key:

https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys

Package plugins provides a programmatic API for interacting with the New Relic Plugins product.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	ID             int             `json:"id"`
	Name           string          `json:"name,omitempty"`
	HealthStatus   string          `json:"health_status,omitempty"`
	SummaryMetrics []SummaryMetric `json:"summary_metrics"`
}

Component represents information about a New Relic Plugins component.

type ComponentMetric

type ComponentMetric struct {
	Name   string   `json:"name,omitempty"`
	Values []string `json:"values"`
}

ComponentMetric represents metric information for a specific component.

type GetComponentMetricDataParams

type GetComponentMetricDataParams struct {
	// Names allows retrieval of specific metrics by name.
	// At least one metric name is required.
	Names []string `url:"names[],omitempty"`

	// Values allows retrieval of specific metric values.
	Values []string `url:"values[],omitempty"`

	// From specifies a begin time for the query.
	From *time.Time `url:"from,omitempty"`

	// To specifies an end time for the query.
	To *time.Time `url:"to,omitempty"`

	// Period represents the period of timeslices in seconds.
	Period int `url:"period,omitempty"`

	// Summarize will summarize the data when set to true.
	Summarize bool `url:"summarize,omitempty"`

	// Raw will return unformatted raw values when set to true.
	Raw bool `url:"raw,omitempty"`
}

GetComponentMetricDataParams represents a set of parameters to be used when querying New Relic component metric data.

type GetPluginParams

type GetPluginParams struct {
	Detailed bool `url:"detailed,omitempty"`
}

GetPluginParams represents a set of query string parameters to apply to the request.

type ListComponentMetricsParams

type ListComponentMetricsParams struct {
	// Name allows for filtering the returned list of metrics by name.
	Name string `url:"name,omitempty"`
}

ListComponentMetricsParams represents a set of parameters to be used when querying New Relic component metrics.

type ListComponentsParams

type ListComponentsParams struct {
	Name         string `url:"filter[name],omitempty"`
	IDs          []int  `url:"filter[ids],omitempty,comma"`
	PluginID     int    `url:"filter[plugin_id],omitempty"`
	HealthStatus bool   `url:"health_status,omitempty"`
}

ListComponentsParams represents a set of filters to be used when querying New Relic applications.

type ListPluginsParams

type ListPluginsParams struct {
	GUID     string `url:"filter[guid],omitempty"`
	IDs      []int  `url:"filter[ids],omitempty,comma"`
	Detailed bool   `url:"detailed,omitempty"`
}

ListPluginsParams represents a set of query string parameters used as filters when querying New Relic plugins.

type Metric

type Metric struct {
	Name       string            `json:"name"`
	Timeslices []MetricTimeslice `json:"timeslices"`
}

Metric represents data for a specific metric.

type MetricThreshold

type MetricThreshold struct {
	Caution  float64 `json:"caution"`
	Critical float64 `json:"critical"`
}

MetricThreshold represents a threshold value for a metric.

type MetricTimeslice

type MetricTimeslice struct {
	From   *time.Time         `json:"from,omitempty"`
	To     *time.Time         `json:"to,omitempty"`
	Values map[string]float64 `json:"values,omitempty"`
}

MetricTimeslice represents the values of a metric over a given time.

type MetricValue

type MetricValue struct {
	Raw       float64 `json:"raw"`
	Formatted string  `json:"formatted"`
}

MetricValue represents the observed value of a metric.

type Plugin

type Plugin struct {
	ID                  int             `json:"id"`
	Name                string          `json:"name,omitempty"`
	GUID                string          `json:"guid,omitempty"`
	Publisher           string          `json:"publisher,omitempty"`
	ComponentAgentCount int             `json:"component_agent_count"`
	Details             PluginDetails   `json:"details"`
	SummaryMetrics      []SummaryMetric `json:"summary_metrics"`
}

Plugin represents information about a New Relic plugin.

type PluginDetails

type PluginDetails struct {
	Description           string `json:"description"`
	CreatedAt             string `json:"created_at,omitempty"`
	UpdatedAt             string `json:"updated_at,omitempty"`
	LastPublishedAt       string `json:"last_published_at,omitempty"`
	BrandingImageURL      string `json:"branding_image_url"`
	UpgradedAt            string `json:"upgraded_at,omitempty"`
	ShortName             string `json:"short_name"`
	PublisherAboutURL     string `json:"publisher_about_url"`
	PublisherSupportURL   string `json:"publisher_support_url"`
	DownloadURL           string `json:"download_url"`
	FirstEditedAt         string `json:"first_edited_at,omitempty"`
	LastEditedAt          string `json:"last_edited_at,omitempty"`
	FirstPublishedAt      string `json:"first_published_at,omitempty"`
	PublishedVersion      string `json:"published_version"`
	HasUnpublishedChanges bool   `json:"has_unpublished_changes"`
	IsPublic              bool   `json:"is_public"`
}

PluginDetails represents information about a New Relic plugin.

type Plugins

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

Plugins is used to communicate with the New Relic Plugins product.

func New

func New(config config.Config) Plugins

New is used to create a new Plugins client instance.

func (*Plugins) GetComponent

func (p *Plugins) GetComponent(componentID int) (*Component, error)

GetComponent is used to retrieve a specific New Relic component.

func (*Plugins) GetComponentMetricData

func (p *Plugins) GetComponentMetricData(componentID int, params *GetComponentMetricDataParams) ([]*Metric, error)

GetComponentMetricData is used to retrieve the metric timeslice data for a specific component metric.

func (*Plugins) GetPlugin

func (p *Plugins) GetPlugin(id int, params *GetPluginParams) (*Plugin, error)

GetPlugin returns a plugin for a given account. If the query paramater `detailed=true` is provided, the response will contain an additional `details` property with metadata pertaining to the plugin.

func (*Plugins) ListComponentMetrics

func (p *Plugins) ListComponentMetrics(componentID int, params *ListComponentMetricsParams) ([]*ComponentMetric, error)

ListComponentMetrics is used to retrieve the metrics for a specific New Relic component.

func (*Plugins) ListComponents

func (p *Plugins) ListComponents(params *ListComponentsParams) ([]*Component, error)

ListComponents is used to retrieve the components associated with a New Relic account.

func (*Plugins) ListPlugins

func (p *Plugins) ListPlugins(params *ListPluginsParams) ([]*Plugin, error)

ListPlugins returns a list of Plugins associated with an account. If the query paramater `detailed=true` is provided, the plugins response objects will contain an additional `details` property with metadata pertaining to each plugin.

type SummaryMetric

type SummaryMetric struct {
	ID            int             `json:"id"`
	Name          string          `json:"name"`
	Metric        string          `json:"metric"`
	ValueFunction string          `json:"value_function"`
	Thresholds    MetricThreshold `json:"thresholds"`
	Values        MetricValue     `json:"values"`
}

SummaryMetric represents summary information for a specific metric.

Jump to

Keyboard shortcuts

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