TINE Docs
GitHub
  • Highlights
  • TINE
    • Install
  • GETTING STARTED
    • Quick start
    • Concept
      • Multiple Inlets and Outlets
      • Merge Records
      • Pipeline as Http Handler
    • Log config
  • Embedding TINE in Go
    • Use Recipe
    • Use API
  • Plugins
    • Inlets
    • Flows
    • Outlets
    • Extras
  • RECIPES
    • QRCode Generator
    • OLLAMA
    • OLLAMA Telegram Bot
    • Web Page Snapshot
    • Syslog Receiver
    • SQLite
    • RRD
Powered by GitBook
On this page
Edit on GitHub
  1. Embedding TINE in Go

Use Recipe

Imports

import (
    github.com/OutOfBedlam/tine/engine
    _ github.com/OutOfBedlam/tine/plugins/base
    _ github.com/OutOfBedlam/tine/plugins/psutil
)

Whenever add new type of inlets, flows, outlets and codec, it should be imported. If this is too cumbersome, import all plugins at once.

import (
    github.com/OutOfBedlam/tine/engine
    _ github.com/OutOfBedlam/tine/plugins/all
)

Define pipeline

const pipelineRecipe = `
[[inlets.cpu]]
	interval = "3s"
[[flows.select]]
	includes = ["#_ts", "*"]
[[outlets.file]]
	format = "json"
	decimal = 2
`

Create a pipeline

pipeline, err := engine.New(engine.WithConfig(pipelineRecipe))

Start the pipeline

pipeline.Start()

The Start() function in the code snippet above initiates the pipeline execution but does not wait for it to complete. Instead, it spawns a goroutine by calling go pipeline.Run() and returns immediately. On the other hand, pipeline.Run() is a blocking function that waits until the pipeline finishes its execution before returning control.

PreviousLog configNextUse API

Last updated 9 months ago