Skip to content

fix: stats web styling + instrumentation#2454

Merged
baktun14 merged 4 commits intomainfrom
fix/stats-web-styling
Jan 6, 2026
Merged

fix: stats web styling + instrumentation#2454
baktun14 merged 4 commits intomainfrom
fix/stats-web-styling

Conversation

@baktun14
Copy link
Contributor

@baktun14 baktun14 commented Jan 6, 2026

Summary by CodeRabbit

  • Style

    • Updated button styling on statistics cards for improved visual appearance
    • Enhanced time range toggle buttons with refined styling
    • Refreshed banner text colors for consistent theming across alerts and notifications
  • Chores

    • Improved environment configuration validation and logging infrastructure

✏️ Tip: You can customize this high-level summary in your review settings.

@baktun14 baktun14 requested a review from a team as a code owner January 6, 2026 16:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

The pull request updates UI component styling across banner and toggle elements, refactors logging context strings for improved organization, and introduces a new instrumentation module that validates environment variables against a server schema when running in Node.js runtime, exiting on validation failure.

Changes

Cohort / File(s) Summary
UI Styling Updates
apps/stats-web/src/app/(home)/StatsCard.tsx, apps/stats-web/src/components/graph/TimeRange.tsx, apps/stats-web/src/components/layout/TopBanner.tsx
CSS class updates across three components: Button variant changed from secondary to ghost with additional styling in StatsCard; ToggleGroupItem styling refactored to use standard primary classes in TimeRange; banner text and close button styling updated to use primary-foreground in TopBanner. No behavioral changes.
Instrumentation & Environment Validation
apps/stats-web/src/instrumentation.ts
New module that exports async register() function. Dynamically imports environment loader and server config schema, validates process.env against schema when NEXT_RUNTIME is "nodejs", logs error and exits with code 1 on validation failure.
Logging Context Updates
apps/stats-web/src/config/env-config.schema.ts, apps/stats-web/src/lib/copyClipboard.ts
Logger context strings simplified to shorter, human-readable values (e.g., "env-config-schema", "copyClipboard"). copyClipboard.ts also adds logger config import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • stalniy
  • ygrishajev

Poem

🐰 Our styles bloom with fresher hues,
Banners sing in primary blues,
Loggers whisper shorter names,
Environment validates our claims—
A tidy home, well-configured and true! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: styling updates across multiple components and new instrumentation setup with environment validation.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

stalniy
stalniy previously approved these changes Jan 6, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/stats-web/src/instrumentation.ts (3)

8-8: Consider clarifying the env-loader import pattern.

The destructuring pattern ignores the first import result, which suggests @akashnetwork/env-loader is imported solely for its side effects (e.g., loading .env files). While this works correctly, the intent could be clearer to future maintainers.

🔎 Optional refactor for clarity
-    const [, { serverEnvSchema }] = await Promise.all([import("@akashnetwork/env-loader"), import("./config/env-config.schema")]);
+    // Import env-loader for side effects (loads .env files)
+    await import("@akashnetwork/env-loader");
+    const { serverEnvSchema } = await import("./config/env-config.schema");

Or if parallel loading is important for performance:

-    const [, { serverEnvSchema }] = await Promise.all([import("@akashnetwork/env-loader"), import("./config/env-config.schema")]);
+    const [, { serverEnvSchema }] = await Promise.all([
+      import("@akashnetwork/env-loader"), // Imported for side effects
+      import("./config/env-config.schema")
+    ]);

12-12: Follow Pino conventions for error logging.

The error logging format uses { message: "...", error }, but Pino's standard convention is to use the err key for error objects and msg (or just pass a string as the second argument) for messages. Using the conventional format ensures proper error serialization and stack trace handling.

🔎 Recommended fix to align with Pino conventions
-    logger.error({ message: "Failed to validate server environment variables", error });
+    logger.error({ err: error, msg: "Failed to validate server environment variables" });

1-3: Consider using createOtelLogger for enhanced observability.

Based on learnings, backend services can benefit from using createOtelLogger from @akashnetwork/logging/otel to include OpenTelemetry trace context in logs. While this instrumentation file runs during startup rather than handling runtime requests, adding OTel context could still enhance observability for debugging initialization issues.

Based on learnings: For backend services, prefer using createOtelLogger to include OpenTelemetry trace context in logs.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90cb988 and 20cc26f.

📒 Files selected for processing (1)
  • apps/stats-web/src/instrumentation.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{ts,tsx,js}: Never use type any or cast to type any. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.

Files:

  • apps/stats-web/src/instrumentation.ts
🧠 Learnings (1)
📚 Learning: 2025-11-12T09:03:40.132Z
Learnt from: stalniy
Repo: akash-network/console PR: 0
File: :0-0
Timestamp: 2025-11-12T09:03:40.132Z
Learning: For backend services (like the Indexer), prefer using createOtelLogger from "akashnetwork/logging/otel" to include OpenTelemetry trace context in logs.

Applied to files:

  • apps/stats-web/src/instrumentation.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: test-build
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/stats-web/src/instrumentation.ts (1)

1-3: NEXT_RUNTIME is reliably available at module load time.

The NEXT_RUNTIME environment variable is set by Next.js during server initialization before the instrumentation.ts module is imported. This is a standard Next.js pattern, as confirmed by the consistent implementation across both apps/stats-web and apps/deploy-web. The logger will have the correct runtime value in its name.

@baktun14 baktun14 merged commit e12b74a into main Jan 6, 2026
57 checks passed
@baktun14 baktun14 deleted the fix/stats-web-styling branch January 6, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments