Skip to content
Open
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@connectrpc/connect-fastify": "^1.6.1",
"@connectrpc/connect-node": "^1.6.1",
"@dailydotdev/graphql-redis-subscriptions": "^2.4.3",
"@dailydotdev/node-common": "^0.0.8",
"@dailydotdev/schema": "0.2.74",
"@dailydotdev/ts-ioredis-pool": "^1.0.2",
"@fastify/cookie": "^11.0.2",
Expand All @@ -47,7 +48,7 @@
"@fastify/swagger": "^9.6.1",
"@fastify/swagger-ui": "^5.2.5",
"@google-cloud/bigquery": "^8.1.1",
"@google-cloud/pino-logging-gcp-config": "^1.3.1",
"@google-cloud/pino-logging-gcp-config": "^1.3.3",
"@google-cloud/pubsub": "^5.2.0",
"@google-cloud/storage": "^7.18.0",
"@graphql-tools/schema": "^10.0.30",
Expand Down Expand Up @@ -142,7 +143,7 @@
"parsecurrency": "^1.1.1",
"pg": "^8.16.3",
"pg-query-stream": "^4.10.3",
"pino": "^10.1.0",
"pino": "^10.3.1",
"rate-limiter-flexible": "^9.0.1",
"reflect-metadata": "^0.2.2",
"retry": "^0.13.1",
Expand Down
99 changes: 74 additions & 25 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import jwt from 'jsonwebtoken';
import { Roles } from './roles';
import { cookies } from './cookies';
import * as fs from 'fs';
import { runInSpan } from './telemetry';
import { runInSpan } from '@dailydotdev/node-common/telemetry';

const INTERNAL_AUTH_MAX_AGE_MS = 5000; // 5 seconds

Expand Down
2 changes: 1 addition & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runInRootSpan } from './telemetry';
import { runInRootSpan } from '@dailydotdev/node-common/telemetry';
import 'reflect-metadata';
import { PubSub } from '@google-cloud/pubsub';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/personalizedDigest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runInRootSpan } from '../telemetry';
import { runInRootSpan } from '@dailydotdev/node-common/telemetry';
import 'reflect-metadata';
import { PubSub } from '@google-cloud/pubsub';

Expand Down
2 changes: 1 addition & 1 deletion src/commands/workerJob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { runInRootSpan } from '../telemetry';
import { runInRootSpan } from '@dailydotdev/node-common/telemetry';
import 'reflect-metadata';
import { PubSub } from '@google-cloud/pubsub';

Expand Down
2 changes: 1 addition & 1 deletion src/common/feedGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '../schema/common';
import graphorm from '../graphorm';
import { mapArrayToOjbect } from './object';
import { runInSpan } from '../telemetry';
import { runInSpan } from '@dailydotdev/node-common/telemetry';
import { whereVordrFilter } from './vordr';
import { baseFeedConfig, type FeedFlagsFilters } from '../integrations/feed';
import type { FeedResponse } from '../integrations/feed/types';
Expand Down
3 changes: 2 additions & 1 deletion src/common/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {
import { ChangeMessage, ChangeObject } from '../types';
import { SourceMemberRoles } from '../roles';
import { SpanKind } from '@opentelemetry/api';
import { addPubsubSpanLabels, runInRootSpan, runInSpan } from '../telemetry';
import { addPubsubSpanLabels } from '../telemetry';
import { runInRootSpan, runInSpan } from '@dailydotdev/node-common/telemetry';
import { Message } from '@google-cloud/pubsub';
// import { performance } from 'perf_hooks';
import { DataSource } from 'typeorm';
Expand Down
2 changes: 1 addition & 1 deletion src/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import './config';
import { crons } from './cron/index';
import createOrGetConnection from './db';
import { logger } from './logger';
import { runInRootSpan } from './telemetry';
import { runInRootSpan } from '@dailydotdev/node-common/telemetry';

export default async function app(cronName: string): Promise<void> {
const connection = await createOrGetConnection();
Expand Down
15 changes: 10 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fastify, {
FastifyError,
FastifyReply,
type FastifyRegisterOptions,
type FastifyPluginCallback,
} from 'fastify';
import fastifyRawBody from 'fastify-raw-body';
import helmet from '@fastify/helmet';
Expand All @@ -30,15 +31,17 @@ import cookie, { FastifyCookieOptions } from '@fastify/cookie';
import { getSubscriptionSettings } from './subscription';
import { ioRedisPool } from './redis';
import { loadFeatures } from './growthbook';
import { runInRootSpan } from './telemetry';
import { loggerConfig } from './logger';
import { runInRootSpan } from '@dailydotdev/node-common/telemetry';
import { getTemporalClient } from './temporal/client';
import { BrokenCircuitError } from 'cockatiel';
import { remoteConfig } from './remoteConfig';
import { ZodError } from 'zod';
import { closeClickHouseClient } from './common/clickhouse';
import { GQL_MAX_FILE_SIZE } from './config';
import otelPlugin from './telemetry/plugin';
import { pinoLoggerConfig } from '@dailydotdev/node-common/logger';
import otelPlugin, {
type FastifyOtelPluginOptions,
} from '@dailydotdev/node-common/telemetry/plugin';

type Mutable<Type> = {
-readonly [Key in keyof Type]: Type[Key];
Expand Down Expand Up @@ -71,7 +74,7 @@ export default async function app(
);

const app = fastify({
logger: loggerConfig,
logger: pinoLoggerConfig,
disableRequestLogging: true,
trustProxy: true,
routerOptions: {
Expand All @@ -80,7 +83,9 @@ export default async function app(
});

app.log.info('loading features');
app.register(otelPlugin);
app.register(
otelPlugin as unknown as FastifyPluginCallback<FastifyOtelPluginOptions>, // TODO: Fix this
);
await loadFeatures(app.log);

const gracefulShutdown = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/integrations/feed/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from './types';
import { AnonymousFeedFilters, feedToFilters } from '../../common';
import { postTypes } from '../../entity';
import { runInSpan } from '../../telemetry';
import { runInSpan } from '@dailydotdev/node-common/telemetry';
import { ILofnClient } from '../lofn';
import { Context } from '../../Context';

Expand Down
2 changes: 1 addition & 1 deletion src/integrations/retry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import retry, { OperationOptions } from 'retry';
import isNetworkError from './networkError';
import fetch, { RequestInfo, RequestInit, Response } from 'node-fetch';
import { runInSpan } from '../telemetry';
import { runInSpan } from '@dailydotdev/node-common/telemetry';
import { trace } from '@opentelemetry/api';
import {
ATTR_HTTP_REQUEST_METHOD,
Expand Down
Loading
Loading