4 ms·
Wait... so... it’s just a library... served as an API?
by king_magic 6y ago
Wait... so... it’s just a library... served as an API?
- harpratap 6y agoA library needs to be of the same language, sidecars can be polyglot. You can use a golang based sidecar with a python app, can't do that with a library.
- sethammons 6y agoWe have exactly that for a sidecar on one of our team’s k8s clusters. There is a legacy python 2.6 twisted service. It will not get priority to be updated (functionality is being slowly eroded into other services). It exposes its metrics in a non-standard way and updating it to emit to Prometheus was going to be non-trivial. Enter the sidecar. It lives next to each instance and scrapes the metrics and converts them over for Prometheus to consume, and happens to be written in Go. It was developed and released in a day or two.
- king_magic 6y agoRight - I guess I just don't think that just because sidecars can be polyglot doesn't make it a better approach than just writing a clean library.
- closeparen 6y agoLet's say you want to add auth tokens and/or TLS to an environment with a lot of heterogeneous legacy code in 6 different languages.
- tbrownaw 6y agohttps://morioh.com/p/e58a77b1d33b https://morioh.com/p/e58a77b1d33b The talk shows how to use CGO to make Go code available as a C library and then to use Cython to make this library available as a Python extension module.
- closeparen 6y agoWe actually tried this. The Go runtime really does not like to be embedded in Python. When Python forks, as for example Celery likes to do, Go deadlocks. Also had serious troubles with provenance, versioning, and compatibility of the C artifacts. Somewhere along the line there were magic hex numbers. It was a nightmare. The project was scrapped in favor of a sidecar.