Skip to content

Commit

Permalink
Add support for amqplib
Browse files Browse the repository at this point in the history
Automatically create spans when amqplib is used. It works on every
library that uses amqplib including Rascal.
  • Loading branch information
jeffkreeftmeijer authored and luismiramirez committed May 6, 2024
1 parent 3868536 commit 27c1ca7
Show file tree
Hide file tree
Showing 21 changed files with 8,326 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changesets/add-support-for-amqplib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "add"
---

The AMQP protocol is now instrumented when using amqplib. The AppSignal client automatically instruments and creates spans when using `amqplib`. Packages using amqplib such as Rascal are supported.
76 changes: 76 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
},
"dependencies": {
"@opentelemetry/api": ">= 1.7.0 < 1.8.0",
"@opentelemetry/exporter-metrics-otlp-proto": ">= 0.48.0 < 0.49",
"@opentelemetry/instrumentation-express": ">= 0.33.3 < 0.34",
"@opentelemetry/instrumentation-fastify": ">= 0.32.4 < 0.33",
"@opentelemetry/instrumentation-amqplib": ">= 0.36.0 < 0.37",
"@opentelemetry/instrumentation-graphql": ">= 0.35.2 < 0.36",
"@opentelemetry/instrumentation-http": ">= 0.47.0 < 0.48",
"@opentelemetry/instrumentation-ioredis": ">= 0.35.3 < 0.36",
Expand All @@ -30,14 +32,14 @@
"@opentelemetry/instrumentation-redis-4": ">= 0.35.5 < 0.36",
"@opentelemetry/instrumentation-restify": ">= 0.34.2 < 0.35",
"@opentelemetry/sdk-node": ">= 0.48.0 < 0.49",
"@opentelemetry/exporter-metrics-otlp-proto": ">= 0.48.0 < 0.49",
"@prisma/instrumentation": ">= 5.6.0 < 5.10.0",
"node-addon-api": "^3.1.0",
"node-gyp": "^10.0.0",
"tslib": "^2.0.3",
"winston": "^3.6.0"
},
"devDependencies": {
"@types/amqplib": "^0.10.5",
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
Expand Down
2 changes: 2 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics"
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto"

import { Instrumentation } from "@opentelemetry/instrumentation"
import { AmqplibInstrumentation } from "@opentelemetry/instrumentation-amqplib"
import {
ExpressInstrumentation,
ExpressLayerType
Expand Down Expand Up @@ -46,6 +47,7 @@ import { SpanProcessor, TestModeSpanProcessor } from "./span_processor"
import { Heartbeat } from "./heartbeat"

const DefaultInstrumentations = {
"@opentelemetry/instrumentation-amqplib": AmqplibInstrumentation,
"@opentelemetry/instrumentation-express": ExpressInstrumentation,
"@opentelemetry/instrumentation-fastify": FastifyInstrumentation,
"@opentelemetry/instrumentation-graphql": GraphQLInstrumentation,
Expand Down
1 change: 1 addition & 0 deletions test/express-rabbitmq/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
5 changes: 5 additions & 0 deletions test/express-rabbitmq/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:18

COPY run.sh /

ENTRYPOINT ["sh", "/run.sh"]
Loading

0 comments on commit 27c1ca7

Please sign in to comment.