Skip to content
Last9
Book demo

Cline

Send Cline (VSCode/Cursor AI coding extension) telemetry — task turns, tokens, cost, tool calls, hooks, and AI output stats — to Last9 via OpenTelemetry.

Cline is an AI coding extension for VSCode and Cursor. It emits structured OpenTelemetry data for every developer task: turns, tokens, cost, cache hits, tool calls, hooks, and a detailed breakdown of code Cline generated versus what the developer accepted or rejected. Routing this to Last9 lets you measure adoption, cost per developer, prompt cache efficiency, and tool reliability — within your existing observability stack.

Cline exports two OpenTelemetry signal types:

  • Logs — structured events for prompts, tool invocations, errors, and hook executions
  • Metrics — counters and histograms across task, cache, tools, errors, API latency, hooks, AI output, and workspace

What gets exported

Logs (events)

Each Cline session emits structured log records. Filter by service.name = cline (or whatever you set via OTEL_SERVICE_NAME).

Metrics

Cline exports 30+ metric instruments grouped by domain.

MetricUnitDescription
cline.turns.totalcountTotal turns across all tasks
cline.turns.per_taskhistogramTurns per task
cline.tokens.input.totaltokensTotal input tokens
cline.tokens.output.totaltokensTotal output tokens
cline.tokens.input.per_responsehistogramInput tokens per model response
cline.tokens.output.per_responsehistogramOutput tokens per model response
cline.cost.totalUSDCumulative cost across sessions
cline.cost.per_eventhistogramCost per model call
cline.cache.write.tokens.totaltokensCache write tokens
cline.cache.read.tokens.totaltokensCache read tokens
cline.cache.hits.totalcountCache hits
cline.tool.calls.totalcountTotal tool invocations
cline.tool.calls.per_taskhistogramTool calls per task
cline.errors.totalcountTotal errors
cline.errors.per_taskhistogramErrors per task
cline.api.ttft.secondshistogramModel time-to-first-token
cline.api.duration.secondshistogramFull model response duration
cline.api.throughput.tokens_per_secondhistogramOutput token throughput
cline.hooks.executions.totalcountHook invocations
cline.hooks.duration.secondshistogramHook execution duration
cline.hooks.failures.totalcountHook failures
cline.hooks.cancellations.totalcountHook cancellations
cline.hooks.context_modifications.totalcountHooks that modified context
cline.hooks.cache.accesses.totalcountHook cache accesses
cline.ai_output.accepted.lines_addedcountLines added in accepted edits
cline.ai_output.accepted.lines_deletedcountLines deleted in accepted edits
cline.ai_output.accepted.lines_changedcountLines changed in accepted edits
cline.ai_output.accepted.files_createdcountFiles created in accepted edits
cline.ai_output.accepted.files_deletedcountFiles deleted in accepted edits
cline.ai_output.accepted.files_movedcountFiles moved in accepted edits
cline.ai_output.rejected.*countSame set, for rejected edits
cline.workspace.active_rootsgaugeNumber of active workspace roots
cline.grpc.response.size_byteshistogramCline gRPC response size

Prerequisites

  1. Last9 account — Sign up at app.last9.io
  2. Cline extension — Installed in VSCode (saoudrizwan.claude-dev) or Cursor
  3. OTLP credentials — Get your endpoint and auth header from Integrations → OpenTelemetry

Setup

Cline is configured via environment variables prefixed with CLINE_OTEL_. The variables must be set in the shell that launches your editor — GUI launches via Spotlight, Dock, or Finder will not pick them up.

  1. Get your Last9 OTLP credentials

    Navigate to Integrations → OpenTelemetry in your Last9 dashboard. Copy:

    • OTLP Endpoint (e.g., https://otlp.last9.io or https://otlp-aps1.last9.io:443)
    • Authorization header value (e.g., Basic <base64-token>)
  2. Add environment variables to your shell profile

    Add the following to ~/.zshrc, ~/.bashrc, or equivalent:

    export CLINE_OTEL_TELEMETRY_ENABLED=true
    export CLINE_OTEL_METRICS_EXPORTER=otlp
    export CLINE_OTEL_LOGS_EXPORTER=otlp
    export CLINE_OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
    export CLINE_OTEL_EXPORTER_OTLP_ENDPOINT="https://<your-last9-otlp-endpoint>"
    export CLINE_OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic <your-last9-auth-token>"
  3. Reload the shell and launch your editor from the same terminal

    source ~/.zshrc
    cursor . # or `code .` for VSCode

    Cline picks up the configuration on extension activation.

  4. Run a Cline task

    Open the Cline panel and submit any task (e.g. “summarize what this repo does”).

    • Logs flush every 5 seconds
    • Metrics flush every 60 seconds by default
  5. Verify data is arriving

    • Metrics — open Metrics in Last9, search for cline_turns_total or cline_tokens_input_total
    • Logs — open Logs, filter by service.name = cline

Configuration reference

Core

VariableDefaultDescription
CLINE_OTEL_TELEMETRY_ENABLEDfalseSet to true to enable export. Overrides user telemetry preferences
CLINE_OTEL_METRICS_EXPORTERunsetotlp, console, or comma-separated list
CLINE_OTEL_LOGS_EXPORTERunsetSame as above

OTLP

VariableDescription
CLINE_OTEL_EXPORTER_OTLP_PROTOCOLgrpc, http/json, or http/protobuf
CLINE_OTEL_EXPORTER_OTLP_ENDPOINTCollector URL — applies to both metrics and logs
CLINE_OTEL_EXPORTER_OTLP_HEADERSkey=value comma-separated auth headers
CLINE_OTEL_EXPORTER_OTLP_INSECUREtrue to disable TLS for gRPC (local development only)

Per-signal endpoint override

VariableDescription
CLINE_OTEL_EXPORTER_OTLP_METRICS_ENDPOINTMetrics-only endpoint
CLINE_OTEL_EXPORTER_OTLP_METRICS_PROTOCOLMetrics-only protocol
CLINE_OTEL_EXPORTER_OTLP_LOGS_ENDPOINTLogs-only endpoint
CLINE_OTEL_EXPORTER_OTLP_LOGS_PROTOCOLLogs-only protocol

Tuning

VariableDefaultDescription
CLINE_OTEL_METRIC_EXPORT_INTERVAL60000Metric flush interval (ms)
CLINE_OTEL_LOG_BATCH_SIZE512Max log records per batch
CLINE_OTEL_LOG_BATCH_TIMEOUT5000Max wait before log flush (ms)
CLINE_OTEL_LOG_MAX_QUEUE_SIZE2048Max queued log records

What you can do in Last9

Cost and adoption tracking (metrics)

cline.cost.total is a counter you can break down by model and user.email (when set via resource attributes). In Last9 Metrics, plot rate(cline_cost_total[5m]) for spend per minute, or sum over a window for daily totals.

Cache efficiency (metrics)

Compare cline.cache.read.tokens.total against cline.tokens.input.total to measure prompt cache hit ratio. A high ratio means lower per-interaction cost.

Developer outcome (metrics)

cline.ai_output.accepted.* versus cline.ai_output.rejected.* tracks code Cline generated against what developers actually kept. Useful for measuring AI suggestion quality and adoption depth:

sum(rate(cline_ai_output_accepted_lines_added_total[1h]))
/
sum(rate(cline_ai_output_accepted_lines_added_total[1h]) + rate(cline_ai_output_rejected_lines_added_total[1h]))

Model latency (metrics)

cline.api.ttft.seconds and cline.api.duration.seconds show p95/p99 model performance over time. Plot per model to compare providers.

Tool reliability (metrics)

cline.tool.calls.total and cline.errors.total together highlight which tools fail most. Combine with cline.errors.per_task to spot tasks with elevated error rates.

Hook health (metrics)

cline.hooks.failures.total and cline.hooks.cancellations.total flag hooks that fail or block in flight. Pair with cline.hooks.duration.seconds to find slow hooks.

Team-level tagging

Tag sessions by team via standard OTel resource attributes:

export OTEL_RESOURCE_ATTRIBUTES="deployment.environment=production,team=platform"

All metrics and logs from that session carry team and deployment.environment labels, enabling per-team breakdowns in Last9.

Debugging

Enable detailed Cline OTel diagnostic logging:

export TEL_DEBUG_DIAGNOSTICS=true

Diagnostic output appears in Help → Toggle Developer Tools → Console inside VSCode/Cursor. Includes the resolved configuration, exporters created, connection attempts, and per-export success/failure.


Troubleshooting

  • No data in Last9 after running a Cline task

    • Confirm your editor was launched from a terminal that has the CLINE_OTEL_* vars set. GUI launches do not inherit shell env. Run cursor . or code . from a terminal where echo $CLINE_OTEL_TELEMETRY_ENABLED returns true.
    • Check that CLINE_OTEL_TELEMETRY_ENABLED=true (not True, not 1)
    • Wait at least 90 seconds — metrics flush every 60 seconds and may need one cycle to land
  • 401 / authentication errors

    • Cline uses comma-separated key=value syntax in CLINE_OTEL_EXPORTER_OTLP_HEADERS, not HTTP header colon syntax. The full string should be Authorization=Basic <token> (with =, not : )
    • Verify the token has not expired in Integrations → OpenTelemetry
  • Logs flow but metrics are missing

    • Cline metrics export every 60 seconds — wait at least 90 seconds. Metric names in Last9 use underscores: cline.cost.total becomes cline_cost_total
  • Per-signal endpoint customization needed

    • Use CLINE_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT and CLINE_OTEL_EXPORTER_OTLP_LOGS_ENDPOINT to point each signal at a different collector

Please get in touch with us on Discord or Email if you have any questions.