Skip to content

mrf/newrelic_exporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

New Relic Exporter

GitHub Container Registry GitHub issues GitHub pull requests License Go Report Card Coverage

Prometheus exporter for New Relic data. This exporter allows you to collect metrics from New Relic's API and expose them in Prometheus format.

Project Status

✅ Actively Maintained - This project is actively maintained and accepting contributions.

We welcome:

  • 🐛 Bug reports and fixes
  • ✨ Feature requests and implementations
  • 📖 Documentation improvements
  • 🧪 Test coverage improvements

Features

  • ✅ Export New Relic APM metrics to Prometheus
  • ✅ Support for multiple applications
  • ✅ Configurable metric filtering to reduce API usage
  • ✅ Built-in caching to optimize API calls
  • ✅ Docker support with multi-architecture images (amd64, arm64)
  • ✅ Kubernetes deployment via Helm chart
  • ✅ Comprehensive configuration with validation
  • ✅ Automated CI/CD with GitHub Actions and CircleCI

Requirements

  • A New Relic account with API access
  • New Relic REST API key
  • Prometheus server (for collecting metrics)

Quick Start

Using Docker (Recommended)

# Pull the latest image
docker pull ghcr.io/mrf/newrelic-exporter:latest

# Create a configuration file
cat > newrelic_exporter.yml <<EOF
api.key: YOUR_API_KEY_HERE
api.service: applications
api.timeout: 15s
api.include-metric-filters:
  - "HttpDispatcher"
  - "Database"
  - "Apdex"
EOF

# Run the exporter
docker run -d \
  -p 9126:9126 \
  -v $(pwd)/newrelic_exporter.yml:/app/newrelic_exporter.yml \
  ghcr.io/mrf/newrelic-exporter:latest

Using Kubernetes/Helm

# Add the Helm chart
helm install newrelic-exporter ./helm/newrelic-exporter \
  --set newrelic.apiKey=YOUR_API_KEY \
  --set newrelic.service=applications \
  --set newrelic.includeMetricFilters[0]="HttpDispatcher"

See the Helm chart README for detailed configuration options.

Building and Running

Running in a container

cp newrelic_exporter.yml.example newrelic_exporter.yml
# Edit newrelic_exporter.yml with your API key and settings
docker run -v $(pwd)/newrelic_exporter.yml:/app/newrelic_exporter.yml ghcr.io/mrf/newrelic-exporter

From source

git clone https://github.com/mrf/newrelic_exporter.git
cd newrelic_exporter
make
cp newrelic_exporter.yml.example newrelic_exporter.yml
# Edit newrelic_exporter.yml with your API key and settings
./newrelic_exporter

Configuration

Command Line Flags

Name Description Default
--config Config file path newrelic_exporter.yml

Configuration File

The exporter uses a YAML configuration file. See newrelic_exporter.yml.example for a comprehensive example with detailed documentation.

Required Settings

Setting Description
api.key Your New Relic API key
api.service Service type (e.g., applications, mobile)
api.timeout API request timeout (e.g., 15s) - must include time unit
api.include-metric-filters List of metric filters (at least one required)

Optional Settings

Setting Description Default
api.server API server URL https://api.newrelic.com
api.period Data request period in seconds 60
api.apps-list-cache-time Application list cache duration 0 (no cache)
api.metric-names-cache-time Metric names cache duration 0 (no cache)
api.include-apps Filter specific applications [] (all apps)
api.include-values Filter specific metric values [] (all values)
web.listen-address HTTP server listen address :9126
web.telemetry-path Metrics endpoint path /metrics
debug.proxy-address Proxy for debugging ""

Example Configurations

Basic APM Monitoring

api.key: YOUR_API_KEY
api.service: applications
api.timeout: 15s
api.include-metric-filters:
  - "HttpDispatcher"
  - "Apdex"

Multiple Applications with Caching

api.key: YOUR_API_KEY
api.service: applications
api.timeout: 30s
api.apps-list-cache-time: 1h
api.metric-names-cache-time: 1h
api.include-apps:
  - name: "Production Web"
  - name: "Production API"
api.include-metric-filters:
  - "HttpDispatcher"
  - "Database"
  - "External"

See newrelic_exporter.yml.example for more examples.

Prometheus Integration

Add the following to your prometheus.yml:

scrape_configs:
  - job_name: 'newrelic'
    static_configs:
      - targets: ['localhost:9126']
    scrape_interval: 60s  # Match api.period in exporter config

Development

Running Tests

go test -v ./...

Building

make
# or
go build -o newrelic_exporter .

Docker Build

docker build -t ghcr.io/mrf/newrelic-exporter:latest .

CI/CD

This project includes automated CI/CD pipelines:

  • GitHub Actions: Builds, tests, and publishes Docker images on every push and release
  • Helm Chart Testing: Automated Helm chart validation and testing with Kind
  • CircleCI: Alternative CI/CD pipeline with advanced features

See .github/workflows/ and .circleci/ for configuration details.

Helm Chart Testing

The Helm chart is automatically tested using Kind (Kubernetes in Docker) to ensure it works correctly. Tests include:

  • Chart linting and validation
  • Installation in a real Kubernetes cluster
  • Resource validation (deployments, services, pods, etc.)
  • Connectivity and metrics endpoint testing
  • Upgrade scenario testing

For local testing and detailed information, see the Helm Testing Guide.

Quick local test:

./scripts/test-helm-chart.sh

Contributing

We welcome contributions! Please see our Contributing Guide for details.

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests:
    • Go tests: go test ./...
    • Helm chart tests: ./scripts/test-helm-chart.sh
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Troubleshooting

Common Issues

Error: "Config validation failed: api.timeout is not set"

  • Solution: Ensure timeout includes time units (e.g., "15s" not "15")

Error: "Config validation failed: api.key is required"

  • Solution: Set your New Relic API key in the config file

No metrics appearing

  • Check that your API key is valid
  • Verify application names/IDs are correct
  • Ensure metric filters match available metrics in New Relic

Slow scrapes or timeouts

  • Reduce the number of metric filters
  • Enable and increase cache times
  • Filter to specific applications only
  • Increase the timeout value

See the configuration example for a comprehensive troubleshooting guide.

Support

License

This project is licensed under the terms specified in the LICENSE file.

Acknowledgments

Related Projects

  • Prometheus - Monitoring system and time series database
  • New Relic - Application performance monitoring platform
  • Grafana - Visualization platform (works great with this exporter)

About

NewRelic exporter for Prometheus

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Go 82.3%
  • Shell 12.8%
  • Smarty 2.5%
  • Makefile 1.9%
  • Dockerfile 0.5%