Skip to content

Instantly share code, notes, and snippets.

@ericmustin
ericmustin / example_ruby_traces.md
Created April 3, 2023 05:44
example ruby traces
gantt
dateFormat x
axisFormat %X:%L

title Trace 9a78cfeebd62a55a130068b0dbc01dc3

section Service emailservice
GET /return_order_deprecated :active, 1680500611600, 795ms
@ericmustin
ericmustin / exampletrace.md
Created March 21, 2023 02:02
example otel trace as gantt
gantt
dateFormat  x

title Example OpenTelemetry Trace as a Gantt Chart

section Database
Database Query    :done,   2023-03-21T00:00:00.000Z, 500ms
Database Insert   :active, 2023-03-21T00:00:02.000Z, 500ms
@ericmustin
ericmustin / datadog_opentelemetry_example_sampler.rb
Last active July 1, 2021 13:02
datadog opentelemetry example sampler for a Sinatra Ruby app
require 'opentelemetry/sdk'
require 'opentelemetry-instrumentation-sinatra'
require 'opentelemetry/exporter/otlp'
# Implements sampling based on a probability.
class DatadogTraceIdRatioBased < ::OpenTelemetry::SDK::Trace::Samplers::TraceIdRatioBased
def initialize(probability)
@probability = probability
super(probability)
end
@ericmustin
ericmustin / example_output.txt
Created March 8, 2021 02:14
opentelemetry-ruby-zipkin-exporter collector debug logs
otel-collector_1 | 2021-03-08T02:08:46.980Z INFO loggingexporter/logging_exporter.go:313 TracesExporter {"#spans": 18}
otel-collector_1 | 2021-03-08T02:08:46.981Z DEBUG loggingexporter/logging_exporter.go:352 ResourceSpans #0
otel-collector_1 | Resource labels:
otel-collector_1 | -> service.name: STRING(sandbox_test_ruby)
otel-collector_1 | -> process.command: STRING(puma: cluster worker 0: 1 [sinatra-multivac])
otel-collector_1 | -> deployment.environment: STRING(otel_sandbox)
otel-collector_1 | -> process.pid: STRING(7)
otel-collector_1 | -> telemetry.sdk.version: STRING(0.15.0)
otel-collector_1 | -> telemetry.sdk.language: STRING(ruby)
otel-collector_1 | -> telemetry.sdk.name: STRING(opentelemetry)
@ericmustin
ericmustin / index.js
Created November 25, 2020 14:13
Reproduction of OpenTelemetry Collector Zipkinv2 error tagging
'use strict';
const tracer = require('signalfx-tracing').init({
url: 'http://otel-collector:9411/v1/trace'
})
const port = 4000;
const express = require('express');
const app = express();
@ericmustin
ericmustin / the_last_question.md
Created September 18, 2020 09:29
The Last Question

The Last Question by Isaac Asimov © 1956

The last question was asked for the first time, half in jest, on May 21, 2061, at a time when humanity first stepped into the light. The question came about as a result of a five dollar bet over highballs, and it happened this way: Alexander Adell and Bertram Lupov were two of the faithful attendants of Multivac. As well as any human beings could, they knew what lay behind the cold, clicking, flashing face -- miles and miles of face -- of that giant computer. They had at least a vague notion of the general plan of relays and circuits that had long since grown past the point where any single human could possibly have a firm grasp of the whole.

Multivac was self-adjusting and self-correcting. It had to be, for nothing human could adjust and correct it quickly enough or even adequately enough -- so Adell and Lupov attended the monstrous giant only lightly and superficially, yet as well as any men could. They fed it data, adjusted questions to its needs and translated th

@ericmustin
ericmustin / rum_injection.vcl
Created August 24, 2020 16:09
try this one cool trick to do distributed tracing and RUM Injection via VCL
sub vcl_recv {
declare local var.timemsec TIME;
declare local var.traceid INTEGER;
if(req.http.x-datadog-trace-id) {
} else{
set var.traceid = randomint(0, 2147483647);
set var.traceid <<= 32;
set var.traceid |= randomint(0, 4294967295);
@ericmustin
ericmustin / README.md
Last active August 14, 2020 12:56
puppeteer har file generator with custom responses

Basic Usage

  • npm install
  • node index.js
  • Then, to see results
  • cat results.har | jq '.log.entries | map(.response)'
@ericmustin
ericmustin / dd-otel-comparision.txt
Last active March 25, 2021 12:55
dd-otel-comparision
1. Datadog https://a.cl.ly/4gu90zpp
dd api intake
+----------------------------------------------------------------------------------------------------------------------+
| |
| |
| ^ |
| | |
| | |
| | |
@ericmustin
ericmustin / example_http_request.js
Created April 29, 2020 11:41
example_http_request
// cd into root of this directory
// npm install
// npm install -g http-echo-server
// different terminal window from run `http-echo-server`
// node index.js
const tracer = require('dd-trace').init({debug: false})
const axios = require('axios')
const express = require('express')