Skip to content

Commit

Permalink
Added README
Browse files Browse the repository at this point in the history
  • Loading branch information
Timidger committed Jun 20, 2019
0 parents commit d23c530
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target
**/*.rs.bk
Cargo.lock
example/target/
*.so
*.a
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Telegraf Rust Plugin

Allowing you to write telegraf plugins in Rust.

## Adding to a project

Copy `makefile-template.toml` and `lib.go` from this project into the root of
your project directory.

Edit the `makefile-template.toml` script, specifically the location of where
your static library is built. Make sure to change your project to build a static
library with `crate_type = ["staticlib"]` in your `Cargo.toml`!

## How this works

Using some glue Go code a ["go plugin" ](https://golang.org/pkg/plugin/)
is generated to be used in telegraf. Rust talks to the Go using C FFI and is
statically linked into the resulting dynamic library.

A cargo make script is necessary because `go` needs to build the final artifact.
It generates magic in its `.so` that allows other Go code to load it at runtime.

0 comments on commit d23c530

Please sign in to comment.