Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zmrfzn/go-samples
Sample applications showcasing New Relic's Go easy instrumentation
https://github.com/zmrfzn/go-samples
golang instrumentation newrelic
Last synced: 4 days ago
JSON representation
Sample applications showcasing New Relic's Go easy instrumentation
- Host: GitHub
- URL: https://github.com/zmrfzn/go-samples
- Owner: zmrfzn
- Created: 2024-12-02T05:09:21.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2025-01-13T04:32:32.000Z (6 days ago)
- Last Synced: 2025-01-13T05:24:25.589Z (6 days ago)
- Topics: golang, instrumentation, newrelic
- Language: Go
- Homepage: https://docs.newrelic.com/docs/apm/agents/go-agent/installation/install-automation-new-relic-go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
[![New Relic Experimental header](https://github.com/newrelic/opensource-website/raw/develop/src/images/categories/Experimental.png)](https://opensource.newrelic.com/oss-category/#new-relic-experimental)
# DevRel - Go Easy Instrumentation with New Relic
[New Relic Go easy instrumentation](https://docs.newrelic.com/docs/apm/agents/go-agent/installation/install-automation-new-relic-go) does most of the work for you by suggesting changes to your source code that instrument your application with the New Relic Go agent. This tool is currently in preview.
## Prerequisites
Before you begin, make sure you have:
1. The Go-Samples repository cloned locally
2. Go-easy instrumentation tool installed:
```bash
go install github.com/newrelic/go-easy-instrumentation@latest
```
3. Required environment variables set:
```bash
export NEW_RELIC_LICENSE_KEY="your_license_key"
export NEW_RELIC_APP_NAME="your_app_name"
```## Instrumenting Sample Applications
1. **Hello World**
From the root directory, run:
```bash
go-easy-instrumentation instrument 1.hello-world -o 1.hello-world/greeting.diff
```
The instrumentation changes will be saved in [1.hello-world](1.hello-world/).2. **REST API**
Run the following command from the go-easy directory:
> **Note**: Ensure the go-easy repository is cloned under the go-samples directory
```bash
go-easy-instrumentation instrument 2.rest-api --output 2.rest-api/rest-api.diff
```
Check for the `rest-api.diff` file in the [2.rest-api](2.rest-api/) directory.3. **Multi-endpoint REST API with Gin**
Run the following command:
```bash
go-easy-instrumentation instrument 3.gin -o 3.gin/gin-rest.diff
```
Check for the `gin-rest.diff` file in the [3.gin](3.gin/) directory.4. **gRPC Client & Server**
This requires two separate commands, one for the client and another for the server.
**Client**
To instrument the gRPC client, run the following command:
```bash
go-easy-instrumentation instrument 4.gRpc/client --output 4.gRpc/client/grpc-client.diff
```**Server**
To instrument the gRPC server, run the following command:
```bash
go-easy-instrumentation instrument 4.gRpc/server --output 4.gRpc/server/grpc-server.diff
```