create-m5kdev 0.27.2 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-m5kdev",
3
- "version": "0.27.2",
3
+ "version": "0.28.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,6 +10,10 @@ export type E2EProfile = "standard" | "waitlist";
10
10
  const SERVER_FILTER = "pnpm --filter {{PACKAGE_SCOPE}}/server exec";
11
11
  const WEBAPP_FILTER = "pnpm --filter {{PACKAGE_SCOPE}}/webapp exec";
12
12
 
13
+ const SIGNOZ_OTLP_ENDPOINT =
14
+ process.env.OTEL_EXPORTER_OTLP_ENDPOINT ??
15
+ "https://signoz-ingester-production-9090.up.railway.app";
16
+
13
17
  const PORTS: Record<E2EProfile, { web: number; server: number; expoWeb: number; expoServer: number; redisDb: number; expoRedisDb: number }> = {
14
18
  standard: { web: 15173, server: 18180, expoWeb: 15183, expoServer: 18182, redisDb: 1, expoRedisDb: 3 },
15
19
  waitlist: { web: 15174, server: 18181, expoWeb: 15184, expoServer: 18183, redisDb: 2, expoRedisDb: 4 },
@@ -36,6 +40,14 @@ function serverEnv(profile: E2EProfile, expo: boolean): Record<string, string> {
36
40
  // hermetic: a real key in the invoking shell would flip email mode to
37
41
  // "send" and the stored-email assertions would find nothing
38
42
  RESEND_API_KEY: "",
43
+ ...(process.env.OTEL_SDK_DISABLED === "true"
44
+ ? {}
45
+ : {
46
+ OTEL_EXPORTER_OTLP_ENDPOINT: SIGNOZ_OTLP_ENDPOINT,
47
+ OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf",
48
+ OTEL_SERVICE_NAME: `starter-server-e2e-${suffix}`,
49
+ OTEL_RESOURCE_ATTRIBUTES: `deployment.environment=e2e,e2e.profile=${profile},e2e.platform=${expo ? "expo" : "web"}`,
50
+ }),
39
51
  };
40
52
  }
41
53
 
@@ -1,4 +1,6 @@
1
+ import "./instrumentation";
1
2
  import type { Server } from "node:http";
3
+ import { shutdownTelemetry } from "@m5kdev/backend/lib/otel";
2
4
  import { builtBackendApp } from "./app";
3
5
 
4
6
  const port = process.env.PORT ? Number.parseInt(process.env.PORT, 10) : 8080;
@@ -15,6 +17,11 @@ async function shutdown(): Promise<void> {
15
17
  } catch (e) {
16
18
  logError("builtBackendApp.shutdown() failed", e);
17
19
  }
20
+ try {
21
+ await shutdownTelemetry();
22
+ } catch (e) {
23
+ logError("shutdownTelemetry() failed", e);
24
+ }
18
25
  if (httpServer) {
19
26
  await new Promise<void>((resolve) => {
20
27
  httpServer?.close((err) => {
@@ -0,0 +1,5 @@
1
+ import { initTelemetry } from "@m5kdev/backend/lib/otel";
2
+
3
+ initTelemetry({
4
+ serviceName: process.env.OTEL_SERVICE_NAME ?? "starter-server",
5
+ });
@@ -1,4 +1,5 @@
1
1
  import { BasePermissionService } from "@m5kdev/backend/modules/base/base.service";
2
+ import { serializeSpanValue, withSpan } from "@m5kdev/backend/utils/telemetry";
2
3
  import type { Context } from "@m5kdev/backend/utils/trpc";
3
4
  import { err, ok } from "neverthrow";
4
5
  import { postSchemas } from "./posts.dto";
@@ -14,10 +15,19 @@ export class PostsService extends BasePermissionService<
14
15
  .input(postSchemas.input.list)
15
16
  .output(postSchemas.output.list)
16
17
  .requireAuth()
17
- .handle(({ input }) => {
18
- return this.repository.posts.queryList(input, {
19
- globalSearchColumns: ["title", "excerpt", "content"],
20
- });
18
+ .handle(async ({ input }) => {
19
+ return withSpan(
20
+ {
21
+ name: "posts.list.query",
22
+ attributes: { input: serializeSpanValue(input) },
23
+ },
24
+ (span) => {
25
+ span.addEvent("span started");
26
+ return this.repository.posts.queryList(input, {
27
+ globalSearchColumns: ["title", "excerpt", "content"],
28
+ });
29
+ }
30
+ );
21
31
  });
22
32
 
23
33
  readonly create = this.procedure("create")