Skip to content

Instantly share code, notes, and snippets.

View spencerwilson's full-sized avatar

Spencer Wilson spencerwilson

View GitHub Profile
@spencerwilson
spencerwilson / otel_sampler_survey.md
Last active September 7, 2022 16:41
OTel: Sampler survey

Sampler survey

This doc compares the capabilities of popular telemetry sampling systems. The dimensions that are compared:

Dimensions related to limiting throughput

Temporal resolution: The time range that the limiting occurs on. E.g., limit the number of...

  • Spans per second
  • Spans per calendar month

Degree of limiting: In a steady state with spans created at a rate R span/s that is greater than the desired limit,

@spencerwilson
spencerwilson / two_kinds_of_samplers.md
Created September 7, 2022 07:34
otel_balancers_and_limiters

Two kinds of samplers

Consider two broad goals in sampling:

  • Avoid {over,under}sampling of data
  • Ensure that overall data collection doesn't exceed acceptable limits

These can be treated separately. Doing so may yield a simpler and more flexible conceptual foundation for sampling.

Balancers

Define a balancer to be a sampler that does the following: For each input trace,

  1. Assign a "frequency" score to the trace.
@spencerwilson
spencerwilson / ModifyAttributesProcessor.ts
Created May 19, 2022 00:15
modifying span attributes
import { Context, SpanAttributes } from '@opentelemetry/api';
import {
ReadableSpan,
Span,
SpanProcessor,
} from '@opentelemetry/sdk-trace-base';
/**
* Intercepts `onEnd` to modify a finished Span's attributes.
* Otherwise delegates completely to a child SpanProcessor.
@spencerwilson
spencerwilson / nginx.conf
Created November 13, 2021 07:10
nginx and nginx instrumentation configs
# configuration file /etc/nginx/nginx.conf:
#Elastic Beanstalk Nginx Configuration File
load_module /home/ec2-user/otel_ngx_module.so;
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 200000;
@spencerwilson
spencerwilson / nb.py
Created November 21, 2018 18:22
Federalist papers classification
#!/usr/bin/env python
import numpy as np
import pandas as pd
from sklearn import svm
FILE_NAME = 'mosteller-wallace-federalist-papers.csv'
STOP_WORDS = ['a', 'an']
# Rows are samples, cols are [...word_count, AUTHOR, CODE_NUMER].
@spencerwilson
spencerwilson / code.js
Created August 8, 2017 14:28
Discrete stats fns
/**
* @typedef Point
* A pair of numbers suitable for plotting.
*/
/**
* @param {Array.<number>} arr
* n observations of a continuous random variable (RV).
* @returns {Array.<Point>}
* The empirical probabilities of the given observed values of the RV.