Skip to main content

Overview

HAI Build Code Generator supports multiple telemetry backends to help you monitor AI-powered development workflows, track performance, and analyze usage patterns.
All telemetry configuration can be overridden per workspace using the .hai.config file.

Telemetry Providers

Langfuse

LLM observability and tracing

PostHog

Product analytics and error tracking

OpenTelemetry

Flexible telemetry with OTLP export

Langfuse Configuration

Langfuse provides LLM-specific observability including prompt tracking, token usage, and cost analysis.

Setup

1

Get API Keys

Obtain your Langfuse API keys from cloud.langfuse.com
2

Configure Environment

Add to your .env file or .hai.config:
3

Verify Configuration

Restart VS Code and check the HAI Build logs for Langfuse connection status

Workspace Override

Override Langfuse configuration per workspace using .hai.config:
string
default:"https://cloud.langfuse.com"
Langfuse API endpoint (optional)
string
Langfuse secret key (corresponds to LANGFUSE_SECRET_KEY)
string
Langfuse public key (corresponds to LANGFUSE_PUBLIC_KEY)

What Gets Tracked

Langfuse captures:
  • LLM requests and responses
  • Token usage and costs
  • Prompt versions and variations
  • Model performance metrics
  • User feedback and ratings

PostHog Configuration

PostHog provides product analytics and error tracking.

Setup

1

Get API Keys

Create a PostHog account at app.posthog.com and obtain:
  • Telemetry API key (for events)
  • Error tracking API key (for errors)
2

Configure Environment

Add to your .env file:
3

Workspace Override (Optional)

Override per workspace in .hai.config:
string
default:"https://app.posthog.com"
PostHog API endpoint
string
PostHog API key for telemetry and error tracking

What Gets Tracked

PostHog captures:
  • Feature usage events
  • User interactions
  • Error occurrences and stack traces
  • Session recordings (if enabled)
  • Performance metrics
Ensure you have appropriate user consent before enabling telemetry in production environments.

OpenTelemetry Configuration

OpenTelemetry provides flexible, vendor-neutral telemetry collection with support for logs, metrics, and traces.

Overview

OpenTelemetry in HAI Build focuses on:
  • Logs (Events): Primary signal for telemetry (recommended)
  • Metrics: Optional performance counters
  • Exporters: Console (debugging) or OTLP (production)

Basic Setup

1

Enable OpenTelemetry

Set the enable flag:
2

Configure Exporters

Choose your export targets:
3

Set Protocol and Endpoint

For OTLP export:

Exporter Options

Console Exporter

For local debugging, output telemetry to console:
Console exporter is perfect for development and troubleshooting telemetry pipelines.

Configuration Parameters

boolean
default:"false"
Enable OpenTelemetry telemetry collection
string
default:"console"
Logs exporter: console or otlp
string
default:"otlp"
Metrics exporter: console, otlp, or prometheus
string
default:"grpc"
OTLP protocol: grpc, http/json, or http/protobuf
string
OTLP collector endpoint (without /v1/logs or /v1/metrics path)
string
Custom headers for OTLP requests (e.g., authorization=Bearer token)
boolean
default:"false"
Use insecure gRPC connections (local testing only)
number
default:"60000"
Metric export interval in milliseconds
boolean
default:"false"
Enable detailed export diagnostics for debugging

Batch Configuration

Optimize log batching for performance:
number
default:"512"
Maximum number of logs per batch
number
default:"5000"
Maximum wait time in milliseconds before exporting batch
number
default:"2048"
Maximum size of the log queue

Advanced: Separate Endpoints

Configure different endpoints for metrics and logs:

Configuration Examples

Perfect for local development and troubleshooting:
High-performance production setup:
RESTful production setup with JSON:
For local OTLP collector testing:

Workspace-Level Configuration

The .hai.config file enables workspace-specific telemetry settings that override global environment variables.

Configuration File Location

Place .hai.config at the root of your workspace:

Supported Parameters

The .hai.config file is not automatically git-ignored. Add it to .gitignore if it contains sensitive credentials, or use CI/CD to inject values dynamically.

Dynamic Configuration via CI/CD

You can generate .hai.config dynamically in your CI/CD pipeline:

COR-Matrix Integration

HAI Build supports COR-Matrix for tracking AI code retention patterns and analyzing code origin.
string
COR-Matrix API endpoint
string
Authentication token for COR-Matrix
string
Workspace identifier in COR-Matrix

Configuration Example

Best Practices

Use Workspace Configs

Keep telemetry settings per workspace in .hai.config for team consistency

Secure Credentials

Never commit API keys to git. Use CI/CD injection or environment variables

Monitor Costs

Track Langfuse usage to optimize LLM costs and token consumption

Debug Locally

Use console exporters and diagnostics during development

Troubleshooting

Check:
  • Verify OTEL_TELEMETRY_ENABLED=1 is set
  • Check API keys are correctly configured
  • Enable TEL_DEBUG_DIAGNOSTICS=true for detailed logs
  • Restart VS Code after configuration changes
Solutions:
  • For gRPC: Use hostname:port (no http://)
  • For HTTP: Include full URL (http:// or https://)
  • Verify firewall/network allows connections
  • Check OTLP collector is running and accessible
Check:
  • Verify API keys are correct (secret + public)
  • Ensure LANGFUSE_BASE_URL is correct
  • Check Langfuse dashboard for project setup
  • Review HAI Build logs for connection errors
Solutions:
  • Ensure .hai.config is at workspace root
  • Check file format (key-value pairs, dot notation)
  • Verify no syntax errors (proper = usage)
  • Restart VS Code to reload configuration

Next Steps

Settings

Configure extension settings

LLM Providers

Set up AI model providers