logging-tracing-capture

logging-tracing-capture is a cursor rule for Cursor from GoranErhartic/cursor-development-rules. It costs 23 tokens per session (1,708 once invoked), scanned A, original, MIT.

Rules and examples for capturing traces from AWS Lambda applications with AWS X-Ray, a service that shows how requests travel through connected services. They cover AWS SDK calls, HTTP requests, and trace details.

In plain words
What is it for?
Use them to trace DynamoDB and other AWS SDK calls, record external API requests, configure X-Ray in AWS CDK deployments, and inspect service maps.
Why use it?
They help developers follow a request across services and distinguish searchable annotations from extra diagnostic metadata.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use them to trace DynamoDB and other AWS SDK calls, record external API requests, configure X-Ray in AWS CDK deployments, and inspect service maps.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/goranerhartic/cursor-development-rules/logging-tracing-capture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/GoranErhartic/cursor-development-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for logging-tracing-capture

README.md
[![agentmods](https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/logging-tracing-capture/github.svg)](https://agentmods.dev/rules/goranerhartic/cursor-development-rules/logging-tracing-capture)
Your own site
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/logging-tracing-capture"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/logging-tracing-capture/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for logging-tracing-capture

Your own site · 80×15
<a href="https://agentmods.dev/rules/goranerhartic/cursor-development-rules/logging-tracing-capture"><img src="https://agentmods.dev/badge/rules/goranerhartic/cursor-development-rules/logging-tracing-capture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,708 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.01708
Opus 5.5 $0.00009 $0.00683
Sonnet 5.5 $0.00005 $0.00342
Haiku 4.5 $0.00002 $0.00171

Measured 3mo ago against content hash 60cc776b7c6b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

logging-tracing-capture scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(options.url, {
.cursor/rules/languages/aws-lambda/logging-tracing-capture.mdc · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Lambda X-Ray Capture & CDK

Tracing AWS SDK Clients

// src/shared/clients/dynamodb.ts

import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { tracer } from "@/shared/tracer";

let docClient: DynamoDBDocumentClient | undefined;

export function getDynamoDBClient(): DynamoDBDocumentClient {
  if (!docClient) {
    const client = new DynamoDBClient({});
    
    // Capture AWS SDK calls in X-Ray
    tracer.captureAWSv3Client(client);
    
    docClient = DynamoDBDocumentClient.from(client);
  }

  return docClient;
}

Tracing HTTP Clients (External APIs)

// src/shared/clients/http-client.ts

import { tracer } from "@/shared/tracer";
import { getRequestContext } from "@/shared/observability/request-context";
import { logger } from "@/shared/logger";

interface HttpRequestOptions {
  method: "GET" | "POST" | "PUT" | "DELETE";
  url: string;
  headers?: Record<string, string>;
  body?: unknown;
  timeout?: number;
}

export async function tracedFetch<T>(options: HttpRequestOptions): Promise<T> {
  const context = getRequestContext();
  const segment = tracer.getSegment();
  const subsegment = segment?.addNewSubsegment(`HTTP ${options.method} ${new URL(options.url).hostname}`);

  const startTime = Date.now();

  try {
    // Add trace context to outgoing request
    const headers: Record<string, string> = {
      ...options.headers,
      "X-Correlation-Id": context?.correlationId ?? "",
    };

    // Propagate X-Ray trace header for downstream tracing
    if (process.env._X_AMZN_TRACE_ID) {
      headers["X-Amzn-Trace-Id"] = process.env._X_AMZN_TRACE_ID;
    }

    subsegment?.addAnnotation("correlationId", context?.correlationId ?? "unknown");
    subsegment?.addAnnotation("url", options.url);
    subsegment?.addAnnotation("method", options.method);
    subsegment?.addMetadata("requestHeaders", headers);

    const response = await fetch(options.url, {
      method: options.method,
      headers,
      body: options.body ? JSON.stringify(options.body) : undefined,
      signal: options.timeout ? AbortSignal.timeout(options.timeout) : undefined,
    });

    const duration = Date.now() - startTime;

    subsegment?.addAnnotation("statusCode", response.status);
    subsegment?.addMetadata("responseHeaders", Object.fromEntries(response.headers));

    logger.info({
      correlationId: context?.correlationId,
      url: options.url,
      method: options.method,
      statusCode: response.status,
      durationMs: duration,
    }, "External HTTP request completed");

    if (!response.ok) {
      const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
      subsegment?.addError(error);
      throw error;
    }

    return response.json() as Promise<T>;
  } catch (error) {
    subsegment?.addError(error as Error);
    logger.error({
      correlationId: context?.correlationId,
      url: options.url,
      err: error,
    }, "External HTTP request failed");
    throw error;
  } finally {
    subsegment?.close();
  }
}

Read the full file on GitHub · 249 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 249 lines · 23 tokens per session scan A 60cc776b7c6b

Subscribe to this mod's changes

logging-tracing-capture is a cursor rule published in the GitHub repository GoranErhartic/cursor-development-rules (20 stars, last pushed 9mo ago), licensed MIT. It adds 23 tokens to every session and 1,708 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

logging-tracing-capture compared with cursor rules from other repositories

logging-tracing-capture next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
logging-tracing-captureGoranErhartic/cursor-development-rulesCursor rule209mo agoMITA23Cursor
aws-ecssanjeed5/awesome-cursor-rules-mdcCursor rule3.6k8d agoCC0-1.0A2,640Cursor
log-watchbriiirussell/cybersecurity-skillsCursor rule542yesterdayMITA184Cursor
beanstalk-deploypr-pm/prpmCursor rule1251mo agoMITA0Cursor
deploymentlacymorrow/paperclip-hubCursor rule162d agoMITA0Cursor
advisor-routingmicrosoft/azure-skillsCursor rule1.7ktodayMITA37Cursor
aws-rds-best-practicesbeettlle/CursorRulesCursor rule215d agononeA0Cursor