Skip to content

Instantly share code, notes, and snippets.

View tustunkok's full-sized avatar

Tolga Üstünkök tustunkok

View GitHub Profile
@tustunkok
tustunkok / otel_traces_to_flat.jslt
Created May 25, 2026 13:03
OTEL Traces JSLT Parser
def extract_anyvalue(av)
fallback(
$av.stringValue,
$av.boolValue,
number($av.intValue),
$av.doubleValue,
$av.bytesValue,
[for ($av.arrayValue.values) extract_anyvalue(.)],
{for ($av.kvlistValue.values) .key : extract_anyvalue(.value)}
)
@tustunkok
tustunkok / otel_metrics_to_flat.jslt
Created May 25, 2026 13:03
OTEL Metrics JSLT Parser
def extract_anyvalue(av)
fallback(
$av.stringValue,
$av.boolValue,
number($av.intValue),
$av.doubleValue,
$av.bytesValue,
[for ($av.arrayValue.values) extract_anyvalue(.)],
{for ($av.kvlistValue.values) .key : extract_anyvalue(.value)}
)
@tustunkok
tustunkok / otel_logs_to_flat.jslt
Created May 24, 2026 18:52
OTEL Logs JSLT Parser
def extract_anyvalue(av)
fallback(
$av.stringValue,
$av.boolValue,
number($av.intValue),
$av.doubleValue,
$av.bytesValue,
[for ($av.arrayValue.values) extract_anyvalue(.)],
{for ($av.kvlistValue.values) .key : extract_anyvalue(.value)}
)
@tustunkok
tustunkok / line_protocol_parser.groovy
Created February 13, 2025 18:24
A Groovy version of Line Protocol parser found in NiFi InfluxDB repository.
def removeEscaping(def value) {
return value.replaceAll("\\\\=", "=").replaceAll("\\\\,", ",").replaceAll("\\\\ ", " ")
}
enum EscapeMode {
NONE,
SIMPLE,
TEXT
}
@tustunkok
tustunkok / particle_swarm.py
Last active August 12, 2020 09:18
Particle Swarm Optimization implementation.
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 12 00:30:58 2018
@author: tustunkok
"""
import numpy as np
class ParticleSwarm: