Skip to content

Instantly share code, notes, and snippets.

View keithchambers's full-sized avatar

Keith Chambers keithchambers

View GitHub Profile
@keithchambers
keithchambers / SPEC.md
Last active May 23, 2025 00:07
SPEC.md

Data Schema for Agentic AI Application Observability

Version: 1.1  Date: May 22 2025

1. Overview

This document outlines the data schema for observing agentic AI applications. It follows a top-down approach, starting from the overall application context (resource level), moving to the specific types of operations (spans) that constitute an agent’s execution, and detailing the attributes associated with each. The schema heavily relies on OpenTelemetry (OTEL) semantic conventions, including the specialized conventions for Generative AI (GenAI).

The goal is to provide a standardized way to capture telemetry data, enabling effective visualization, monitoring, debugging, and performance analysis of agentic AI systems.

2. Resource Level Attributes

These attributes define the service or application performing the operations.

receivers:
otlp:
protocols:
grpc: {}
http: {}
processors:
transform/normalise_keys:
error_mode: ignore
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "AWS Bedrock OpenTelemetry (OTLP/JSON) Schema",
"description": "Validation schema covering resource and span attributes required for instrumenting Amazon Bedrock calls using OpenTelemetry Gen-AI semantic conventions.",
"type": "object",
"properties": {
"resource": {
"type": "object",
"properties": {
"attributes": { "$ref": "#/$defs/ResourceAttributes" }
@keithchambers
keithchambers / main.go
Created May 2, 2025 13:05
OTEL Harrier DQL
// Package genaicleaner provides an OpenTelemetry Collector *processor* that
// sanitises Gen-AI spans in-flight.
//
// The processor performs three operations, all entirely in-memory:
//
// 1. **Validation** – incoming spans are checked against Harrier’s
// *authoritative* allow-lists (derived from OTEP ≥ 1.43).
// 2. **Cleaning / Forking**
// • A *clean* copy is forwarded on the same pipeline and tagged
// `messaging.kafka.destination="input"` so the kafkaexporter can map
{
"resourceSpans": [
{
"resource": {
"attributes": [
{ "key": "service.name", "value": { "stringValue": "autonomous_trading_system" } },
{ "key": "service.namespace", "value": { "stringValue": "trading" } },
{ "key": "service.version", "value": { "stringValue": "3.2.0" } },
{ "key": "service.instance.id", "value": { "stringValue": "instance-001" } },
{ "key": "deployment.environment","value":{ "stringValue": "prod" } }
{
"resourceSpans": [
{
"resource": {
"attributes": [
{ "key": "service.name", "value": { "stringValue": "genai-demo-app" } },
{ "key": "deployment.environment", "value": { "stringValue": "prod" } }
]
},
"schema_url": "https://opentelemetry.io/schemas/1.5.0",
@keithchambers
keithchambers / OTEL.json
Last active April 20, 2025 07:48
OTEL JSON
{
"resourceSpans": [{
"schemaUrl": "https://opentelemetry.io/schemas/1.25.0",
"resource": {
"attributes": [{
"key": "service.name", "value": { "stringValue": "llm-gateway" }},{
"key": "deployment.environment", "value": { "stringValue": "prod" }}]},
"scopeSpans": [{
"scope": { "name": "ai.request.pipeline", "version": "2.3.0" },
"spans": [{
@keithchambers
keithchambers / setup.sh
Created April 15, 2025 19:49
Kafka Batch File Upload System
#!/bin/bash
set -e # Exit on error. Use `set -eux` for debugging to print commands and expand variables.
REPO_NAME="kafka-batch-upload"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # Get dir where setup.sh is
KAFKA_IMAGE="bitnami/kafka:3.7" # Define Kafka image once
echo "Setting up the Kafka Batch Upload project in ./${REPO_NAME}"
echo "This will create all necessary files and directories."
echo "Attempting to automate KRaft Cluster ID generation..."
@keithchambers
keithchambers / main.go
Last active April 14, 2025 16:02
OTEL Agentic Event Gen
// Package main implements a load tester for sending OpenTelemetry (OTLP) data
// via HTTP JSON or gRPC Protobuf, with an option to output generated data to a
// file instead of sending it over the network.
package main
import (
"bytes"
"context"
"crypto/tls"
"encoding/hex"