Skip to content

Instantly share code, notes, and snippets.

View albertored's full-sized avatar

Alberto Sartori albertored

View GitHub Profile
@albertored
albertored / ProtoBuf-HTTP.md
Last active August 16, 2023 15:31
Wireshark dissector for ProtoBuf over HTTP (application/x-protobuf content-type)

In OpenTelemetry one of the ways for exchanging telemetry data between different services is using Protocol Buffers over HTTP, see OTLP/HTTP.

If it is needed to debug this sharing of information one can think about sniffing the traffic with a tool like Wireshark. For doing so Wireshark should be able to know which ProtoBuf message type to use for the decoding. Since there is no such a feature built in (only for ProtoBuf over UDP) we should use a custom dissector.

The custom dissector is a .lua script that should be saved in Wireshark config directory (personal or global), the contents are attached here. The mapping for the message type is based on the HTTP request path (but the dissector can be customized for having different behaviours), this mapping is exposed as a preference on the UI (see figure).

In order for

@albertored
albertored / broadway_heartbeat.ex
Created November 4, 2021 08:15
Dynamic visibility timeout for Broadway SQS Client
defmodule MyApp.Broadway.Heartbeat do
use GenServer, restart: :transient
alias Broadway.Message
def start_link(%Message{} = message) do
state = %{
rh: extract_message_receipt_handle(message),
id: extract_message_id(message),
gid: extract_message_group_id(message),