nri-prometheus

module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0

README

New Relic Prometheus OpenMetrics Integration

Build Status CLA assistant

Fetch metrics in the Prometheus metrics format, inside or outside Kubernetes, and send them to the New Relic Metrics platform.

How to use it?

For documentation about how to use it please refer to New Relic's documentation website.

Find out more about Prometheus and New Relic in this blog post.

Development

This integration requires having a Kubernetes cluster available to deploy & run it. For development, we recommend using Docker, Minikube & skaffold.

However, at the moment the tests are totally isolated and you don't need a cluster to run them.

Prerequisites
  1. Go 1.13. This project uses the error wrapping support, which makes it incompatible with previous Go versions.
Running the tests & linters

You can run the linters with make validate and the tests with make test.

Build the binary

To build the project run: make build. This will output the binary release at bin/nri-prometheus.

Build the docker image

In case you wish to push your own version of the image to a Docker registry, you can build it with:

IMAGE_NAME=<YOUR_IMAGE_NAME> make docker-build

And push it later with docker push

Executing the integration in a development cluster
  • You need to configure how to deploy the integration in the cluster. Copy deploy/local.yaml.example to deploy/local.yaml and edit the placeholders.
  • To get the Infrastructure License key, visit: https://newrelic.com/accounts/<YOUR_ACCOUNT_ID>. It's located in the right sidebar.
  • After updating the yaml file, you need to compile the integration: GOOS=linux make compile-only.
  • Once you have it compiled, you need to deploy it in your Kubernetes cluster: skaffold run
Running the Kubernetes Target Retriever locally

It can be useful to run the Kubernetes Target Retriever locally against a remote/local cluster to debug the endpoints that are discovered. The program located in /cmd/k8s-target-retriever is made for this.

To run the program,run the following command in your terminal:

# ensure your kubectl is configured correcly & against the correct cluster
kubectl config get-contexts
# run the program 
go run cmd/k8s-target-retriever/main.go

Directories

Path Synopsis
cmd
internal
cmd/scraper
Package scraper ...
Package scraper ...
integration
Package integration ..
Package integration ..
pkg/endpoints
Package endpoints ...
Package endpoints ...
pkg/labels
Package labels ...
Package labels ...
pkg/prometheus
Package prometheus ...
Package prometheus ...
retry
Package retry ...
Package retry ...
tools

Jump to

Keyboard shortcuts

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