-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Supportability of the Hapi Framework Integration #9344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
We can add this to node-experimental (soon to be node-opentelemetry), via a new |
mydea
pushed a commit
that referenced
this issue
Dec 18, 2023
Resolves: #9344 Adds a new node integration for Hapi framework. Also exports a Hapi plugin to capture errors when the tracing instrumentation from `node-experimental` is used. Can be used with `node-experimental` ([Sample Error Event](https://sentry-sdks.sentry.io/issues/4624554372/?project=4506162118983680&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=1h&stream_index=0)) like: ```typescript const Sentry = require('@sentry/node-experimental'); Sentry.init({ dsn: '__DSN__', tracesSampleRate: 1.0, }); const Hapi = require('@hapi/hapi'); const init = async () => { const server = Hapi.server({ port: 3000, host: 'localhost' }); await server.register(Sentry.hapiErrorPlugin) server.route({ method: 'GET', path: '/', handler: (request, h) => { throw new Error('My Hapi Sentry error!'); } }); await server.start(); }; ``` Also can be used from `@sentry/node` with tracing ([Errored Transaction](https://sentry-sdks.sentry.io/performance/node-hapi:8a633340fc724472bb44aae4c7572827/?project=4506162118983680&query=&referrer=performance-transaction-summary&statsPeriod=1h&transaction=%2F&unselectedSeries=p100%28%29&unselectedSeries=avg%28%29), [Successful Transaction](https://sentry-sdks.sentry.io/performance/node-hapi:deeb79f0c6bf41c68c776833c4629e6e/?project=4506162118983680&query=&referrer=performance-transaction-summary&statsPeriod=1h&transaction=%2F&unselectedSeries=p100%28%29&unselectedSeries=avg%28%29)) and error tracking ([Event](https://sentry-sdks.sentry.io/issues/4626919129/?project=4506162118983680&query=is%3Aunresolved&referrer=issue-stream&statsPeriod=1h&stream_index=0)) like: ```typescript 'use strict'; const Sentry = require('@sentry/node'); const Hapi = require('@hapi/hapi'); const init = async () => { const server = Hapi.server({ port: 3000, host: 'localhost' }); Sentry.init({ dsn: '__DSN__', tracesSampleRate: 1.0, integrations: [ new Sentry.Integrations.Hapi({server}), ], debug: true, }); server.route({ method: 'GET', path: '/', handler: (request, h) => { return 'Hello World!'; } }); await server.start(); }; ```
Support released with https://github.com/getsentry/sentry-javascript/releases/tag/7.89.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem Statement
We are using Hapi as framework in our backends. From what I understand there is no official plugin for integrating Hapi with Sentry (on the same level as there is for Express compatible frameworks).
I want to be able to have a distributed trace between my frontends and backend that is using Hapi which is not supported right now.
The main goal is to be able to identify problems that occur in the backends and also to be able to track any related problems in the frontends to the corresponding backend problem.
Solution Brainstorm
It could be possible to have this with the help of the node-opentelemetry for hapi -> https://www.npmjs.com/package/@opentelemetry/instrumentation-hapi
┆Issue is synchronized with this Jira Improvement by Unito
The text was updated successfully, but these errors were encountered: