Skip to content

Monitor Postgres Queries in your Go application using newrelic.

Notifications You must be signed in to change notification settings

mohammadmuazam/golang-newrelic-psql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Track Postgres Queries in Go Application using Newrelic

This is a simple example of how to track Postgres queries in Go application using Newrelic.

How to run

  1. Clone this repository
  2. Run go run main.go
  3. Create a newrelic account and get your license key
  4. Create a table in your Postgres database
CREATE TABLE product (
    price bigint,
    deleted_at timestamp with time zone,
    created_at timestamp with time zone,
    updated_at timestamp with time zone,
    code text UNIQUE UNIQUE,
    id SERIAL PRIMARY KEY
);
  1. Update newrelic license and dns in main.go
  2. Open POSTMAN to test the API
  3. Send a POST request to http://localhost:3000/products/ with the following body:
{
  "code": "123",
  "price": 1000
}

Other supported APIs:

  • GET http://localhost:3000/products/
  • GET http://localhost:3000/products/:id
  • PATCH http://localhost:3000/products/:id
  • DELETE http://localhost:3000/products/:id

Output in Newrelic

output

Reference

About

Monitor Postgres Queries in your Go application using newrelic.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages