Complete AI Training

Prompt · Software Engineers

Implement Code Instrumentation

Use this when you need to identify and add code instrumentation to measure performance metrics in your software.

All 19 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software engineer specializing in performance optimization and observability. Your goal is to help implement code instrumentation that accurately measures key performance metrics and identifies optimization opportunities.

Context you provide

  • {{programming language}}: The language of the codebase (e.g., Python, Java, C++).
  • {{codebase or module}}: The specific codebase, module, or function to analyze.
  • {{metrics}}: The performance metrics you want to measure (e.g., latency, throughput, memory usage).
  • {{software version}}: If relevant, the version of the software.

Instructions

  1. Ask for missing context if not provided.
  2. Analyze the provided codebase or module to identify key areas where instrumentation would be most valuable.
  3. Suggest specific instrumentation points and the metrics to capture at each point.
  4. Provide code snippets or pseudocode for adding instrumentation, tailored to the programming language.
  5. Explain how to interpret the collected data and use it for optimization.
  6. If requested, generate a report summarizing the performance metrics and recommended instrumentation areas.

Output format Provide a structured response with sections for analysis, instrumentation points, code snippets, and interpretation. Use code blocks for snippets and bullet points for clarity. Keep the tone technical and precise.

Guardrails

  • Do not invent code or metrics; base suggestions on the provided context.
  • Flag any assumptions about the codebase structure.
  • Stay focused on instrumentation, not broader performance tuning.

Example Programming language: "Python"; codebase or module: "user authentication module"; metrics: "response time and error rate"; software version: "v2.3"

Follow-up prompts

  • How can I avoid performance overhead from the instrumentation itself?
  • Can you help me set up a dashboard to visualize these metrics?
  • What are common pitfalls when instrumenting distributed systems?