OpenTelemetry With New Relic
Last updated: 2 minutes read.
This guide provides a step-by-step procedure to integrate New Relic with Tyk Gateway via the OpenTelemetry Collector. At the end of this guide, you will be able to visualize traces and metrics from your Tyk Gateway on the New Relic console.
Prerequisites
- Docker installed on your machine
- New Relic Account
- New Relic API Key
- Gateway v5.2.0 or higher
- OTel Collector docker image
Setup Guide
Step 1: Obtain New Relic API Key
-
Navigate to your New Relic Console.
-
Go to
Profile → API keys
. -
Copy the key labeled as
INGEST-LICENSE
.
Example token:
93qwr27e49e168d3844c5h3d1e878a463f24NZJL
Step 2: Configuration Files
OTel Collector Configuration YAML
- Create a file named
otel-collector-config.yml
under the configs directory. - Copy the following template into that file:
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
grpc:
endpoint: 0.0.0.0:4317
processors:
batch:
exporters:
otlphttp:
endpoint: "<YOUR-ENVIRONMENT-STRING>"
headers:
api-Key: "<YOUR-NEW-RELIC-API-KEY>"
extensions:
health_check:
pprof:
endpoint: :1888
zpages:
endpoint: :55679
service:
extensions: [pprof, zpages, health_check]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
- Replace
<YOUR-ENVIRONMENT-STRING>
with your specific New Relic endpoint (https://otlp.nr-data.net
for US orhttps://otlp.eu01.nr-data.net
for EU). - Replace
<YOUR-NEW-RELIC-API-KEY>
with the API key obtained in Step 1.
Docker Compose configuration
-
Create a file named docker-compose.yml at the root level of your project directory.
-
Paste the following code into that file:
version: "3.9"
services:
otel-collector:
image: otel/opentelemetry-collector:latest
volumes:
- ./otel-collector-config.yml:/etc/otel-collector.yml
command: ["--config=/etc/otel-collector.yml"]
networks:
- tyk
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
- "55670:55679" # zpages extension
networks:
tyk:
Note
Replace the variable fields with the relevant data.
Step 3: Testing and Verifying Traces
-
Run
docker-compose up -d
to start all services. -
Initialize your Tyk environment.
-
Create a simple
httpbin
API using Tyk Dashboard. You can follow the Tyk Dashboard documentation for more information. -
Send requests to the API using cURL or Postman.
-
Open New Relic Console.
-
Navigate to
APM & Services → Services - OpenTelemetry → tyk-gateway
.
- Wait for about 5 minutes for the data to populate.
Traces and graphs should now be visible on your New Relic console.
Note
If traces are not showing, try refreshing the New Relic dashboard.
Troubleshooting
- If the traces aren’t appearing, double-check your API key and endpoints.
- Ensure that your Tyk Gateway and New Relic are both running and connected.
Conclusion
You have successfully integrated New Relic with Tyk Gateway via the OpenTelemetry Collector. You can now monitor and trace your APIs directly from the New Relic console.