Skip to content

Jenkins plugin for inserting custom new relic insights events

Notifications You must be signed in to change notification settings

jenkinsci/newrelic-insights-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jenkins New Relic Insights Plugin

This is a Jenkins Plugin which allows users to send custom events to new relic insights.

Set up

Credentials

Set up a "New Relic Insights Key" credential

alt text

Usage

Add key value data points to submit with a custom event.

eventType key is required

Freestyle Job

alt text

Scripted Pipeline

Two options exist for sending data with a custom event in a scripted pipeline.

Key Value Data Points

node {
    // assemble key value keyValues points
    def secrets = [
      [$class: 'KeyValue', key: 'eventType', value: 'test_deployment'],
      [$class: 'KeyValue', key: 'appId', value: '888']
    ]
    
    // call build step with key value keyValues points
    step([$class: 'NewRelicInsights', 
    credentialsId: '291ff5f2-a93f-4d5a-8e56-a43d61475fc7', 
    keyValues: secrets])
}

Groovy Map

node {
    // a simpler option for pipelines
    def json = [eventType: 'test_deployment', appId: '888']
    
    // call build step with map
    step([$class: 'NewRelicInsights', 
    credentialsId: '291ff5f2-a93f-4d5a-8e56-a43d61475fc7', 
    json: json])   
}

Insights only accepts key-value pairs, not map/object or array values. Only floats and strings are supported data types. See Insights Docs for more information.

Querying in Insights

All of the above examples would appear as below in insights:

awesome pic

Insights Dashboard Examples

Deployment Metrics

alt text

For more information, please see new relic insights.

Development

Maven Tasks

Here is a list of maven tasks that I use on this project:

  • mvn verify: runs all tests
  • mvn package: creates the hpi plugin archive to be used with Jenkins
  • mvn hpi:run -Djetty.port=8090: runs the Jenkins server (with the plugin pre-loaded) on port 8090

License

This project is distributed under the MIT license.

TODO

  • Seperate out eventType from generic keyValues object
  • Support variables in freestyle
  • Support pipeline
  • Surface a cleaner way to pass the keyValues via pipeline
  • Implement proper build wrapper pipeline step
newrelicInsights credentialsId: '', keyValues: keyValues, json: json

Reference credit

https://github.com/jenkinsci/newrelic-deployment-notifier-plugin

About

Jenkins plugin for inserting custom new relic insights events

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 92.7%
  • HTML 7.3%