/plushcap/analysis/datadog/engineering-cgo-and-python

Cgo and Python

What's this blog post about?

The new Datadog Agent is written in Go, with Python used for checks. This is possible because the Datadog Agent embeds a CPython interpreter that can be called whenever it needs to execute Python code. Embedding Python in a Go application has several benefits, such as gradually moving portions of an existing Python project to a new language without losing any functionality during the process and reusing existing Python software or libraries without re-implementing them in the new language. The Global Interpreter Lock (GIL) poses a challenge when it comes to embedding Python, but solutions like explicitly invoking the GIL and using the LockOSThread function from the runtime package can help manage this issue.

Company
Datadog

Date published
April 16, 2018

Author(s)
Massimiliano Pippi

Word count
2452

Hacker News points
3

Language
English


By Matt Makai. 2021-2024.