Skip to content

Conversation

itssimon
Copy link

@itssimon itssimon commented Aug 20, 2025

Apitally is a simple API monitoring and analytics tool with an official plugin for Elysia.

This adds a page under Integrations with setup instructions, following a similar structure to the existing pages in that section.

Summary by CodeRabbit

  • Documentation
    • Added an Apitally integration guide: setup with Elysia, consumer tracing, configurable request/application logging, and TypeScript examples.
    • Included visuals illustrating the Apitally dashboard and linked to Apitally’s detailed setup docs.
    • Updated documentation navigation to list Apitally under Integrations for easier discovery.

Copy link

coderabbitai bot commented Aug 20, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adds an "Apitally" entry to the Integrations sidebar and adds a new documentation page describing how to integrate Apitally with ElysiaJS, covering setup, consumer tracing, and request/application logging configuration with code examples and references.

Changes

Cohort / File(s) Summary
Docs navigation
docs/.vitepress/config.ts
Inserts { text: 'Apitally', link: '/integrations/apitally' } into themeConfig.sidebar Integration items (placed before Astro).
Integration guide
docs/integrations/apitally.md
Adds a new guide describing Apitally integration with ElysiaJS: SEO metadata, overview, setup steps, consumer tracing example, request/application logging options, TypeScript code samples, an illustration image, and an external reference link.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer
    participant App as Elysia App
    participant Plugin as apitallyPlugin
    participant Cloud as Apitally

    Dev->>App: configure apitallyPlugin({ clientId, env, requestLogging? })
    App->>Plugin: initialize
    Plugin-->>Cloud: register app/env

    rect rgba(200,230,255,0.3)
    note right of App: Incoming HTTP request
    App->>Plugin: onRequest(ctx)
    opt Consumer tracing provided
        Plugin->>Plugin: derive consumer {identifier, name?, group?}
    end
    opt Request logging enabled
        Plugin-->>Cloud: send request/response metadata (headers/body optional)
    end
    Plugin-->>App: continue handler
    App-->>Cloud: optionally send application logs via captureLogs
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws—new links appear,
A burrowed path to Apitally here.
Traces traced and headers peered,
Requests hop past, logs are cheered.
Carrots counted, metrics bright,
The warren hums through day and night. 🥕📈

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 1

🧹 Nitpick comments (5)
docs/integrations/apitally.md (5)

9-15: Tighten SEO meta descriptions (active voice, clearer value props).

Recommend more action-oriented, descriptive copy for both description and og:description.

Apply this diff:

-      - name: 'description'
-        content: We may use Apitally to capture API metrics and logs.
+      - name: 'description'
+        content: Capture API metrics, errors, performance, and logs with Apitally for Elysia.

-      - name: 'og:description'
-        content: We may use Apitally to capture API metrics and logs.
+      - name: 'og:description'
+        content: Capture API metrics, errors, performance, and logs with Apitally for Elysia.

44-47: Avoid hard-coding secrets; prefer env var in example.

Use env in the snippet to model best practices and avoid copy-pasting secrets into code.

Apply this diff:

-    apitallyPlugin({
-      clientId: "your-client-id",
-      env: "dev", // or "prod" etc.
-    }),
+    apitallyPlugin({
+      clientId: Bun.env.APITALLY_CLIENT_ID ?? "your-client-id",
+      env: "dev", // or "prod" etc.
+    }),

Note: If not running on Bun, swap Bun.env for process.env.


56-56: Grammar: add “to” and parallelize phrasing.

Small grammar tweak for clarity.

-You can associate requests with consumer identifiers, allowing you get insights into API adoption and filter logs and metrics by consumer.
+You can associate requests with consumer identifiers, allowing you to get insights into API adoption and to filter logs and metrics by consumer.

71-73: Grammar: singular “application”, gerund, and “what is”.

Minor fixes for readability.

-Capturing request and applications logs is disabled by default. You can enable it by passing the `requestLogging` option to the plugin and
-configure in detail what's included in the logs.
+Capturing request and application logs is disabled by default. You can enable it by passing the `requestLogging` option to the plugin and
+configuring in detail what is included in the logs.

69-93: Add a privacy/PII warning near logging example.

Enabling header/body logging can capture secrets and personal data. Add an admonition to set safe defaults and use redaction where possible.

Apply this diff (placed after the code block):

   .get("/", () => "hello");

+::: warning
+Logging request/response headers or bodies may include secrets or personal data. Enable only what you need, consider redaction facilities, and disable logging for sensitive routes.
+:::


</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

**💡 Knowledge Base configuration:**

- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 9448f7d3f22a370e7ca1796648cc1da0157b9a51 and becd33ed1c65ea9e22b76758592e8de81058ab17.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `docs/.vitepress/config.ts` (1 hunks)
* `docs/integrations/apitally.md` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>docs/integrations/apitally.md</summary>

[grammar] ~21-~21: There might be a mistake here.
Context: ...s API request logs and application logs, which are automatically correlated.  ![A...

(QB_NEW_EN)

---

[grammar] ~71-~71: There might be a mistake here.
Context: ...requestLogging` option to the plugin and configure in detail what's included in t...

(QB_NEW_EN)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (2)</summary><blockquote>

<details>
<summary>docs/integrations/apitally.md (1)</summary>

`24-24`: **Asset Path Verified – No Changes Needed**

The image at `/recipe/apitally/traffic-dashboard.webp` correctly resolves to `docs/public/recipe/apitally/traffic-dashboard.webp`, which exists in the repo. No updates to the markdown or asset location are required.

</details>
<details>
<summary>docs/.vitepress/config.ts (1)</summary>

`440-443`: **Sidebar entry looks good; path matches page slug and keeps alphabetical order.**

Adds Apitally under Integrations with correct link and placement.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

@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

♻️ Duplicate comments (2)
docs/integrations/apitally.md (2)

75-93: Align logging example with SDK shape; remove undocumented key and use direct invocation

  • Switch to the direct useApitally call (consistency with the basic example).
  • Verify whether captureLogs is a supported key; if not, remove it to prevent confusion.
  • Optionally surface additional documented keys (e.g., logQueryParams, logResponseHeaders, logException, mask* options).
 import { Elysia } from "elysia";
-import { apitallyPlugin } from "apitally/elysia";
+import { useApitally } from "apitally/elysia";

-const app = new Elysia()
-  .use(
-    apitallyPlugin({
-      clientId: "your-client-id",
-      env: "dev", // or "prod" etc.
-      requestLogging: { // [!code ++]
-        enabled: true,  // [!code ++]
-        logRequestHeaders: true, // [!code ++]
-        logRequestBody: true, // [!code ++]
-        logResponseBody: true, // [!code ++]
-        captureLogs: true, // application logs // [!code ++]
-      }, // [!code ++]
-    }),
-  )
-  .get("/", () => "hello");
+const app = new Elysia();
+useApitally(app, {
+  clientId: "your-client-id",
+  env: "dev", // or "prod" etc.
+  requestLogging: {
+    enabled: true,
+    logRequestHeaders: true,
+    logRequestBody: true,
+    logResponseBody: true,
+    // consider also: logQueryParams, logResponseHeaders, logException
+    // and safety knobs: maskQueryParams, maskHeaders, maskBodyFields, excludePaths
+  },
+});
+app.get("/", () => "hello");

If you want, I can add a short example showing masking of common secrets (e.g., Authorization headers, tokens in bodies).


39-50: Update import and invocation to match Apitally’s Elysia integration API

Use the official import and direct invocation style to avoid drift and make the example copy-pasteable.

 import { Elysia } from "elysia";
-import { apitallyPlugin } from "apitally/elysia";
+import { useApitally } from "apitally/elysia";

-const app = new Elysia()
-  .use(
-    apitallyPlugin({
-      clientId: "your-client-id",
-      env: "dev", // or "prod" etc.
-    }),
-  )
-  .get("/", () => "hello");
+const app = new Elysia();
+useApitally(app, {
+  clientId: "your-client-id",
+  env: "dev", // or "prod" etc.
+  // optional: requestLogging, appVersion, logger, ...
+});
+app.get("/", () => "hello");

To confirm the exact import and option names for the current SDK version, please validate against Apitally’s docs.

🧹 Nitpick comments (4)
docs/integrations/apitally.md (4)

10-15: Tighten meta descriptions to active voice

Use concise, action-oriented phrasing consistent with the rest of the docs.

-        content: We may use Apitally to capture API metrics and logs.
+        content: Use Apitally to capture API metrics and logs.
@@
-        content: We may use Apitally to capture API metrics and logs.
+        content: Use Apitally to capture API metrics and logs.

21-23: Streamline the sentence and avoid repetition

Minor style/grammar polish; also addresses the static analysis hint.

-It provides real-time insights into API usage, errors, and performance. It also captures API request logs and application logs,
-which are automatically correlated.
+It provides real-time insights into API usage, errors, and performance. It also captures request and application logs and automatically correlates them.

32-34: Consider including npm/pnpm/yarn equivalents

Many readers don’t use Bun. Suggest adding alternative install commands (npm, pnpm, yarn) below the Bun snippet.


71-73: Fix parallelism in the sentence and add a short safety note about PII

Minor grammar and a one-liner to nudge users toward masking sensitive data. Also addresses static analysis hint.

-Capturing request and application logs is disabled by default. You can enable it by passing the `requestLogging` option to the plugin and
-configure in detail what's included in the logs.
+Capturing request and application logs is disabled by default. You can enable it by passing the `requestLogging` option to the plugin and
+configuring in detail what is included in the logs. Be mindful of sensitive data; use mask* options and excludePaths to avoid persisting secrets and PII.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between becd33e and 823beae.

📒 Files selected for processing (1)
  • docs/integrations/apitally.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/integrations/apitally.md

[grammar] ~21-~21: There might be a mistake here.
Context: ...s API request logs and application logs, which are automatically correlated. ![A...

(QB_NEW_EN)


[grammar] ~71-~71: There might be a mistake here.
Context: ...requestLogging` option to the plugin and configure in detail what's included in t...

(QB_NEW_EN)

🔇 Additional comments (3)
docs/integrations/apitally.md (3)

24-24: Verify asset path is valid

Check that /recipe/apitally/traffic-dashboard.webp exists in the repo and is included in this PR (or available in the static assets directory). Broken images hurt discoverability.


52-52: Confirm the Elysia setup guide URL

Ensure https://docs.apitally.io/frameworks/elysia is live; if not, link to the closest framework-agnostic JS SDK or Elysia-specific page.


59-66: Validate context decoration and consumer fields

Confirm that the plugin decorates the Elysia context as apitally and that accepted consumer fields are exactly identifier, name, and group. If the key or shape differs, update the example accordingly.

@itssimon itssimon changed the title Add Apitally to integrations docs: add Apitally to integrations Aug 22, 2025
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.

1 participant