Skip to content

Commit

Permalink
Merge pull request #18553 from iamemilio/simplified-go-easy-install
Browse files Browse the repository at this point in the history
go easy improved install workflow
  • Loading branch information
ally-sassman authored Sep 3, 2024
2 parents 0fb2d93 + 8f1a552 commit 727bf0e
Showing 1 changed file with 38 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The scope of what this tool can instrument in your application is limited to the
* Wrapping HTTP handlers
* Injecting distributed tracing into external traffic

Only the following Go packages and libraries are currently supported:
### Supported Libraries [#supported-libraries]

* standard library
* net/http
Expand All @@ -64,25 +64,49 @@ Only the following Go packages and libraries are currently supported:

Before you start the installation steps below, make sure you have a version of Go installed that is within the support window for the current [Go programming language lifecycle](https://endoflife.date/go).

1. Clone the [Go instrumentation repository](https://github.com/newrelic/go-easy-instrumentation) to a directory on your system. For example:
```sh
git clone https://github.com/newrelic/go-easy-instrumentation.git
```
2. Go into that directory:
```sh
cd go-easy-instrumentation
```
3. Resolve any third-party dependencies:
```sh
go mod tidy
```
Install Go easy instrumentation:
```sh
go install github.com/newrelic/go-easy-instrumentation@latest
```

<CollapserGroup>
<Collapser
id="setup-go-path"
title="Setting up your GOPATH"
>
The easiest way to use the installed `go-easy-instrumentation` binary is by adding your `GOPATH` bin to your `PATH`.

<CollapserGroup>
<Collapser
id="unix-gopath"
title="Mac or Linux"
>
In your terminal, bashrc, or zshrc, the following line adds the path to your `GOPATH` bin to your `PATH`:
```sh
export PATH=$PATH:$(go env GOPATH)/bin
```
</Collapser>
<Collapser
id="windows-gopath"
title="Windows"
>
In a windows terminal or powershell window, the following line will add the path to your `GOPATH` bin to your `PATH`:
```sh
go env -w GOPATH=c:\go-work
```
</Collapser>
</CollapserGroup>
</Collapser>
</CollapserGroup>


## Generate instrumentation suggestions [#generate-suggestions]

This tool works best with Git. We recommend you verify your application is on a branch without any unstaged changes before applying any of the generated changes to it. After checking that, follow these steps to generate and apply the changes that install the New Relic Go agent in an application:

1. Run the following CLI command to create a file named `new-relic-instrumentation.diff` in your working directory:
```sh
go run . -path ../my-application/
go-easy-instrumentation -path ../my-application/
```
2. Open the `.diff` file and verify or correct the contents.
3. When you are satisfied with the instrumentation suggestions, save the file, and then apply the changes:
Expand Down

0 comments on commit 727bf0e

Please sign in to comment.