Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

OpenTelemetry simple sample application #44

Merged
merged 4 commits into from
Jan 26, 2021

Conversation

RichVanderwal
Copy link
Contributor

This is a very simple Go application, based off of @krnowak 's excellent Getting Started guide, which substitutes the New Relic OpenTelemetry Exporter for the stdout exporter in the original example.

It's a supporting document for New Relic's OpenTelemetry documentation. Run it like this:

NEW_RELIC_API_KEY=<New Relic Insert API Key> go run main.go

...where that key is obtained from the New Relic One UI according to these quick instructions.

It works for me, I'd love to hear others' experiences with it before it becomes part of our official documentation.

@RichVanderwal RichVanderwal self-assigned this Dec 18, 2020
@RichVanderwal RichVanderwal added the documentation Improvements or additions to documentation label Dec 18, 2020
@RichVanderwal RichVanderwal linked an issue Dec 18, 2020 that may be closed by this pull request
Copy link

@krnowak krnowak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a couple of things.

examples/simple/main.go Outdated Show resolved Hide resolved
examples/simple/go.mod Outdated Show resolved Hide resolved
examples/simple/go.mod Outdated Show resolved Hide resolved
Comment on lines 32 to 35
apiKey, ok := os.LookupEnv("NEW_RELIC_API_KEY")
if !ok {
fmt.Println("missing NEW_RELIC_API_KEY required for New Relic OpenTelemetry Exporter")
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we exit if there is no license key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that if a customer was using this to retrofit an existing application, they wouldn't want to stop the world due to a lack of monitoring. I've added an os.Exit(1) in here now.

}

exporter, err := newrelic.NewExporter(
"Sample OpenTelemetry Service",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The app name should be consistent with the folder name. We currently use simple for the folder and sample for the app name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

Comment on lines 44 to 46
if err != nil {
fmt.Printf("failed to instantiate New Relic OpenTelemetry exporter: %v\n", err)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we exit if we are not able to instantiate the exporter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reasoning as above. Fixed. Perhaps we should be using log.Fatal() for these.

Comment on lines +74 to +77
fooKey := label.Key("ex.com/foo")
barKey := label.Key("ex.com/bar")
lemonsKey := label.Key("ex.com/lemons")
anotherKey := label.Key("ex.com/another")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be helpful to change the prefix to simple? It makes it obvious that the data came from the simple example.

Relatedly, what is the recommended practice in the OTel community for naming metrics? Do these metric names follow those practices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with metric naming practices in OpenTelemetry, but these metric names come straight from the Getting Started guide written by the OpenTelementry Go folks.

Changing it would add to the confusion.

@joshuabenuck
Copy link

joshuabenuck commented Jan 8, 2021

It took @nr-swilloughby and I some time to figure out where the data was being sent and how to view it. It would be really helpful to include details in a short README on the steps needed to view the data. Something along the lines of:

  • Get an API key, by following .
  • Run the app (a few times) like so...., in order to generate a few data points.
  • Wait (a few minutes?) for the data to be processed by New Relic (what's the expected time to glass here?)
  • Go to NR One, click on Entity Explorer.
  • You should see transactions in Distributed Transactions and metrics under Metrics.

Bonus points for screenshots for any of the above steps.

@RichVanderwal
Copy link
Contributor Author

I wish I had given you the context that this sample application is to supplement the Getting Started guide here.

@jodeev jodeev added this to In progress in Go Engineering Board Jan 14, 2021
@RichVanderwal
Copy link
Contributor Author

This sample application needs to be re-worked to accommodate the new API changes in Go OpenTelemetry v0.16.0.

@RichVanderwal RichVanderwal merged commit 79eaa09 into newrelic:master Jan 26, 2021
Go Engineering Board automation moved this from In progress to Done Jan 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Development

Successfully merging this pull request may close these issues.

New Relic Go OpenTelemetry Documentation
4 participants