現在、このページは英語版のみです。

Getting started with any new technology can be daunting, but oftentimes, that’s only because we don’t have the proper tools. OpenTelemetry isn’t quite new any more, having officially been incepted in 2019; however, there can be a steep learning curve when it comes to instrumenting your services with this popular open-source observability framework. 

What about when you just want to try it out and see the data it generates before you invest significant time going through the documentation to learn how to instrument a service with OpenTelemetry? This blog post highlights some of the tools that are available to you for just this purpose. 

Continue through this post to read about them, or use the list below to skip ahead to the one that piques your interest:

otel-cli

The otel-cli is a command-line interface tool that lets you send OpenTelemetry traces to a collector or New Relic from the command line. This is a good option for trying out OpenTelemetry because it:

  • Enables you to get started with distributed tracing quickly
  • Enables you to add tracing to shell scripts and other applications that don’t support tracing natively
  • Is fairly simple

otel-cli requires a working Go environment, which may potentially add an additional layer of complexity for you. Fortunately, it’s fairly easy to install Go; follow the instructions here. Once you’ve got Go set up, have your New Relic license key handy, then follow the steps below to use otel-cli to generate a trace and send it to your New Relic account:

  1. Install otel-cli. The repo provides a few different ways to install otel-cli, but generally running this command will work for most platforms:
    • go install github.com/equinix-labs/otel-cli@latest
  2. Export the following environment variables:
    • OTEL_EXPORTER_OTLP_HEADERS=api-key=[YOUR_NR_LICENSE_KEY]
      • Replace [YOUR_NR_LICENSE_KEY] with your account ingest license key
    • OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4317
    • OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
    • OTEL_TRACES_EXPORTER=otlp
  3. Run a program inside a span:
    • otel-cli exec --service my-service --name "curl google" curl https://google.com
  4. Head to your New Relic account and query the span:
    • SELECT * FROM Span since 5 minutes ago
  5. You can also view your new OpenTelemetry service, called “my-service”, under All entities > Services - OpenTelemetry. From there, access Distributed tracing, click on the trace group curl google and then check out more details about the span, such as its attributes and duration:
  • Note that the charts on the Summary page will be empty because the span that’s generated is of span kind “client”. The Summary charts only query for spans that are “consumer” or “server” kind. 

As you’ve just seen, the span that’s generated is fairly simple. But what if you want to see some data that’s a little more interesting?

telemetrygen

Another tool for trying out OpenTelemetry is telemetrygen, a utility that simulates a client that generates traces, metrics, and logs. It’s a quick way to see some OpenTelemetry data, and it doesn’t require your own application. 

telemetrygen is primarily useful for testing and demonstration purposes, so the data it produces is pretty basic—it’s static and not particularly realistic. You’ll also need to run a collector, an OpenTelemetry component that receives, transforms, and exports telemetry. 

  1. Use Docker to pull the OpenTelemetry Collector image and run the collector in a container:
    • docker pull otel/opentelemetry-collector:0.91.0
    • docker run otel/opentelemetry-collector:0.91.0
  2. In another terminal window or tab, install the telemetrygen utility:
    • go install github.com/open-telemetry/opentelemetry-collector-contrib/cmd/telemetrygen@latest
  3. Generate telemetry by running this command to send some data to the collector:
    • telemetrygen traces --otlp-insecure --duration 5s
  4. After 5 seconds, the utility will stop and you can view the traces in your terminal where the collector is running: 

If you’re ready to get more hands-on and generate telemetry that’s more realistic, it may be time to check out the OpenTelemetry Community demo.

OpenTelemetry Community demo

The OpenTelemetry Community demo application is made up of several microservices written in different languages that talk to each other over gRPC and HTTP, and includes a load generator that simulates traffic. It’s developed and maintained by the OpenTelemetry community, with the purpose of providing a real-world example of a distributed system instrumented by OpenTelemetry. 

You can use the demo in several ways:

  • View instrumentation examples in different languages, including Java, .NET, and PHP.
  • Modify the instrumentation and collector config file to test and experiment.
  • Understand the data generated by OpenTelemetry instrumentation libraries. 
  • It also includes a few problem-solving scenarios to show you how to interpret OpenTelemetry data to solve them.

The base demo app includes some backends so you can see visualizations of the generated data. To learn how to deploy it and send data to your New Relic account, follow the steps in this blog post: Hands-on OpenTelemetry: Troubleshoot issues with your instrumented apps

New Relic OpenTelemetry examples

If you want to get hands-on with a more simple application, we have examples available in several languages in this repository. In the Getting Started Guides directory, you’ll find sample apps with and without OpenTelemetry instrumentation, so you can see what the code looks like before and after being instrumented. 

You can run the examples by following your selected language’s README file in its “instrumented” directory, or instrument the app yourself by following the README instructions in its “uninstrumented” directory.