-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.2.10
What platform is your computer?
Linux 6.9.3-76060903-generic x86_64 unknown
What steps can reproduce the bug?
- Call a route
- Check tracing backend (I'm using Jaeger)
- You will see "GET undefined" for route path
What is the expected behavior?
route path is not undefined.
What do you see instead?
Additional information
Packages installed:
+ [email protected]
+ [email protected]
+ @elysiajs/[email protected]
+ @elysiajs/[email protected]
+ @elysiajs/[email protected]
+ @opentelemetry/[email protected]
+ @opentelemetry/[email protected]
+ @opentelemetry/[email protected]
+ @opentelemetry/[email protected]
+ [email protected]
+ [email protected]
+ [email protected]
Opentelemetry middleware:
import { opentelemetry } from '@elysiajs/opentelemetry';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-node';
import Elysia from 'elysia';
import { OTLP_TRACE_ENDPOINT, OTLP_TRACE_TOKEN } from '../constants';
import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';
import { PinoInstrumentation } from '@opentelemetry/instrumentation-pino';
const otelMiddleware = new Elysia({
name: 'opentelemetry-middleware',
}).use(opentelemetry({
serviceName: 'main-backend',
instrumentations: [
new MongooseInstrumentation(),
new PinoInstrumentation(),
],
spanProcessors: [
new BatchSpanProcessor(new OTLPTraceExporter({
url: `${OTLP_TRACE_ENDPOINT}`,
// headers: {
// Authorization: `Bearer ${OTLP_TRACE_TOKEN}`,
// }
}))
]
}));
export default otelMiddleware;
Main elysia:
const app = new Elysia()
.use(
cors({
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
origin: ALLOWED_ORIGINS,
}),
)
// SECTION: Use OpenTelemetry middleware
.use(otelMiddleware)
// !SECTION
// SECTION: Importing controllers
.use(usersController);
if (!IS_PRODUCTION) {
app.use(swagger());
}
usersController:
const userService = new UserService();
const usersController = new Elysia({
name: 'users-controller',
prefix: '/users',
});
usersController
.get('/', async ({ query }) => {
const page = Number(query?.page) || 1;
const limit = Number(query?.limit) || 10;
return await record('getUsers', () => userService.getUsers(page, limit));
})
.post('/', async ({ body }) => {
return await userService.createUser(body);
})
.get('/:id', async ({ params: { id } }) => {
return await userService.getUserById(id);
})
.put('/:id', async ({ params: { id }, body }) => {
return await userService.updateUser(id, body);
})
.delete('/:id', async ({ params: { id } }) => {
return await userService.deleteUser(id);
});
export default usersController;
Have you try removing the node_modules
and bun.lockb
and try again yet?
yes
pedrofialho
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working