Skip to content

Instantly share code, notes, and snippets.

View eriksywu's full-sized avatar

Erik Wu eriksywu

  • Chronosphere
  • 07:00 (UTC -07:00)
View GitHub Profile
@eriksywu
eriksywu / gist:91944e4d39f4a8d0bef6edb4f4316011
Created March 12, 2026 14:21
sidecar_metrics_profiler.py
#!/usr/bin/env python3
"""Profile which Chronosphere entities reference sidecar metrics across tenants."""
import argparse
import csv
import json
import subprocess
import sys
from collections import defaultdict
from pathlib import Path
@eriksywu
eriksywu / downsampler.MD
Last active November 17, 2025 04:41
a general, somewhat-formal proof cumulative downsampler correctness

Objective

Find a mapping $DS$ (cumulative downsampler) such that $$DS : {X} \longrightarrow {Y} \times {R}, \quad where \quad {X} = \mathbb{R}^N, \quad {Y} = \mathbb{R}^M, \quad M \le N,\quad N \gt 1, \quad M \gt 1 \quad \text{and} \quad M \text{ is a cost to minimize.}$$

$DS$ has these constraints:

  1. $\exists {m} in {M} \text{such that } Increase(X) = Increase(D(X)) ; \text{for all } x \in X$
    • The increase observed in the input and output must be equal
  2. $\forall x \in X, ; y = DS(x) ; => y_1 = x_1 ; and ; y_m = x_n$

Objective

Prove that there exists a mapping $DS$ (cumulative downsampler) such that $$DS : {X} \longrightarrow {Y}, \quad where \quad {X} = \mathbb{R_{\ge 0}}^N, \quad {Y} = \mathbb{R_{\ge 0}}^M, \quad M \le N,\quad N \gt 1, \quad M \gt 1 \quad \text{and} \quad M \text{ is a cost to minimize.}$$

$DS$ has these constraints:

  1. $\exists {m} \in M, \text{ such that } Increase(X) = Increase(D(X)) ; \text{for all } x \in X$
    • The increase observed in the input and output must be equal
  2. $\forall x \in X, \quad y = DS(x) \quad => y_1 = x_1 \quad and \quad y_m = x_n$
@eriksywu
eriksywu / gist:d3a5b66848efe78125bebd5ceb134fa2
Created August 13, 2025 22:38
otelcol yaml with `metricstarttime` processor using start_time_attribute
apiVersion: apps/v1
kind: Deployment
metadata:
name: otelcollector-deployment
spec:
replicas: 1
selector:
matchLabels:
app: otelcollector-deployment
template:
apiVersion: apps/v1
kind: Deployment
metadata:
name: promtest
labels:
app: promtest
spec:
replicas: 1
selector:
matchLabels:
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: downgradecontainerd
namespace: kube-system
labels:
app: downgradecontainerd
spec:
selector:
matchLabels:
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: downgradecontainerd
namespace: kube-system
labels:
app: downgradecontainerd
spec:
selector:
matchLabels:
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: ensure-no-dup
namespace: kube-system
labels:
app: ensure-no-dup
spec:
selector:
matchLabels:
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: snat-exemption
namespace: kube-system
labels:
app: snat-exemption
spec:
selector:
matchLabels:
apiVersion: v1
kind: Pod
metadata:
name: busybox1
labels:
app: busybox1
spec:
containers:
- image: busybox
command: