This is a simple example of how to track Postgres queries in Go application using Newrelic.
- Clone this repository
- Run
go run main.go
- Create a newrelic account and get your license key
- 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
);
- Update newrelic license and dns in
main.go
- Open POSTMAN to test the API
- 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