Skip to content

autometrics-dev/gettingstarted-am-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sample Go app with Autometrics

This is a sample backend service written in Go with several API handlers that are erroring or responding slowly, intended to showcase the Autometrics framework with Service Level Objectives.

Resources

Getting started

To get the sample up and running you can follow these steps:

  1. Clone the repository
git clone autometrics-dev/gettingstarted-am-go

cd gettingstarted-am-go
  1. Download the Autometrics CLI

If you're on macOS you can use Homebrew:

brew install autometrics-dev/tap/am

or you can grab the binaries directly from the GitHub release.

  1. Set up and call the generator

The generator is the binary in cmd/autometrics, so the easiest way to get it is to install it through go:

go install github.com/autometrics-dev/autometrics-go/cmd/autometrics@latest
Make sure your `$PATH` is set up

In order to have autometrics visible then, make sure that the directory $GOBIN (or the default $GOPATH/bin) is in your $PATH:

$ echo "$PATH" | grep -q "${GOBIN:-$GOPATH/bin}" && echo "GOBIN in PATH" || echo "GOBIN not in PATH, please add it"
GOBIN in PATH

You can now call go generate:

go generate ./main.go
  1. Build and run the application

Run go build to compile the Go application

go build

...and run the generated binary.

./gettingstarted-am-go

The application will start on a port 8080 by default and expose a metrics endpoint.

  1. Start the Autometrics CLI and Explorer

Start the Autometrics CLI and point it to the endpoint it can scrape metrics from.

am start :8080

Autometrics CLI will download and run a Prometheus binary under the hood and start scraping metrics.

  1. Preview the metrics in Autometrics Explorer

Autometrics CLI will also start a server with the Explorer available on localhost:6789. You can browse it and start exploring your sample app metrics! (You might need to ping the endpoints a few times to see the data reflected).

That's all!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages