apm

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

BaseURLs represents the base API URLs for the different environments of the New Relic REST API V2.

Functions

This section is empty.

Types

type APM

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

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

func New

func New(config config.Config) APM

New is used to create a new APM client instance.

func (*APM) CreateDeployment

func (apm *APM) CreateDeployment(applicationID int, deployment Deployment) (*Deployment, error)

CreateDeployment creates a deployment marker for an application.

func (*APM) CreateLabel

func (apm *APM) CreateLabel(label Label) (*Label, error)

CreateLabel creates a new label within an account.

func (*APM) DeleteApplication

func (apm *APM) DeleteApplication(applicationID int) (*Application, error)

DeleteApplication is used to delete a New Relic application. This process will only succeed if the application is no longer reporting data.

func (*APM) DeleteDeployment

func (apm *APM) DeleteDeployment(applicationID int, deploymentID int) (*Deployment, error)

DeleteDeployment deletes a deployment marker for an application.

func (*APM) DeleteLabel

func (apm *APM) DeleteLabel(key string) (*Label, error)

DeleteLabel deletes a label by key. A label's key is a string hash formatted as <Category>:<Name>.

func (*APM) GetApplication

func (apm *APM) GetApplication(applicationID int) (*Application, error)

GetApplication is used to retrieve a single New Relic application.

func (*APM) GetKeyTransaction

func (apm *APM) GetKeyTransaction(id int) (*KeyTransaction, error)

GetKeyTransaction returns a specific key transaction by ID.

func (*APM) GetLabel

func (apm *APM) GetLabel(key string) (*Label, error)

GetLabel gets a label by key. A label's key is a string hash formatted as <Category>:<Name>.

func (*APM) GetMetricData added in v0.8.0

func (apm *APM) GetMetricData(applicationID int, params MetricDataParams) ([]*MetricData, error)

GetMetricData is used to retrieve a list of values for each of the requested metrics.

https://rpm.newrelic.com/api/explore/applications/metric_data

func (*APM) GetMetricNames added in v0.8.0

func (apm *APM) GetMetricNames(applicationID int, params MetricNamesParams) ([]*MetricName, error)

GetMetricNames is used to retrieve a list of known metrics and their value names for the given resource.

https://rpm.newrelic.com/api/explore/applications/metric_names

func (*APM) ListApplications

func (apm *APM) ListApplications(params *ListApplicationsParams) ([]*Application, error)

ListApplications is used to retrieve New Relic applications.

func (*APM) ListDeployments

func (apm *APM) ListDeployments(applicationID int) ([]*Deployment, error)

ListDeployments returns deployments for an application.

func (*APM) ListKeyTransactions

func (apm *APM) ListKeyTransactions(params *ListKeyTransactionsParams) ([]*KeyTransaction, error)

ListKeyTransactions returns all key transactions for an account.

func (*APM) ListLabels

func (apm *APM) ListLabels() ([]*Label, error)

ListLabels returns the labels within an account.

func (*APM) UpdateApplication

func (apm *APM) UpdateApplication(applicationID int, params UpdateApplicationParams) (*Application, error)

UpdateApplication is used to update a New Relic application's name and/or settings.

type Application

type Application struct {
	ID             int                       `json:"id,omitempty"`
	Name           string                    `json:"name,omitempty"`
	Language       string                    `json:"language,omitempty"`
	HealthStatus   string                    `json:"health_status,omitempty"`
	Reporting      bool                      `json:"reporting"`
	LastReportedAt string                    `json:"last_reported_at,omitempty"`
	Summary        ApplicationSummary        `json:"application_summary,omitempty"`
	EndUserSummary ApplicationEndUserSummary `json:"end_user_summary,omitempty"`
	Settings       ApplicationSettings       `json:"settings,omitempty"`
	Links          ApplicationLinks          `json:"links,omitempty"`
}

Application represents information about a New Relic application.

type ApplicationEndUserSummary

type ApplicationEndUserSummary struct {
	ResponseTime float64 `json:"response_time"`
	Throughput   float64 `json:"throughput"`
	ApdexTarget  float64 `json:"apdex_target"`
	ApdexScore   float64 `json:"apdex_score"`
}

ApplicationEndUserSummary represents performance information about a New Relic application.

type ApplicationLinks struct {
	ServerIDs     []int `json:"servers,omitempty"`
	HostIDs       []int `json:"application_hosts,omitempty"`
	InstanceIDs   []int `json:"application_instances,omitempty"`
	AlertPolicyID int   `json:"alert_policy"`
}

ApplicationLinks represents all the links for a New Relic application.

type ApplicationSettings

type ApplicationSettings struct {
	AppApdexThreshold        float64 `json:"app_apdex_threshold,omitempty"`
	EndUserApdexThreshold    float64 `json:"end_user_apdex_threshold,omitempty"`
	EnableRealUserMonitoring bool    `json:"enable_real_user_monitoring"`
	UseServerSideConfig      bool    `json:"use_server_side_config"`
}

ApplicationSettings represents some of the settings of a New Relic application.

type ApplicationSummary

type ApplicationSummary struct {
	ResponseTime            float64 `json:"response_time"`
	Throughput              float64 `json:"throughput"`
	ErrorRate               float64 `json:"error_rate"`
	ApdexTarget             float64 `json:"apdex_target"`
	ApdexScore              float64 `json:"apdex_score"`
	HostCount               int     `json:"host_count"`
	InstanceCount           int     `json:"instance_count"`
	ConcurrentInstanceCount int     `json:"concurrent_instance_count"`
}

ApplicationSummary represents performance information about a New Relic application.

type Deployment

type Deployment struct {
	Links       *DeploymentLinks `json:"links,omitempty"`
	ID          int              `json:"id,omitempty"`
	Revision    string           `json:"revision"`
	Changelog   string           `json:"changelog,omitempty"`
	Description string           `json:"description,omitempty"`
	User        string           `json:"user,omitempty"`
	Timestamp   string           `json:"timestamp,omitempty"`
}

Deployment represents information about a New Relic application deployment.

type DeploymentLinks struct {
	ApplicationID int `json:"application,omitempty"`
}

DeploymentLinks contain the application ID for the deployment.

type KeyTransaction

type KeyTransaction struct {
	ID              int                       `json:"id,omitempty"`
	Name            string                    `json:"name,omitempty"`
	TransactionName string                    `json:"transaction_name,omitempty"`
	HealthStatus    string                    `json:"health_status,omitempty"`
	LastReportedAt  string                    `json:"last_reported_at,omitempty"`
	Reporting       bool                      `json:"reporting"`
	Summary         ApplicationSummary        `json:"application_summary,omitempty"`
	EndUserSummary  ApplicationEndUserSummary `json:"end_user_summary,omitempty"`
	Links           KeyTransactionLinks       `json:"links,omitempty"`
}

KeyTransaction represents information about a New Relic key transaction.

type KeyTransactionLinks struct {
	Application int `json:"application,omitempty"`
}

KeyTransactionLinks represents associations for a key transaction.

type Label

type Label struct {
	Key      string     `json:"key,omitempty"`
	Category string     `json:"category,omitempty"`
	Name     string     `json:"name,omitempty"`
	Links    LabelLinks `json:"links,omitempty"`
}

Label represents a New Relic label.

type LabelLinks struct {
	Applications []int `json:"applications"`
	Servers      []int `json:"servers"`
}

LabelLinks represents external references on the Label.

type ListApplicationsParams

type ListApplicationsParams struct {
	Name     string `url:"filter[name],omitempty"`
	Host     string `url:"filter[host],omitempty"`
	IDs      []int  `url:"filter[ids],omitempty,comma"`
	Language string `url:"filter[language],omitempty"`
}

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

type ListKeyTransactionsParams

type ListKeyTransactionsParams struct {
	Name string `url:"filter[name],omitempty"`
	IDs  []int  `url:"filter[ids],omitempty,comma"`
}

ListKeyTransactionsParams represents a set of filters to be used when querying New Relic key transactions.

type MetricData added in v0.8.0

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

MetricData is the series of time windows and the data therein, for a given metric name.

type MetricDataParams added in v0.8.0

type MetricDataParams struct {
	Names     []string   `url:"names,omitempty"`
	Values    []string   `url:"values,omitempty"`
	From      *time.Time `url:"from,omitempty"`
	To        *time.Time `url:"to,omitempty"`
	Period    int        `url:"period,omitempty"`
	Summarize bool       `url:"summarize,omitempty"`
	Raw       bool       `url:"raw,omitempty"`
}

MetricDataParams are the request parameters for the /metrics/data.json endpoint.

type MetricName added in v0.8.0

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

MetricName is the name of a metric, and the names of the values that can be retrieved.

type MetricNamesParams added in v0.8.0

type MetricNamesParams struct {
	Name string `url:"name,omitempty"`
}

MetricNamesParams are the request parameters for the /metrics.json endpoint.

type MetricTimeslice added in v0.8.0

type MetricTimeslice struct {
	From   *time.Time            `json:"from"`
	To     *time.Time            `json:"to"`
	Values MetricTimesliceValues `json:"values"`
}

MetricTimeslice is a single window of time for a given metric, with the associated metric data.

type MetricTimesliceValues added in v0.8.0

type MetricTimesliceValues struct {
	AsPercentage           float64 `json:"as_percentage"`
	AverageTime            float64 `json:"average_time"`
	CallsPerMinute         float64 `json:"calls_per_minute"`
	MaxValue               float64 `json:"max_value"`
	TotalCallTimePerMinute float64 `json:"total_call_time_per_minute"`
	Utilization            float64 `json:"utilization"`
}

MetricTimesliceValues is the collection of metric values for a single time slice.

type UpdateApplicationParams

type UpdateApplicationParams struct {
	Name     string
	Settings ApplicationSettings
}

UpdateApplicationParams represents a set of parameters to be used when updating New Relic applications.

Jump to

Keyboard shortcuts

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