Skip to content
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

Switch to CommonLogger interface #144

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"plugin:@typescript-eslint/strict",
"plugin:vitest/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
"plugin:import/typescript"
],
"plugins": ["@typescript-eslint", "vitest", "import"],
"parser": "@typescript-eslint/parser",
Expand Down
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ updates:
- dependency-name: '@typescript-eslint/parser'
- dependency-name: '@types/node'
- dependency-name: '@opentelemetry/*'
- dependency-name: '@prisma/instrumentation'
labels:
- 'skip-release'
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x, 21.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 27 February 2024

- * export isZodError function [`#126`](https://github.com/lokalise/fastify-extras/pull/126)
- - export isZodError function [`#126`](https://github.com/lokalise/fastify-extras/pull/126)

#### [v16.4.0](https://github.com/lokalise/fastify-extras/compare/v16.3.1...v16.4.0)

Expand Down Expand Up @@ -153,7 +153,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

> 20 September 2023

- * add FastifyReplyWithPayload type [`#82`](https://github.com/lokalise/fastify-extras/pull/82)
- - add FastifyReplyWithPayload type [`#82`](https://github.com/lokalise/fastify-extras/pull/82)
- Bump @opentelemetry/exporter-trace-otlp-grpc from 0.41.2 to 0.43.0 [`#80`](https://github.com/lokalise/fastify-extras/pull/80)
- Bump newrelic from 11.0.0 to 11.1.0 [`#79`](https://github.com/lokalise/fastify-extras/pull/79)

Expand Down
4 changes: 0 additions & 4 deletions lib/plugins/opentelemetry/spanProcessors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,14 @@ import { REQUEST_ID_STORE_KEY } from '../requestContextProviderPlugin'
*/
export class LokaliseSimpleSpanProcessor extends SimpleSpanProcessor {
onStart(span: Span) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const requestId = requestContext.get(REQUEST_ID_STORE_KEY)
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
span.setAttribute(REQUEST_ID_STORE_KEY, requestId)
}
}

export class LokaliseBatchSpanProcessor extends BatchSpanProcessor {
onStart(span: Span) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const requestId = requestContext.get(REQUEST_ID_STORE_KEY)
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
span.setAttribute(REQUEST_ID_STORE_KEY, requestId)
}
}
6 changes: 3 additions & 3 deletions lib/plugins/requestContextProviderPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { randomUUID } from 'crypto'
import { randomUUID } from 'node:crypto'

import { requestContext } from '@fastify/request-context'
import type { CommonLogger } from '@lokalise/node-core'
import type {
FastifyReply,
FastifyRequest,
FastifyInstance,
HookHandlerDoneFunction,
FastifyServerOptions,
FastifyBaseLogger,
} from 'fastify'
import fp from 'fastify-plugin'

Expand All @@ -21,7 +21,7 @@ declare module 'fastify' {
}

export interface BaseRequestContext {
logger: FastifyBaseLogger
logger: CommonLogger
reqId: string
}

Expand Down
47 changes: 23 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
"version": "auto-changelog -p && git add CHANGELOG.md"
},
"dependencies": {
"@bugsnag/js": "^7.22.4",
"@bugsnag/js": "^7.22.7",
"@lokalise/error-utils": "^1.1.0",
"@opentelemetry/api": "1.8.0",
"@opentelemetry/exporter-trace-otlp-grpc": "~0.49.1",
"@opentelemetry/instrumentation": "~0.49.1",
"@opentelemetry/resources": "~1.22.0",
"@opentelemetry/sdk-trace-base": "~1.22.0",
"@opentelemetry/sdk-trace-node": "~1.22.0",
"@opentelemetry/semantic-conventions": "~1.22.0",
"@prisma/instrumentation": "^5.11.0",
"@splitsoftware/splitio": "^10.25.1",
"@opentelemetry/exporter-trace-otlp-grpc": "0.50.0",
"@opentelemetry/instrumentation": "0.50.0",
"@opentelemetry/resources": "1.23.0",
"@opentelemetry/sdk-trace-base": "1.23.0",
"@opentelemetry/sdk-trace-node": "1.23.0",
"@opentelemetry/semantic-conventions": "1.23.0",
"@prisma/instrumentation": "^5.13.0",
"@splitsoftware/splitio": "^10.25.2",
"@amplitude/analytics-node": "^1.3.5",
"fastify-metrics": "^11.0.0",
"fastify-plugin": "^4.5.1",
Expand All @@ -67,29 +67,28 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@fastify/request-context": "^5.0.0",
"@lokalise/node-core": "^9.13.0",
"@fastify/request-context": "^5.1.0",
"@lokalise/node-core": "^9.15.0",
"@types/newrelic": "^9.14.3",
"@types/node": "^20.11.5",
"@amplitude/analytics-types": "^2.3.1",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitest/coverage-v8": "^1.2.1",
"@types/node": "^20.12.7",
"@amplitude/analytics-types": "^2.5.0",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@vitest/coverage-v8": "1.5.0",
"auto-changelog": "^2.4.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-vitest": "^0.3.20",
"fastify": "^4.25.2",
"eslint-plugin-vitest": "0.4.1",
"fastify": "^4.26.2",
"newrelic": "11.15.0",
"pino": "^8.17.2",
"pino": "^8.21.0",
"pino-pretty": "^11.0.0",
"prettier": "^3.2.5",
"shx": "^0.3.4",
"ts-node": "^10.9.1",
"typescript": "^5.4.2",
"vitest": "^1.2.1",
"zod": "^3.22.4"
"typescript": "^5.4.5",
"vitest": "1.5.0",
"zod": "^3.23.4"
},
"engines": {
"node": ">=18"
Expand Down
Loading