<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Uzair</title>
    <description>The latest articles on DEV Community by Uzair (@uzair_43482468fbde1f12452).</description>
    <link>https://dev.to/uzair_43482468fbde1f12452</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4030519%2Fbebd0707-77fa-4eed-b3f5-14b82f3457a2.png</url>
      <title>DEV Community: Uzair</title>
      <link>https://dev.to/uzair_43482468fbde1f12452</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/uzair_43482468fbde1f12452"/>
    <language>en</language>
    <item>
      <title>Building an Automated Infrastructure Health &amp; Monitoring Bot with OpenTelemetry and SigNoz</title>
      <dc:creator>Uzair</dc:creator>
      <pubDate>Sun, 26 Jul 2026 09:59:30 +0000</pubDate>
      <link>https://dev.to/uzair_43482468fbde1f12452/building-an-automated-infrastructure-health-monitoring-bot-with-opentelemetry-and-signoz-1min</link>
      <guid>https://dev.to/uzair_43482468fbde1f12452/building-an-automated-infrastructure-health-monitoring-bot-with-opentelemetry-and-signoz-1min</guid>
      <description>&lt;h1&gt;
  
  
  Signoz track 3 submission: Build your own. Automated Infrastructure Health &amp;amp; Monitoring Bot 🤖
&lt;/h1&gt;

&lt;p&gt;In production SRE workflows, static metric alerts often leave engineering teams scrambling to correlate spikes with root causes. Knowing that CPU hit 95% is only half the battle—you need distributed tracing to understand &lt;em&gt;what&lt;/em&gt; process cycle triggered the spike and &lt;em&gt;how&lt;/em&gt; the system responded in real time.&lt;/p&gt;

&lt;p&gt;In this post, we’ll break down the &lt;strong&gt;Automated Infrastructure Health &amp;amp; Monitoring Bot&lt;/strong&gt;, a lightweight, OpenTelemetry-native SRE monitoring agent built for &lt;strong&gt;Track 3: Build Your Own&lt;/strong&gt; of the SigNoz Hackathon.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌐 Live Demo &amp;amp; Repository
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/era651868-ctrl/Signoz.git" rel="noopener noreferrer"&gt;https://github.com/era651868-ctrl/Signoz.git&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Deployment link:&lt;/strong&gt; &lt;a href="https://signoz-57js.onrender.com/" rel="noopener noreferrer"&gt;https://signoz-57js.onrender.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;YouTube Demo:&lt;/strong&gt; &lt;a href="https://youtube.com/shorts/3iGRSQba2n8?si=1b0R1ZkqF9YjO6Dc" rel="noopener noreferrer"&gt;https://youtube.com/shorts/3iGRSQba2n8?si=1b0R1ZkqF9YjO6Dc&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Local / Deployed Dashboard Endpoints:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Health Endpoint: &lt;code&gt;/health&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Live Metrics Stream: &lt;code&gt;/metrics&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Incident Log Feed: &lt;code&gt;/incidents&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6i7vpodjief5t89w6euq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6i7vpodjief5t89w6euq.png" alt=" " width="800" height="1778"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🏗️ System Architecture &amp;amp; Workflow
&lt;/h2&gt;

&lt;p&gt;The bot is designed to simulate a real-world SRE monitoring agent operating in constrained environments. It continuously samples system telemetry, evaluates rule-based alert conditions, and streams OTLP traces directly to SigNoz.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;+-------------------------------------------------------------------+
|               Infrastructure Health Agent &lt;span class="o"&gt;(&lt;/span&gt;app.py&lt;span class="o"&gt;)&lt;/span&gt;                |
|                                                                   |
|   +------------------+     +-------------------+                  |
|   | System Collector | &lt;span class="nt"&gt;--&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; | Anomaly Detection |                  |
|   | &lt;span class="o"&gt;(&lt;/span&gt;CPU/Mem/Disk&lt;span class="o"&gt;)&lt;/span&gt;   |     | &lt;span class="o"&gt;(&lt;/span&gt;Threshold Engine&lt;span class="o"&gt;)&lt;/span&gt;|                  |
|   +------------------+     +-------------------+                  |
|                                     |                             |
|                                     v                             |
|                           +-------------------+                   |
|                           |  OTLP Trace Engine|                   |
|                           +-------------------+                   |
+-------------------------------------|-----------------------------+
                                      | OTLP gRPC &lt;span class="o"&gt;(&lt;/span&gt;Port 4317&lt;span class="o"&gt;)&lt;/span&gt;
                                      v
                        +---------------------------+
                        |  SigNoz OTEL Collector    |
                        |  &amp;amp; Telemetry Store        |
                        +---------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💻 Core Implementation Deep Dive
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Resilient OpenTelemetry Setup with Graceful Fallback (&lt;code&gt;app.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;To ensure the monitoring agent never crashes when network connectivity drops or during collector maintenance, the setup dynamically tests OTLP gRPC endpoint reachability before registering exporters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;import os
import socket
from urllib.parse import urlparse
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter

SERVICE_NAME &lt;span class="o"&gt;=&lt;/span&gt; os.getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"SERVICE_NAME"&lt;/span&gt;, &lt;span class="s2"&gt;"health-alert-bot"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
OTLP_ENDPOINT &lt;span class="o"&gt;=&lt;/span&gt; os.getenv&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"OTLP_ENDPOINT"&lt;/span&gt;, &lt;span class="s2"&gt;"http://localhost:4317"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

def is_otlp_endpoint_reachable&lt;span class="o"&gt;(&lt;/span&gt;endpoint: str&lt;span class="o"&gt;)&lt;/span&gt; -&amp;gt; bool:
    parsed &lt;span class="o"&gt;=&lt;/span&gt; urlparse&lt;span class="o"&gt;(&lt;/span&gt;endpoint&lt;span class="o"&gt;)&lt;/span&gt;
    host &lt;span class="o"&gt;=&lt;/span&gt; parsed.hostname or &lt;span class="s2"&gt;"localhost"&lt;/span&gt;
    port &lt;span class="o"&gt;=&lt;/span&gt; parsed.port or 4317
    try:
        with socket.create_connection&lt;span class="o"&gt;((&lt;/span&gt;host, port&lt;span class="o"&gt;)&lt;/span&gt;, &lt;span class="nb"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;:
            &lt;span class="k"&gt;return &lt;/span&gt;True
    except OSError:
        &lt;span class="k"&gt;return &lt;/span&gt;False

def setup_tracing&lt;span class="o"&gt;()&lt;/span&gt;:
    resource &lt;span class="o"&gt;=&lt;/span&gt; Resource.create&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;attributes&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="s2"&gt;"service.name"&lt;/span&gt;: SERVICE_NAME&lt;span class="o"&gt;})&lt;/span&gt;
    provider &lt;span class="o"&gt;=&lt;/span&gt; TracerProvider&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;resource&lt;span class="o"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if &lt;/span&gt;is_otlp_endpoint_reachable&lt;span class="o"&gt;(&lt;/span&gt;OTLP_ENDPOINT&lt;span class="o"&gt;)&lt;/span&gt;:
        exporter &lt;span class="o"&gt;=&lt;/span&gt; OTLPSpanExporter&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;endpoint&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;OTLP_ENDPOINT, &lt;span class="nv"&gt;insecure&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True&lt;span class="o"&gt;)&lt;/span&gt;
        provider.add_span_processor&lt;span class="o"&gt;(&lt;/span&gt;BatchSpanProcessor&lt;span class="o"&gt;(&lt;/span&gt;exporter&lt;span class="o"&gt;))&lt;/span&gt;
        print&lt;span class="o"&gt;(&lt;/span&gt;f&lt;span class="s2"&gt;"📡 Tracing enabled. Sending OTLP spans to {OTLP_ENDPOINT}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;:
        provider.add_span_processor&lt;span class="o"&gt;(&lt;/span&gt;BatchSpanProcessor&lt;span class="o"&gt;(&lt;/span&gt;ConsoleSpanExporter&lt;span class="o"&gt;()))&lt;/span&gt;
        print&lt;span class="o"&gt;(&lt;/span&gt;f&lt;span class="s2"&gt;"⚠️ OTLP endpoint unreachable. Falling back to console spans."&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

    trace.set_tracer_provider&lt;span class="o"&gt;(&lt;/span&gt;provider&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;trace.get_tracer&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"bot-tracer"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

tracer &lt;span class="o"&gt;=&lt;/span&gt; setup_tracing&lt;span class="o"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Anomaly Evaluation &amp;amp; Span Attribute Injection
&lt;/h3&gt;

&lt;p&gt;Every monitoring cycle evaluates resource thresholds and attaches rich contextual metadata directly onto OpenTelemetry spans. Critical breaches trigger nested alert child spans.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;def main&lt;span class="o"&gt;()&lt;/span&gt;:
    threading.Thread&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;start_http_server, &lt;span class="nv"&gt;daemon&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;True&lt;span class="o"&gt;)&lt;/span&gt;.start&lt;span class="o"&gt;()&lt;/span&gt;
    print&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"🚀 Health Alert Bot started running..."&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;while &lt;/span&gt;True:
        metrics &lt;span class="o"&gt;=&lt;/span&gt; collect_metrics&lt;span class="o"&gt;()&lt;/span&gt;
        severity, reasons &lt;span class="o"&gt;=&lt;/span&gt; evaluate_health&lt;span class="o"&gt;(&lt;/span&gt;metrics&lt;span class="o"&gt;)&lt;/span&gt;

        with tracer.start_as_current_span&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"monitor_cycle"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; as span:
            &lt;span class="c"&gt;# Set high-cardinality telemetry as span attributes&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"system.cpu.usage"&lt;/span&gt;, metrics[&lt;span class="s2"&gt;"cpu_percent"&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"system.memory.usage"&lt;/span&gt;, metrics[&lt;span class="s2"&gt;"memory_percent"&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"system.disk.usage"&lt;/span&gt;, metrics[&lt;span class="s2"&gt;"disk_percent"&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"alert.threshold.cpu"&lt;/span&gt;, CPU_ALERT_THRESHOLD&lt;span class="o"&gt;)&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"alert.threshold.memory"&lt;/span&gt;, MEMORY_ALERT_THRESHOLD&lt;span class="o"&gt;)&lt;/span&gt;
            span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"health.severity"&lt;/span&gt;, severity&lt;span class="o"&gt;)&lt;/span&gt;

            &lt;span class="c"&gt;# Trigger sub-span drilldown on CRITICAL events&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;severity &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"CRITICAL"&lt;/span&gt;:
                with tracer.start_as_current_span&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"trigger_alert"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; as alert_span:
                    alert_span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"alert.level"&lt;/span&gt;, &lt;span class="s2"&gt;"CRITICAL"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
                    alert_span.set_attribute&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"alert.reason"&lt;/span&gt;, &lt;span class="s2"&gt;","&lt;/span&gt;.join&lt;span class="o"&gt;(&lt;/span&gt;reasons&lt;span class="o"&gt;))&lt;/span&gt;
                    alert_span.add_event&lt;span class="o"&gt;(&lt;/span&gt;
                        &lt;span class="s2"&gt;"cpu_threshold_exceeded"&lt;/span&gt;, 
                        &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"cpu_percent"&lt;/span&gt;: metrics[&lt;span class="s2"&gt;"cpu_percent"&lt;/span&gt;&lt;span class="o"&gt;]}&lt;/span&gt;
                    &lt;span class="o"&gt;)&lt;/span&gt;

            print&lt;span class="o"&gt;(&lt;/span&gt;build_status_message&lt;span class="o"&gt;(&lt;/span&gt;metrics, severity&lt;span class="o"&gt;))&lt;/span&gt;

        record_incident&lt;span class="o"&gt;(&lt;/span&gt;metrics, severity, reasons&lt;span class="o"&gt;)&lt;/span&gt;
        time.sleep&lt;span class="o"&gt;(&lt;/span&gt;CHECK_INTERVAL_SECONDS&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. OpenTelemetry Collector Pipeline (&lt;code&gt;pours/deployment/ingester/ingester.yaml&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The SigNoz collector configuration receives raw OTLP gRPC spans on port &lt;code&gt;4317&lt;/code&gt; and processes them via ClickHouse batch exporters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:
    send_batch_size: 50000
    send_batch_max_size: 55000
    &lt;span class="nb"&gt;timeout&lt;/span&gt;: 5s

exporters:
  clickhousetraces:
    datasource: tcp://signoz-telemetrystore-clickhouse-0-0:9000/signoz_traces
    use_new_schema: &lt;span class="nb"&gt;true
    timeout&lt;/span&gt;: 45s

service:
  pipelines:
    traces:
      receivers: &lt;span class="o"&gt;[&lt;/span&gt;otlp]
      processors: &lt;span class="o"&gt;[&lt;/span&gt;batch]
      exporters: &lt;span class="o"&gt;[&lt;/span&gt;clickhousetraces]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚡ Quickstart &amp;amp; Testing
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Run Unit Tests
&lt;/h3&gt;

&lt;p&gt;Verify anomaly detection rules and JSONL logging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python &lt;span class="nt"&gt;-m&lt;/span&gt; unittest discover &lt;span class="nt"&gt;-s&lt;/span&gt; tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Run Containerized Deployment
&lt;/h3&gt;

&lt;p&gt;Deploy using Docker or Foundry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; health-bot &lt;span class="nb"&gt;.&lt;/span&gt;
docker run &lt;span class="nt"&gt;-p&lt;/span&gt; 8000:8000 &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;OTLP_ENDPOINT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://host.docker.internal:4317 health-bot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📈 Key Learnings &amp;amp; SigNoz Value
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tracing Over Static Logging&lt;/strong&gt;: Injecting CPU, memory, and disk utilization attributes into OpenTelemetry spans converts raw infrastructure spikes into searchable trace queries within SigNoz.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resilient Instrumentation&lt;/strong&gt;: Building automatic fallback mechanisms (OTLP to Console) guarantees that monitoring tools continue operating even during local collector outages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Reproducibility&lt;/strong&gt;: Providing valid &lt;code&gt;casting.yaml&lt;/code&gt; and ClickHouse configurations allows teams to deploy self-hosted observability stacks in minutes.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>docker</category>
      <category>python</category>
    </item>
    <item>
      <title>SignalForge: Building a Real-Time Agent Control Tower with OpenTelemetry and SigNoz</title>
      <dc:creator>Uzair</dc:creator>
      <pubDate>Sat, 25 Jul 2026 17:54:50 +0000</pubDate>
      <link>https://dev.to/uzair_43482468fbde1f12452/signalforge-building-a-real-time-agent-control-tower-with-opentelemetry-and-signoz-9h8</link>
      <guid>https://dev.to/uzair_43482468fbde1f12452/signalforge-building-a-real-time-agent-control-tower-with-opentelemetry-and-signoz-9h8</guid>
      <description>&lt;h1&gt;
  
  
  Building SignalForge: End-to-End Telemetry &amp;amp; Observability with OpenTelemetry and SigNoz
&lt;/h1&gt;

&lt;p&gt;In autonomous AI agent systems and modern microservice architectures, knowing &lt;em&gt;what&lt;/em&gt; happened isn't enough—you need to know &lt;em&gt;when&lt;/em&gt;, &lt;em&gt;why&lt;/em&gt;, and &lt;em&gt;how fast&lt;/em&gt; it happened. &lt;/p&gt;

&lt;p&gt;In this post, we'll walk through &lt;strong&gt;SignalForge Command Center&lt;/strong&gt;, a lightweight Node.js/Express telemetry dashboard designed to simulate agent trace streams, calculate real-time Service Level Objectives (SLOs), and export standard OpenTelemetry (OTEL) data to SigNoz.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌐 Live Demo &amp;amp; Deployment
&lt;/h2&gt;

&lt;p&gt;The application is deployed and live! You can inspect the command center directly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deployed Web Dashboard:&lt;/strong&gt; &lt;a href="https://signoz-track2-production.up.railway.app/" rel="noopener noreferrer"&gt;https://signoz-track2-production.up.railway.app/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;YouTube Demo:&lt;/strong&gt; &lt;a href="https://youtube.com/shorts/5ffMjV5UgD0?si=-lJHE952wvnctBWk" rel="noopener noreferrer"&gt;https://youtube.com/shorts/5ffMjV5UgD0?si=-lJHE952wvnctBWk&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm6f4wqzcysihh6cql3eu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm6f4wqzcysihh6cql3eu.png" alt=" " width="800" height="1778"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🏗️ Architectural Overview
&lt;/h2&gt;

&lt;p&gt;SignalForge consists of four core building blocks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Express Server (&lt;code&gt;server.js&lt;/code&gt;)&lt;/strong&gt;: Serves the REST API and dashboard UI, while maintaining a rolling in-memory telemetry store and simulating autonomous agent metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenTelemetry SDK (&lt;code&gt;otel-example.js&lt;/code&gt;)&lt;/strong&gt;: Configures auto-instrumentation for Express and HTTP requests, exporting traces via the OpenTelemetry Protocol (OTLP).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenTelemetry Collector (&lt;code&gt;otel-config.yaml&lt;/code&gt;)&lt;/strong&gt;: Receives, processes, and batches trace/metric streams before routing them to SigNoz Cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Dashboard (&lt;code&gt;public/index.html&lt;/code&gt; &amp;amp; &lt;code&gt;app.js&lt;/code&gt;)&lt;/strong&gt;: Polls backend APIs every 5 seconds, displaying real-time signal confidence, p95 latencies, and incident simulation controls.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💻 Key Implementation Files
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. OpenTelemetry SDK Setup (&lt;code&gt;otel-example.js&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;This script initializes the &lt;code&gt;NodeTracerProvider&lt;/code&gt; and attaches auto-instrumentation modules for HTTP and Express.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;const &lt;span class="o"&gt;{&lt;/span&gt; NodeTracerProvider &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/sdk-trace-node'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; SimpleSpanProcessor &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/sdk-trace-base'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; OTLPTraceExporter &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/exporter-trace-otlp-http'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; registerInstrumentations &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/instrumentation'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; HttpInstrumentation &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/instrumentation-http'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; ExpressInstrumentation &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/instrumentation-express'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; Resource &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/resources'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const &lt;span class="o"&gt;{&lt;/span&gt; SemanticResourceAttributes &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'@opentelemetry/semantic-conventions'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Configure resource attributes identifying this service
const provider &lt;span class="o"&gt;=&lt;/span&gt; new NodeTracerProvider&lt;span class="o"&gt;({&lt;/span&gt;
  resource: new Resource&lt;span class="o"&gt;({&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt;SemanticResourceAttributes.SERVICE_NAME]: &lt;span class="s1"&gt;'signalforge-command-center'&lt;/span&gt;,
    &lt;span class="o"&gt;[&lt;/span&gt;SemanticResourceAttributes.SERVICE_VERSION]: &lt;span class="s1"&gt;'1.0.0'&lt;/span&gt;,
  &lt;span class="o"&gt;})&lt;/span&gt;,
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Setup OTLP Exporter targeting your collector or SigNoz endpoint
const exporter &lt;span class="o"&gt;=&lt;/span&gt; new OTLPTraceExporter&lt;span class="o"&gt;({&lt;/span&gt;
  url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;'http://localhost:4318/v1/traces'&lt;/span&gt;,
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

provider.addSpanProcessor&lt;span class="o"&gt;(&lt;/span&gt;new SimpleSpanProcessor&lt;span class="o"&gt;(&lt;/span&gt;exporter&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
provider.register&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Enable automatic HTTP &amp;amp; Express tracing
registerInstrumentations&lt;span class="o"&gt;({&lt;/span&gt;
  instrumentations: &lt;span class="o"&gt;[&lt;/span&gt;
    new HttpInstrumentation&lt;span class="o"&gt;()&lt;/span&gt;,
    new ExpressInstrumentation&lt;span class="o"&gt;()&lt;/span&gt;,
  &lt;span class="o"&gt;]&lt;/span&gt;,
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

console.log&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'OpenTelemetry instrumentation successfully initialized.'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  2. Express Backend &amp;amp; Telemetry Simulator (&lt;code&gt;server.js&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;The main entry point manages telemetry aggregation, calculates active SLO metrics, and provides incident simulation endpoints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;// Enable OTEL auto-instrumentation &lt;span class="k"&gt;if &lt;/span&gt;flag is &lt;span class="nb"&gt;set
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;process.env.ENABLE_OTEL &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'true'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'./otel-example'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

const express &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'express'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const path &lt;span class="o"&gt;=&lt;/span&gt; require&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'path'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

const app &lt;span class="o"&gt;=&lt;/span&gt; express&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
const PORT &lt;span class="o"&gt;=&lt;/span&gt; process.env.PORT &lt;span class="o"&gt;||&lt;/span&gt; 3000&lt;span class="p"&gt;;&lt;/span&gt;

app.use&lt;span class="o"&gt;(&lt;/span&gt;express.json&lt;span class="o"&gt;())&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
app.use&lt;span class="o"&gt;(&lt;/span&gt;express.static&lt;span class="o"&gt;(&lt;/span&gt;path.join&lt;span class="o"&gt;(&lt;/span&gt;__dirname, &lt;span class="s1"&gt;'public'&lt;/span&gt;&lt;span class="o"&gt;)))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// In-memory store &lt;span class="k"&gt;for &lt;/span&gt;simulated telemetry events
&lt;span class="nb"&gt;let &lt;/span&gt;telemetryStore &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;activeIncident &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Generate simulated telemetry every 5 seconds
&lt;span class="k"&gt;function &lt;/span&gt;buildTelemetryEvent&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  const baseLatency &lt;span class="o"&gt;=&lt;/span&gt; activeIncident ? Math.floor&lt;span class="o"&gt;(&lt;/span&gt;Math.random&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; 300&lt;span class="o"&gt;)&lt;/span&gt; + 250 : Math.floor&lt;span class="o"&gt;(&lt;/span&gt;Math.random&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; 40&lt;span class="o"&gt;)&lt;/span&gt; + 20&lt;span class="p"&gt;;&lt;/span&gt;
  const status &lt;span class="o"&gt;=&lt;/span&gt; activeIncident &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; Math.random&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 0.4 ? &lt;span class="s1"&gt;'ERROR'&lt;/span&gt; : &lt;span class="s1"&gt;'OK'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  const event &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;id&lt;/span&gt;: &lt;span class="sb"&gt;`&lt;/span&gt;trace-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.now()&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;,
    timestamp: new Date&lt;span class="o"&gt;()&lt;/span&gt;.toISOString&lt;span class="o"&gt;()&lt;/span&gt;,
    latency: baseLatency,
    status: status,
    agentId: &lt;span class="sb"&gt;`&lt;/span&gt;agent-&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.floor(Math.random() * 5) + 1&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;,
  &lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  telemetryStore.push&lt;span class="o"&gt;(&lt;/span&gt;event&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;telemetryStore.length &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 100&lt;span class="o"&gt;)&lt;/span&gt; telemetryStore.shift&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

setInterval&lt;span class="o"&gt;(&lt;/span&gt;buildTelemetryEvent, 5000&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

// Summarize Telemetry &lt;span class="k"&gt;for &lt;/span&gt;Dashboard API
&lt;span class="k"&gt;function &lt;/span&gt;summarizeTelemetry&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;telemetryStore.length &lt;span class="o"&gt;===&lt;/span&gt; 0&lt;span class="o"&gt;)&lt;/span&gt; buildTelemetryEvent&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  const recent &lt;span class="o"&gt;=&lt;/span&gt; telemetryStore.slice&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;-20&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  const total &lt;span class="o"&gt;=&lt;/span&gt; recent.length &lt;span class="o"&gt;||&lt;/span&gt; 1&lt;span class="p"&gt;;&lt;/span&gt;
  const avgLatency &lt;span class="o"&gt;=&lt;/span&gt; Math.round&lt;span class="o"&gt;(&lt;/span&gt;recent.reduce&lt;span class="o"&gt;((&lt;/span&gt;&lt;span class="nb"&gt;sum&lt;/span&gt;, item&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;sum&lt;/span&gt; + item.latency, 0&lt;span class="o"&gt;)&lt;/span&gt; / total&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  const errorCount &lt;span class="o"&gt;=&lt;/span&gt; recent.filter&lt;span class="o"&gt;(&lt;/span&gt;i &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; i.status &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'ERROR'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;.length&lt;span class="p"&gt;;&lt;/span&gt;
  const errorRate &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt;errorCount / total&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; 100&lt;span class="o"&gt;)&lt;/span&gt;.toFixed&lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  const p95 &lt;span class="o"&gt;=&lt;/span&gt; avgLatency + 140&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    totalEvents: telemetryStore.length,
    avgLatencyMs: avgLatency,
    p95LatencyMs: p95,
    errorRatePct: errorRate,
    signalConfidence: activeIncident ? &lt;span class="s1"&gt;'CRITICAL'&lt;/span&gt; : &lt;span class="s1"&gt;'OPTIMAL'&lt;/span&gt;,
    sloStatus: errorRate &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 5 ? &lt;span class="s1"&gt;'BREACHED'&lt;/span&gt; : &lt;span class="s1"&gt;'HEALTHY'&lt;/span&gt;,
    activeIncident,
  &lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

// REST Endpoints
app.get&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/telemetry/summary'&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;req, res&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  res.json&lt;span class="o"&gt;(&lt;/span&gt;summarizeTelemetry&lt;span class="o"&gt;())&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

app.post&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/incident/toggle'&lt;/span&gt;, &lt;span class="o"&gt;(&lt;/span&gt;req, res&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  activeIncident &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;activeIncident&lt;span class="p"&gt;;&lt;/span&gt;
  res.json&lt;span class="o"&gt;({&lt;/span&gt; success: &lt;span class="nb"&gt;true&lt;/span&gt;, activeIncident &lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

app.listen&lt;span class="o"&gt;(&lt;/span&gt;PORT, &lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  console.log&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;SignalForge Command Center running on port &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;PORT&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;})&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  3. OpenTelemetry Collector Pipeline (&lt;code&gt;otel-config.yaml&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;This configuration routes incoming telemetry from local applications over standard gRPC (4317) or HTTP (4318) receivers and forwards it directly to SigNoz Cloud.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:
    &lt;span class="nb"&gt;timeout&lt;/span&gt;: 1s
    send_batch_size: 1024

exporters:
  otlp/signoz:
    endpoint: &lt;span class="s2"&gt;"ingest.us.signoz.cloud:443"&lt;/span&gt; &lt;span class="c"&gt;# Replace with your SigNoz region endpoint&lt;/span&gt;
    headers:
      &lt;span class="s2"&gt;"signoz-access-token"&lt;/span&gt;: &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;SIGNOZ_INGESTION_KEY&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

service:
  pipelines:
    traces:
      receivers: &lt;span class="o"&gt;[&lt;/span&gt;otlp]
      processors: &lt;span class="o"&gt;[&lt;/span&gt;batch]
      exporters: &lt;span class="o"&gt;[&lt;/span&gt;otlp/signoz]
    metrics:
      receivers: &lt;span class="o"&gt;[&lt;/span&gt;otlp]
      processors: &lt;span class="o"&gt;[&lt;/span&gt;batch]
      exporters: &lt;span class="o"&gt;[&lt;/span&gt;otlp/signoz]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  ⚡ Quickstart Guide
&lt;/h2&gt;

&lt;p&gt;To run SignalForge locally:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clone &amp;amp; Install Dependencies&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/era651868-ctrl/Signoz-track2.git
   &lt;span class="nb"&gt;cd &lt;/span&gt;signalforge
   npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run Standard Mode&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; to view the dashboard interface.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run with OpenTelemetry Export Enabled&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;ENABLE_OTEL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true &lt;/span&gt;&lt;span class="nv"&gt;OTEL_EXPORTER_OTLP_ENDPOINT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:4318/v1/traces npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📈 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standardization First&lt;/strong&gt;: By using OpenTelemetry SDKs, your application remains vendor-agnostic and can easily route metrics and traces to SigNoz, Jaeger, or Prometheus without changing code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proactive SLO Monitoring&lt;/strong&gt;: Real-time aggregation of p95 latency and error rates allows teams to respond to degradation before SLOs are fully breached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simulated Chaos Engineering&lt;/strong&gt;: Incorporating incident toggles directly into non-production environments aids in testing automated alert rules and dashboard visualization clarity.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Observability for Multi-Agent Workloads: Cost Tracking &amp; Fault Tolerance with SigNoz</title>
      <dc:creator>Uzair</dc:creator>
      <pubDate>Sat, 25 Jul 2026 07:26:32 +0000</pubDate>
      <link>https://dev.to/uzair_43482468fbde1f12452/observability-for-multi-agent-workloads-cost-tracking-fault-tolerance-with-signoz-3cgo</link>
      <guid>https://dev.to/uzair_43482468fbde1f12452/observability-for-multi-agent-workloads-cost-tracking-fault-tolerance-with-signoz-3cgo</guid>
      <description>&lt;h1&gt;
  
  
  Architecture Deep Dive: Defeating the AI Agent 'Black Box' with OpenTelemetry and SigNoz
&lt;/h1&gt;

&lt;p&gt;As AI agents transition from simple single-prompt scripts into complex multi-step systems, observability becomes mission-critical. In production architectures, an unmonitored agent chaining successive LLM iterations, managing volatile context state, and invoking discrete microservices can silently burn thousands of dollars in API token consumption or crash under rate limits.&lt;/p&gt;

&lt;p&gt;This technical guide details how we built and deployed the Agent Ops Command Center for Track 1 (AI &amp;amp; Agent Observability). Using Node.js, Express running on port 3000, OpenTelemetry, and SigNoz, we created a real-time control panel to track latency, token usage, sub-cent financial costs, and automated fault recovery.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcc5jqyrjv04t0eji2rjk.png" alt=" " width="800" height="1778"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🛠️ Infrastructure Assembly: Declarative Deployment via Foundry
&lt;/h2&gt;

&lt;p&gt;Rather than manually configuring separate analytics layers, the architecture relies on a declarative deployment blueprint executed through Foundry. This wraps the underlying telemetry engine alongside a native Model Context Protocol (MCP) server instance to ensure the entire environment remains reproducible for verification.&lt;/p&gt;

&lt;p&gt;Below is the structured installation configuration saved as casting.yaml:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1alpha1
kind: Installation
metadata:
  name: production-agent-sre
spec:
  deployment:
    flavor: compose
    mode: docker
  mcp:
    enabled: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To deploy the ecosystem, trigger the deployment compiler:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foundryctl cast -f casting.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  🧱 Real-World Gotcha: Port 3000 Ingestion &amp;amp; Proxy Handshakes
&lt;/h3&gt;

&lt;p&gt;During initial deployment, the Express server spins up on port 3000 (process.env.PORT || 3000). When verifying local connectivity across virtualized cloud environments, testing the backend directly on port 3000 ensures the health and telemetry probes are operational:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -v http://localhost:3000/api/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The test suite returns a clean HTTP/1.1 200 OK along with runtime telemetry snapshot status. When routing through web previews, mapping the host variable explicitly grants direct access to the command center:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "https://3000-$WEB_HOST"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  📡 Pipeline Architecture: End-to-End Tracer Instrumentation
&lt;/h2&gt;

&lt;p&gt;To extract execution data cleanly without vendor lock-in, our Express backend (server.js) integrates directly with official OpenTelemetry GenAI Semantic Conventions (gen_ai.*). Every agent invocation is exported directly to SigNoz via OTLP/HTTP.&lt;/p&gt;

&lt;p&gt;Below is the OpenTelemetry initialization and instrumentation setup used in Node.js:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express = require('express');
const { trace, SpanStatusCode } = require('@opentelemetry/api');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');

const app = express();
const port = process.env.PORT || 3000;
const serviceName = process.env.OTEL_SERVICE_NAME || 'agent-ops-command-center';
const otlpEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318';

// Configure OTLP Exporter targeting SigNoz
const exporter = new OTLPTraceExporter({
  url: `${otlpEndpoint.replace(/\/$/, '')}/v1/traces`
});

const provider = new BasicTracerProvider({
  resource: new Resource({
    [SemanticResourceAttributes.SERVICE_NAME]: serviceName,
    'service.version': '1.0.0',
    'deployment.environment': process.env.NODE_ENV || 'development'
  })
});

provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();

const tracer = trace.getTracer(serviceName);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  🔑 Key Features &amp;amp; Telemetry Design
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Granular Token &amp;amp; Cost Attribution
&lt;/h3&gt;

&lt;p&gt;Every agent execution creates an agent.run span. We attach custom Semantic Conventions to track exact token consumption and sub-cent financial expenditure across providers (OpenAI, Gemini):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;span.setAttribute('agent.name', agentName);
span.setAttribute('task.type', taskType);
span.setAttribute('gen_ai.system', providerName);
span.setAttribute('gen_ai.request.model', modelName);
span.setAttribute('gen_ai.usage.input_tokens', inputTokens);
span.setAttribute('gen_ai.usage.output_tokens', outputTokens);
span.setAttribute('gen_ai.usage.total_tokens', totalTokens);
span.setAttribute('agent.cost.usd', costUsd);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  2. Rate-Limit Resilience &amp;amp; Exponential Backoff
&lt;/h3&gt;

&lt;p&gt;When API provider rate limits or quotas are hit (HTTP 429), the backend applies an exponential backoff mechanism. If the quota remains exhausted, the system automatically records a warning span in SigNoz and gracefully switches to a rate-limit fallback response instead of crashing:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Catch rate limit errors and emit fallback trace to SigNoz
if (error.message.includes('Quota exceeded') || error.message.includes('429')) {
  span.setAttribute('gen_ai.request.model', `${modelName}-fallback`);
  span.setAttribute('gen_ai.usage.total_tokens', 150);
  span.setAttribute('agent.cost.usd', '0.000000');
  span.setStatus({ code: SpanStatusCode.OK });

  recordEvent('WARN', `Rate limit reached for ${providerName}. Used fallback.`, 'Agent run');
  span.end();

  return res.json({ run: fallbackRunData, live: true });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fej27ues20qxnqfwpwd9o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fej27ues20qxnqfwpwd9o.png" alt=" " width="800" height="1778"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  📊 Telemetry Design: Custom ClickHouse SRE Queries
&lt;/h2&gt;

&lt;p&gt;Using the ClickHouse datastore underneath SigNoz, we can query LLM telemetry directly through the SigNoz Query Builder to monitor live system metrics.&lt;/p&gt;

&lt;h4&gt;
  
  
  📈 Panel 1: Real-Time Token Spend &amp;amp; Cost Tracking Metrics
&lt;/h4&gt;

&lt;p&gt;Calculates financial accumulation across distinct model interactions:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    attributes_string['gen_ai.request.model'] as Model,
    SUM(attributes_int['gen_ai.usage.input_tokens']) as TotalInputTokens,
    SUM(attributes_int['gen_ai.usage.output_tokens']) as TotalOutputTokens,
    SUM(toFloat64(attributes_string['agent.cost.usd'])) as TotalSpendUSD
FROM signoz_traces.signoz_index_v2
WHERE name = 'agent.run' AND timestamp &amp;gt;= NOW() - INTERVAL 1 HOUR
GROUP BY Model
ORDER BY TotalSpendUSD DESC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  🔄 Panel 2: Agent High-Latency &amp;amp; Error Tracking
&lt;/h4&gt;

&lt;p&gt;Identifies agent runs experiencing high latency or execution errors:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    attributes_string['agent.name'] as AgentName,
    COUNT(*) as TotalRuns,
    AVG(durationNano) / 1000000 as AvgLatencyMs
FROM signoz_traces.signoz_index_v2
WHERE name = 'agent.run' AND timestamp &amp;gt;= NOW() - INTERVAL 30 MINUTE
GROUP BY AgentName
HAVING AvgLatencyMs &amp;gt; 250
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 Core Engineering Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Port 3000 Standardization: Aligning application routing and container proxy variables on port 3000 ensures clean local evaluation and deployment health checks.&lt;/li&gt;
&lt;li&gt;Resilient Fallback Loops: Gracefully capturing rate limits inside OpenTelemetry spans prevents application downtime while preserving full trace visibility in SigNoz.&lt;/li&gt;
&lt;li&gt;Declarative Reproducibility: Deploying through Foundry's casting.yaml ensures the underlying SigNoz telemetry collector stays reproducible for hackathon verification.&lt;/li&gt;
&lt;/ol&gt;




&lt;ul&gt;
&lt;li&gt;GitHub Repository: &lt;a href="https://github.com/era651868-ctrl/Signoz-track1" rel="noopener noreferrer"&gt;https://github.com/era651868-ctrl/Signoz-track1&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Port: 3000&lt;/li&gt;
&lt;li&gt;Live Deployment : &lt;a href="https://signoz-track1-production.up.railway.app/" rel="noopener noreferrer"&gt;https://signoz-track1-production.up.railway.app/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;YouTube Live Demo : &lt;a href="https://youtube.com/shorts/IFrIFgBu7AE?si=XxCj-26IKpFZ9sCB" rel="noopener noreferrer"&gt;https://youtube.com/shorts/IFrIFgBu7AE?si=XxCj-26IKpFZ9sCB&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Cracking the Black Box: How I Caught a Runaway AI Agent Using Self-Hosted SigNoz and OpenTelemetry</title>
      <dc:creator>Uzair</dc:creator>
      <pubDate>Thu, 16 Jul 2026 10:09:04 +0000</pubDate>
      <link>https://dev.to/uzair_43482468fbde1f12452/cracking-the-black-box-how-i-caught-a-runaway-ai-agent-using-self-hosted-signoz-and-opentelemetry-24ph</link>
      <guid>https://dev.to/uzair_43482468fbde1f12452/cracking-the-black-box-how-i-caught-a-runaway-ai-agent-using-self-hosted-signoz-and-opentelemetry-24ph</guid>
      <description>&lt;h1&gt;
  
  
  Architecture Deep Dive: Defeating the AI Agent 'Black Box' with OpenTelemetry and SigNoz
&lt;/h1&gt;

&lt;p&gt;Autonomous AI agents are incredibly powerful engineering solutions—until they hit an unhandled data schema mutation and spin out into a recursive execution loop. In production architectures, an unmonitored agent chaining successive LLM iterations, managing volatile context state, and invoking discrete microservices can become a massive liability, silently burning thousands of dollars in API token consumption.&lt;/p&gt;

&lt;p&gt;If your operational visibility ends at the perimeter of the network proxy, you are operating blindly. This analytical guide details how to build a production-hardened observability foundation by self-hosting SigNoz via Foundry, configuring OTLP pipelines using standard semantic conventions, and assembling a custom ClickHouse-backed telemetry dashboard to detect cost runaway and agent loops dynamically.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Infrastructure Assembly: Declarative Deployment via Foundry
&lt;/h2&gt;

&lt;p&gt;Rather than manually configuring separate analytics layers, the architecture relies on a declarative deployment blueprint executed through Foundry. This wraps the underlying telemetry engine alongside a native Model Context Protocol (MCP) server instance to ensure the entire environment remains reproducible for verification.&lt;/p&gt;

&lt;p&gt;Below is the structured installation configuration saved as &lt;code&gt;casting.yaml&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1alpha1
kind: Installation
metadata:
  name: production-agent-sre
spec:
  deployment:
    flavor: compose
    mode: docker
  mcp:
    enabled: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To deploy the ecosystem, trigger the deployment compiler:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;foundryctl cast -f casting.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  🧱 Real-World Gotcha: Mitigating Web Preview Proxy Handshakes
&lt;/h3&gt;

&lt;p&gt;During initial initialization, the container cluster successfully spun up all primary components (ClickHouse cluster, OTLP ingestion layer, and frontend gateway). However, accessing the dashboard via standard virtualized port configurations resulted in standard proxy handshaking timeouts.&lt;/p&gt;

&lt;p&gt;To isolate the failure point, low-level testing directly on the local routing layer was used:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -v http://localhost:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The test suite immediately returned a clean &lt;code&gt;HTTP/1.1 200 OK&lt;/code&gt; followed by the raw UI document structure, indicating a completely functional application layer. The underlying network proxy environment variables were caching dead routing handles. The workaround requires mapping the host address explicitly by querying the cluster's environment variables:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "https://8080-$WEB_HOST"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Pasting the output token directly into a clean browser instance completely bypassed the virtual network constraints, granting access to the SigNoz control console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F66z3nskb5ntlzrhly8ue.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F66z3nskb5ntlzrhly8ue.jpg" alt="SigNoz application metrics container deployment dashboard showing active web application latency routing tables" width="800" height="522"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📡 Pipeline Architecture: End-to-End Tracer Instrumentation
&lt;/h2&gt;

&lt;p&gt;To extract execution data cleanly without vendor lock-in, the agent framework integrates directly with official OpenTelemetry GenAI Semantic Conventions (&lt;code&gt;gen_ai.*&lt;/code&gt;). This registers every microservice step—from LLM generation metrics to discrete utility routing—as structured OTLP data payloads.&lt;/p&gt;

&lt;p&gt;Below is the initialization code for a Python-based multi-agent execution thread:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import os
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter

# Bind TracerProvider to the local SigNoz gRPC ingestion socket
provider = TracerProvider()
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True))
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)
telemetry_tracer = trace.get_tracer("agent-core-apm")

def execute_agent_pipeline(user_input, tracking_session_id):
    # Enclose the parent context inside a distinct trace scope
    with telemetry_tracer.start_as_current_span("orchestrate_agent_workflow") as master_span:
        master_span.set_attribute("gen_ai.workflow.name", "Enterprise-Data-Orchestrator")
        master_span.set_attribute("gen_ai.conversation.id", tracking_session_id)

        # Track individual LLM interaction sequences
        with telemetry_tracer.start_as_current_span("llm_chat_transaction") as inference_span:
            inference_span.set_attribute("gen_ai.system", "Anthropic")
            inference_span.set_attribute("gen_ai.request.model", "claude-3-5-sonnet")

            # Record downstream tools and structural database interactions
            with telemetry_tracer.start_as_current_span("dispatch_utility_tool") as service_span:
                service_span.set_attribute("gen_ai.tool.name", "query_analytical_db")
                # Emulate an active runtime schema violation to verify pipeline response
                service_span.set_status(trace.StatusCode.ERROR, "Unexpected data structure returned from storage layer")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcalbf3dhmkdu7zvj1ole.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcalbf3dhmkdu7zvj1ole.jpg" alt="SigNoz Trace Explorer waterfall graph and flame chart mapping nested service execution spans and transaction tracking" width="701" height="438"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Telemetry Design: Custom ClickHouse SRE Query Dashboards
&lt;/h2&gt;

&lt;p&gt;Standard system analytics checking generic memory metrics and HTTP statuses fail to surface internal logic errors within AI pipelines. By utilizing the raw performance of the ClickHouse datastore underneath SigNoz, we can engineer custom dashboards to track execution logic directly through the SigNoz Query Builder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxvf98nqq80ntjrq5bxn.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkxvf98nqq80ntjrq5bxn.webp" alt="SigNoz Query Builder v5 interface constructing custom metrics time-series tracking parameters using ClickHouse data inputs" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  📈 Panel 1: Real-Time Token Spend &amp;amp; Cost Tracking Metrics
&lt;/h4&gt;

&lt;p&gt;Calculates financial accumulation across distinct customer conversations to surface anomalous cost metrics:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    attributes_string['gen_ai.conversation.id'] as TargetSession,
    SUM(attributes_int['gen_ai.usage.prompt_tokens']) as AggregatedInputTokens,
    SUM(attributes_int['gen_ai.usage.completion_tokens']) as AggregatedOutputTokens,
    (SUM(attributes_int['gen_ai.usage.prompt_tokens']) * 0.000003) + (SUM(attributes_int['gen_ai.usage.completion_tokens']) * 0.000015) as FinancialExposureUSD
FROM signoz_traces.signoz_index_v2
WHERE name = 'llm_chat_transaction' AND timestamp &amp;gt;= NOW() - INTERVAL 1 HOUR
GROUP BY TargetSession
ORDER BY FinancialExposureUSD DESC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  🔄 Panel 2: Agent Recursion Loops &amp;amp; Storm Counter
&lt;/h4&gt;

&lt;p&gt;Identifies broken logic configurations by flagging single transactions that issue more than ten nested tools inside a short temporal window:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    attributes_string['gen_ai.conversation.id'] as TargetSession,
    COUNT(*) as DetectedToolExecutions
FROM signoz_traces.signoz_index_v2
WHERE name = 'dispatch_utility_tool' AND timestamp &amp;gt;= NOW() - INTERVAL 30 MINUTE
GROUP BY TargetSession
HAVING DetectedToolExecutions &amp;gt; 10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  🔍 Panel 3: Runtime Error Analysis Matrix
&lt;/h4&gt;

&lt;p&gt;Categorizes and aggregates explicit platform exceptions to identify if issues stem from third-party vendor slowdowns or local code exceptions:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT
    attributes_string['error.type'] as ExceptionType,
    COUNT(*) as AggregateIncidents
FROM signoz_traces.signoz_index_v2
WHERE response_status_code = 'STATUS_CODE_ERROR'
GROUP BY ExceptionType
ORDER BY AggregateIncidents DESC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 Core Engineering Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Context State Expands Multiplicatively:&lt;/strong&gt; As multi-step reasoning models operate, prompt structures grow larger. OpenTelemetry tracing exposes this inflation clearly before total context limit saturation occurs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure-as-Code Prevents Divergence:&lt;/strong&gt; Deploying via Foundry's &lt;code&gt;casting.yaml&lt;/code&gt; ensures analytical pipelines remain completely consistent across isolated environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic Standardization Eliminates Rewrite Overhead:&lt;/strong&gt; Utilizing uniform standard semantic attributes ensures your tracking metrics adapt perfectly if you transition from Python routines to production Node.js frameworks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By moving away from unstructured console outputs and anchoring our tracking to OpenTelemetry standards with SigNoz, we convert unpredictable AI processes into fully transparent, debuggable software architectures.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>devops</category>
      <category>python</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
