Skip to content

Instantly share code, notes, and snippets.

View tobert's full-sized avatar
💭
🏳️‍🌈 💻 🏳️‍🌈

Amy Tobey tobert

💭
🏳️‍🌈 💻 🏳️‍🌈
View GitHub Profile
@tobert
tobert / talk-agenda-trace.sh
Last active March 15, 2022 05:28
a silly script to generate a trace of our agenda
#!/bin/bash
svc="SRECon"
# turns out the date doesn't matter much for this exercise since
# we don't show it
# but it is important for /finding/ these spans once you've sent them
# so pick a date/time earlier today while testing :)
talk_start="2022-03-14T20:00:00.00000Z"
talk_end="2022-03-14T20:40:00.00000Z"
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
# opentelemetry-ruby only supports http for now
http:
endpoint: "0.0.0.0:55681"
processors:
@tobert
tobert / custom-traceparent.py
Last active September 2, 2021 17:50
custom traceparent propragation in python
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry import context
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient
from opentelemetry import propagate
@tobert
tobert / tinkerbell-boots-raw-traces.txt
Created August 11, 2021 21:53
a snapshot of trace dumps from my work on tinkerbell/boots adding OpenTelemetry
otel-collector_1 | Span #2
otel-collector_1 | Trace ID : f84421f9695c1cd40dd54239a39687a5
otel-collector_1 | Parent ID :
otel-collector_1 | ID : aec1f44bad81b207
otel-collector_1 | Name : dhcp.request
otel-collector_1 | Kind : SPAN_KIND_INTERNAL
otel-collector_1 | Start time : 2021-08-11 21:49:09.117334915 +0000 UTC
otel-collector_1 | End time : 2021-08-11 21:49:09.117486739 +0000 UTC
otel-collector_1 | Status code : STATUS_CODE_OK
otel-collector_1 | Status message :
@tobert
tobert / archbox-xhyve.sh
Last active July 30, 2021 17:16
my startup script for xhyve
#!/bin/bash
# start up my Arch machine
# root disk:
# dd if=/dev/zero of=root.img bs=1000000 count=4000 conv=sparse
# scratch disk is for moving data in and out without networking
# e.g. tar -xzvf /dev/vdb
# dd if=/dev/zero of=scratchdisk.img bs=1000000 count=2500 conv=sparse
data=$HOME/archbox
@tobert
tobert / otel-cli-ideas.sh
Last active August 18, 2022 11:58
span & event ideas for otel-cli
#!/bin/bash
# otel-cli-ideas.sh - some ideas I'm playing with for otel-cli to cover some
# use cases where manual spans or exec don't quite do the trick
#
# another cool outcome is you could run this without the collector in some
# cases without spamming your OTLP endpoint...
#
# I hope to OSS otel-cli under Apache 2 in early April 2021.
# maybe it could background itself and wait for events on a unix socket?
receivers:
otlp:
protocols:
grpc:
endpoint: "127.0.0.1:55680"
# opentelemetry-ruby only supports http for now
http:
endpoint: "127.0.0.1:55681"
processors:
@tobert
tobert / otel-test-forking-cli.rb
Last active March 5, 2021 22:55
a quick & dirty test script for testing some otel code
#!/usr/bin/env ruby
# run the otel collector with otlp/http enabled and turn on debug logging
# so you can see it print spans as they go through...
#
# configuration:
# export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:55681
#
# first iteration I thought I had an easy repro because I had set
# OTEL_RUBY_BSP_START_THREAD_ON_BOOT=false
# so don't do that :) It's almost never what you want.
@tobert
tobert / xhyve-systemrescue.sh
Created October 29, 2020 20:53
xhyve system rescue
#!/bin/bash
# start up my Arch machine
# for this to work I had to extract kernel & initramfs from the ISO
# which is a surprisingly a pain in the butt on OSX but easy enough
# to find on Google, tldr add 2K of zeroes to the front of the ISO
# then it'll mount just fine
# to make root disk:
# dd if=/dev/zero of=root.img conv=sparse bs=1000000 count=20000
@tobert
tobert / main.go
Created January 1, 2019 21:43
silly example
func main() {
input := []string{
"a",
"b",
"c",
"foo",
}
data := make(map[string][]string)