Skip to content

Instantly share code, notes, and snippets.

View skhalash's full-sized avatar

Stanislav Khalash skhalash

View GitHub Profile
// eBPF section named socket, indicating that it is intended for socket handling
SET("socket")
int socket_handler(struct __sk_buff *skb)
{
struct so_event *e;
__u8 verlen;
__u16 proto;
__u32 nhoff = ETH_HLEN;
__u32 ip_proto = 0;
__u32 tcp_hdr_len = 0;
@skhalash
skhalash / logging.go
Created January 19, 2024 09:26
Logging Middleware for Event Handlers
type logger struct {
next handler.EventHandler
}
func log(next handler.EventHandler) handler.EventHandler {
return &logger{next: next}
}
// Implement handler.EventHandler interface
func (l *logger) Create(ctx context.Context, evt event.CreateEvent, q workqueue.RateLimitingInterface) {
@skhalash
skhalash / loki-ingestion-rate.sh
Last active October 21, 2021 13:49
Calculate max Loki ingestion rate in Kyma
#!/bin/sh
prometheus_port=9090
host_port=$(( ((RANDOM<<15)|RANDOM) % 49152 + 10000))
kubectl port-forward prometheus-monitoring-prometheus-0 -n kyma-system $host_port:$prometheus_port >/dev/null 2>&1 &
pid=$!
until nc -z localhost $host_port
do
sleep 1