Skip to content

Instantly share code, notes, and snippets.

@adleong
adleong / tracing.yml
Created August 14, 2019 23:05
OpenCensus tracing demo
---
apiVersion: v1
kind: Namespace
metadata:
name: tracing
---
apiVersion: v1
kind: ConfigMap
metadata:
name: oc-agent-conf
@adleong
adleong / gist:cad31555cc4e8ddd892f02e38e378456
Created March 28, 2019 18:35
Decoding gRPC messages from Wireshark
Look at the contents of a data frame: copy data as raw (to paste buffer)
```
pbpaste | cut -c 11- | xxd -r -p | protoc --raw_decode
```
Drop the first 10 characters (first 5 bytes: the gRPC frame header), encode as binary, decode as raw protobuf.
You won't see field names, but you will get field numbers.
Try to match the field numbers and types to known protobuf message types using your brain.
# HELP request_total Total count of HTTP requests.
# TYPE request_total counter
request_total{authority="web-svc.emojivoto.svc.cluster.local",direction="inbound",tls="true",client_id="vote-bot.deployment.emojivoto.linkerd-managed.linkerd.svc.cluster.local"} 618981
request_total{authority="emoji-svc.emojivoto.svc.cluster.local:8080",direction="outbound",dst_control_plane_ns="linkerd",dst_deployment="emoji",dst_namespace="emojivoto",dst_pod="emoji-dddd8f4b-rt8vj",dst_pod_template_hash="dddd8f4b",dst_service="emoji-svc",tls="true",server_id="emoji.deployment.emojivoto.linkerd-managed.linkerd.svc.cluster.local"} 620586
request_total{authority="voting-svc.emojivoto.svc.cluster.local:8080",direction="outbound",dst_control_plane_ns="linkerd",dst_deployment="voting",dst_namespace="emojivoto",dst_pod="voting-694d7cd777-n6mwj",dst_pod_template_hash="694d7cd777",dst_service="voting-svc",tls="true",server_id="voting.deployment.emojivoto.linkerd-managed.linkerd.svc.cluster.local"} 310292
request_total{authority="linkerd.i
Mahkani spice mix:
* 3 tbps curry powder
* 1 tsp garam masala
* 1 tsp coriander
* 1 tsp paprika (smoked, if possible)
* 2 cinamon sticks, snapped in half
Ingredients:
* Mahkani spice mix
* Rice
@adleong
adleong / booksapp.yml
Created December 10, 2018 22:16
updated books app
---
apiVersion: v1
kind: Service
metadata:
name: webapp
spec:
selector:
app: webapp
type: LoadBalancer
ports:
// Base Var
alex-boron@ val base = Var(1)
base: Var[Int] with Updatable[Int] with Extractable[Int] = Var(1)@848564270
// Derived Var using map (or flatMap, etc)
alex-boron@ val mapped = base.map { x => println("applying map"); x * 2 }
mapped: Var[Int] = com.twitter.util.Var$$anon$2@5d00e30e
// Observing the derived Var causes the map to be applied for each new observation
alex-boron@ val closable = mapped.changes.respond(println)
@adleong
adleong / gist:633ac4e6eb88f59621b3d5e1d1e37102
Last active February 10, 2017 01:35
example prometheus metrics
jvm:start_time{type="gauge"} 1.48668993E12
jvm:application_time_millis{type="gauge"} 144758.55
jvm:classes:total_loaded{type="gauge"} 20226.0
jvm:classes:current_loaded{type="gauge"} 20209.0
jvm:classes:total_unloaded{type="gauge"} 17.0
jvm:postGC:Par_Survivor_Space:max{type="gauge"} 2621440.0
jvm:postGC:Par_Survivor_Space:used{type="gauge"} 0.0
jvm:postGC:CMS_Old_Gen:max{type="gauge"} 1.79856998E9
jvm:postGC:CMS_Old_Gen:used{type="gauge"} 4.4330304E8
jvm:postGC:Par_Eden_Space:max{type="gauge"} 3.43670784E8