newrelic-client-go

module
v0.23.3 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0

README

Community Project header

newrelic-client-go

Testing Security Scan Go Report Card GoDoc License CLA assistant Release

The New Relic Client provides the building blocks for tools in the Developer Toolkit, enabling quick access to the suite of New Relic APIs. As a library, it can also be leveraged within your own custom applications.

Example

package main

import (
  "fmt"
  "os"

  log "github.com/sirupsen/logrus"

  "github.com/newrelic/newrelic-client-go/newrelic"
  "github.com/newrelic/newrelic-client-go/pkg/apm"
)

func main() {
  apiKey := os.Getenv("NEW_RELIC_ADMIN_API_KEY")
  if apiKey == "" {
    log.Fatal("an API key is required, please set the NEW_RELIC_ADMIN_API_KEY environment variable")
  }

  nr, err := newrelic.New(newrelic.ConfigAdminAPIKey(apiKey))
  if err != nil {
    log.Fatalf("failed to create a New Relic client with error %v", err)
  }

  params := apm.ListApplicationsParams{
    Name: "WebPortal",
  }

  apps, err := nr.APM.ListApplications(&params)
  if err != nil {
    log.Fatalf("failed to list applications with error %v", err)
  }

  fmt.Printf("%+v\n", apps)
}

Community

New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices.

  • Roadmap - As part of the Developer Toolkit, the roadmap for this project follows the same RFC process
  • Issues or Enhancement Requests - Issues and enhancement requests can be submitted in the Issues tab of this repository. Please search for and review the existing open issues before submitting a new issue.
  • Contributors Guide - Contributions are welcome (and if you submit a Enhancement Request, expect to be invited to contribute it yourself 😁).
  • Community discussion board - Like all official New Relic open source projects, there's a related Community topic in the New Relic Explorers Hub.

Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com.

Development

Requirements
  • Go 1.13.0+
  • GNU Make
  • git
Building

This package does not generate any direct usable assets (it's a library). You can still run the build scripts to validate you code, and generate coverage information.

# Default target is 'build'
$ make

# Explicitly run build
$ make build

# Locally test the CI build scripts
# make build-ci
Testing

Before contributing, all linting and tests must pass. Tests can be run directly via:

# Tests and Linting
$ make test

# Only unit tests
$ make test-unit

# Only integration tests
$ make test-integration
Commit Messages

Using the following format for commit messages allows for auto-generation of the CHANGELOG:

Format:

<type>(<scope>): <subject>

Type Description Change log?
chore Maintenance type work No
docs Documentation Updates Yes
feat New Features Yes
fix Bug Fixes Yes
refactor Code Refactoring No
Scope

This refers to what part of the code is the focus of the work. For example:

General:

  • build - Work related to the build system (linting, makefiles, CI/CD, etc)
  • release - Work related to cutting a new release

Package Specific:

  • newrelic - Work related to the New Relic package
  • http - Work related to the internal/http package
  • alerts - Work related to the pkg/alerts package
Documentation

Note: This requires the repo to be in your GOPATH (godoc issue)

$ make docs

Community Support

New Relic hosts and moderates an online forum where you can interact with New Relic employees as well as other customers to get help and share best practices. Like all New Relic open source community projects, there's a related topic in the New Relic Explorers Hub. You can find this project's topic/threads here:

https://discuss.newrelic.com/t/new-relic-one-top-nerdpack/82934

Please do not report issues with Top to New Relic Global Technical Support. Instead, visit the Explorers Hub for troubleshooting and best-practices.

Issues / Enhancement Requests

Issues and enhancement requests can be submitted in te Issues tab of this repository. Please search for and review the existing open issues before submitting a new issue.

Contributing

Contributions are welcome (and if you submit a Enhancement Request, expect to be invited to contribute it yourself 😁). Please review our Contributors Guide.

Keep in mind that when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at opensource@newrelic.com.

Open Source License

This project is distributed under the Apache 2 license.

Directories

Path Synopsis
internal
Package newrelic is a convenience package that provides a programmatic API surface area for interacting with all the New Relic One products encompassed by this project.
Package newrelic is a convenience package that provides a programmatic API surface area for interacting with all the New Relic One products encompassed by this project.
pkg
alerts
Package alerts provides a programmatic API for interacting with the New Relic Alerts product.
Package alerts provides a programmatic API for interacting with the New Relic Alerts product.
apm
Package apm provides a programmatic API for interacting with the New Relic APM product.
Package apm provides a programmatic API for interacting with the New Relic APM product.
config
Package config provides cross-cutting configuration support for the newrelic-client-go project.
Package config provides cross-cutting configuration support for the newrelic-client-go project.
dashboards
Package dashboards provides a programmatic API for interacting with New Relic dashboards.
Package dashboards provides a programmatic API for interacting with New Relic dashboards.
entities
Package entities provides a programmatic API for interacting with New Relic One entities.
Package entities provides a programmatic API for interacting with New Relic One entities.
errors
Package errors provides error types for specific error scenarios.
Package errors provides error types for specific error scenarios.
infrastructure
Package infrastructure provides metadata about the underlying Infrastructure API, which is only used to provision Infrastructure alert conditions.
Package infrastructure provides metadata about the underlying Infrastructure API, which is only used to provision Infrastructure alert conditions.
nerdgraph
Package nerdgraph provides a programmatic API for interacting with the New Relic NerdGraph GraphQL API.
Package nerdgraph provides a programmatic API for interacting with the New Relic NerdGraph GraphQL API.
nerdstorage
Package nerdstorage provides a programmatic API for interacting with the New Relic One NerdStorage document store.
Package nerdstorage provides a programmatic API for interacting with the New Relic One NerdStorage document store.
plugins
Package plugins provides a programmatic API for interacting with the New Relic Plugins product.
Package plugins provides a programmatic API for interacting with the New Relic Plugins product.
region
Package region describes the operational regions defined for New Relic Regions are geographical locations where the New Relic platform operates and this package provides an abstraction layer for handling them within the New Relic Client and underlying APIs
Package region describes the operational regions defined for New Relic Regions are geographical locations where the New Relic platform operates and this package provides an abstraction layer for handling them within the New Relic Client and underlying APIs
synthetics
Package synthetics provides a programmatic API for interacting with the New Relic Synthetics API.
Package synthetics provides a programmatic API for interacting with the New Relic Synthetics API.
workloads
Package workloads provides a programmatic API for interacting with New Relic One workloads.
Package workloads provides a programmatic API for interacting with New Relic One workloads.
tools

Jump to

Keyboard shortcuts

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