Skip to content

Instantly share code, notes, and snippets.

View keithchambers's full-sized avatar

Keith Chambers keithchambers

  • ModelOp
  • Seattle, WA
View GitHub Profile
@keithchambers
keithchambers / -h | --help
Created January 28, 2025 03:34
YouTube Transcript Downloader
usage: yt-transcript-downloader.py [-h] [-k KEY] [-v VIDEO] [-c CHANNEL] [-p PLAYLIST] [-s SEARCH] [-o {relevance,date,rating,views}] [-m MAX_SIZE] [-a AGE]
Download YouTube transcripts and metadata in YAML format,
with an optional max YAML file size limit.
options:
-h, --help show this help message and exit
-k KEY, --key KEY YouTube API Key to use. Overrides YOUTUBE_API_KEY env variable if not set.
-v VIDEO, --video VIDEO
YouTube Video ID or URL
@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..."