Skip to content

Instantly share code, notes, and snippets.

View svrnm's full-sized avatar

Severin Neumann svrnm

View GitHub Profile
@svrnm
svrnm / README.md
Created January 8, 2025 08:57
Docker compose override for OpenTelemetry zero-code instrumentation

Docker compose override for OpenTelemetry zero-code instrumentation

If you want to add OpenTelemetry to the services in an existing docker-compose.yml you can use a docker-compose.override.yml to do so without touching your existing file.

Imagine you have three services listed called frontend, processing and backend in your compose file. Two of them are written in Java, one of them in Node.JS. Create the following docker-compose.override.yml file alongside your docker-compose.yml to inject the Java agent and the @opentelemetry/auto-instrumentations-node package into them:

@svrnm
svrnm / spec_compliance_matrix.yaml
Created October 24, 2024 15:04
OTel Spec Compliance Matrix YAML
- name: Traces
description: ""
features:
- feature group: TracerProvider
features:
- feature: Create TracerProvider
optional: false
status:
go: supported
java: supported
@svrnm
svrnm / otel-dns-net-http-combined.js
Last active April 22, 2021 15:34
otel-dns-net-http-combined
'use strict';
const { diag, DiagConsoleLogger, DiagLogLevel } = require('@opentelemetry/api');
const { NodeTracerProvider } = require('@opentelemetry/node');
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net');
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/tracing');
const provider = new NodeTracerProvider();
@svrnm
svrnm / rabbitmq.js
Created April 3, 2020 11:47
RabbitMQ exit call + correlation for AppDynamics
const appdynamics = require("appdynamics")
appdynamics.profile({
controllerHostName: '.saas.appdynamics.com',
controllerPort: 443,
controllerSslEnabled: true,
accountName: '',
accountAccessKey: '',
applicationName: '',
tierName: '',
debug: true,
@svrnm
svrnm / globalSearch.js
Last active January 3, 2025 13:59
Global Search on the window object
function globalSearch(value, max = 100000) {
var stack = (function () {
iframe = document.createElement('iframe');
document.body.appendChild(iframe);
var results = Object.getOwnPropertyNames(window).filter(p => !iframe.contentWindow.hasOwnProperty(p)).map(p => {return {type: typeof window[p], name: p, value: window[p]}}).reduce((c,p) => {
c.push([p.value, 'window.' + p.name]);
return c;
}, []);
document.body.removeChild(iframe);
@svrnm
svrnm / creator.js
Last active April 12, 2019 12:28
flowmap-creator
const fs = require('fs');
let flowmap = JSON.parse(fs.readFileSync('flowmap.json'));
const nodeCount = 1
const edgeCount = Math.floor(nodeCount * 1.5)
const fileName = `flowmap-${nodeCount}.json`
const nodeString = JSON.stringify(flowmap.nodes[0])
@svrnm
svrnm / appd-download.sh
Created April 10, 2019 08:23
AppDynamics Download Script
TOKEN=$(curl -s -X POST -d "{\"username\": \"${1}\",\"password\": \"${2}\",\"scopes\": [\"download\"]}" https://identity.msrv.saas.appdynamics.com/v2.0/oauth/token)
TOKEN=${TOKEN##*'access_token": "'}
FILE=$(curl -s "https://download.appdynamics.com/download/downloadfile/?format=json&page=1&search=${3/ /+}")
FILE=${FILE##*'download_path":"'}
curl -L -O -H "Authorization: Bearer ${TOKEN%%\",*}" ${FILE%%\",*}
@svrnm
svrnm / anonymize_ip.php
Last active March 27, 2018 22:10
Anonymize IPv4 and IPv6 addresses
<?php
function anonymize_ip($ip) {
if($ip = @inet_pton($ip)) {
return inet_ntop(substr($ip, 0, strlen($ip)/2) . str_repeat( chr(0), strlen($ip)/2 ));
}
return '0.0.0.0';
}
?>
@svrnm
svrnm / ClientCacheFilter.php
Last active August 29, 2015 13:55
This version of ClientCacheFilter.php uses laravel session instead of $_SESSION
<?php namespace Codesleeve\AssetPipeline\Filters;
use DateTime;
use Session;
use Assetic\Cache\CacheInterface;
class ClientCacheFilter implements CacheInterface
{
/**
* This is a decorator class which uses an underlying CacheInterface