Skip to content

dannyrandall/go-copilot-observability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Copilot Observability

This repo contains a simple instrumented go service along with infra to deploy it to AWS ECS and AWS App Runner using Copilot.

Requirements

Deploy

  1. Clone this repo.
  2. Deploy this service using Copilot!
copilot init --app copilot-playground --name movies-lbws --type "Load Balanced Web Service" --deploy

Generate and View Traces

Now that you have the movies service deployed, let's generate some traces! After deploying your service, copilot gives you a URL to access your service. Copy that URL, and replace $MOVIES_SERVICE_BASE_URL with it in the commands below.

First, let's insert a movie into our database:

curl -X POST '$MOVIES_SERVICE_BASE_URL/movies/api/movie' -d '{"title": "Parasite", "year": 2019}'

In the response JSON, there should be an id field. Replace the below MOVIE_ID with that, and let's query the movie we just inserted:

curl -X GET '$MOVIES_SERVICE_BASE_URL/movies/api/movie?id=$MOVIE_ID'

Sweet! Now we should have some traces to view in the AWS Console. After logging in, go to CloudWatch and click on the Service Map in the sidebar, under X-Ray traces. It should look something like this: Service Map

Now switch to the Traces tab in the sidebar, and you should be able to see your requests. If you open one up, you can see more details about that specific request like this: Trace Details