fact_go_client

package module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 20 Imported by: 0

README

Fact-Go-Client

This library is a go based client implementation for Fact.

Usage:

package main

import (
	"encoding/json"
	fact "github.com/faas-facts/fact-go-client"
	"net/http"
)

var client *fact.FactClient

func init() {
	client = &fact.FactClient{}
	client.Boot(fact.FactClientConfig{
		SendOnUpdate:       false,
		IncludeEnvironment: false,
	})
}

//Faas Function handler (e.g. GCF)
func ServeHTTP(w http.ResponseWriter, req http.Request) {
	client.Start(nil, req)
	//...
	client.Update(nil, "some important event")
	//...
	t := client.Done(nil)
	b, _ := json.Marshal(t)
	_, _ = w.Write(b)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACFInspector

type ACFInspector struct {
	GenericInspector
}

func (ACFInspector) Init

func (A ACFInspector) Init(trace *fact.Trace)

func (ACFInspector) Name

func (A ACFInspector) Name() string

type AWSInspector

type AWSInspector struct {
	GenericInspector
	// contains filtered or unexported fields
}

func (*AWSInspector) Collect

func (A *AWSInspector) Collect(trace fact.Trace, ctx interface{}) fact.Trace

func (*AWSInspector) Init

func (A *AWSInspector) Init(trace *fact.Trace)

func (AWSInspector) Name

func (A AWSInspector) Name() string

type ConsoleLogger

type ConsoleLogger struct{}

func (ConsoleLogger) Connect

func (c ConsoleLogger) Connect(m map[string]string) error

func (ConsoleLogger) Send

func (c ConsoleLogger) Send(trace fact.Trace) error

type FactClient

type FactClient struct {
	// contains filtered or unexported fields
}

func (*FactClient) Boot

func (fc *FactClient) Boot(conf FactClientConfig)

func (*FactClient) Done

func (fc *FactClient) Done(context interface{}, msg *string, args ...string) fact.Trace

func (*FactClient) Parent

func (fc *FactClient) Parent(parent string)

func (*FactClient) Start

func (fc *FactClient) Start(context interface{}, event interface{})

func (*FactClient) Update

func (fc *FactClient) Update(context interface{}, msg *string, tags map[string]string)

type FactClientConfig

type FactClientConfig struct {
	Platform           *string
	Receiver           *ReceiverType
	SendOnUpdate       bool
	IncludeEnvironment bool
	IOArgs             map[string]string
}

type FactReceiver

type FactReceiver interface {
	Connect(map[string]string) error
	Send(trace fact.Trace) error
}

type GCFInspector

type GCFInspector struct {
	GenericInspector
}

func (GCFInspector) Collect

func (G GCFInspector) Collect(trace fact.Trace, context interface{}) fact.Trace

func (GCFInspector) Init

func (G GCFInspector) Init(trace *fact.Trace)

func (GCFInspector) Name

func (G GCFInspector) Name() string

type GenericInspector

type GenericInspector struct {
}

func (GenericInspector) Collect

func (g GenericInspector) Collect(trace fact.Trace, context interface{}) fact.Trace

func (GenericInspector) Init

func (g GenericInspector) Init(trace *fact.Trace)

func (GenericInspector) Name

func (g GenericInspector) Name() string

type ICFInspector

type ICFInspector struct {
	OWInspector
}

func (ICFInspector) Collect

func (O ICFInspector) Collect(trace fact.Trace, context interface{}) fact.Trace

func (ICFInspector) Init

func (O ICFInspector) Init(trace *fact.Trace)

func (ICFInspector) Name

func (O ICFInspector) Name() string

type Inspector

type Inspector interface {
	Name() string
	Init(trace *fact.Trace)
	Collect(trace fact.Trace, context interface{}) fact.Trace
}

type OWInspector

type OWInspector struct {
	GenericInspector
}

func (OWInspector) Init

func (O OWInspector) Init(trace *fact.Trace)

func (OWInspector) Name

func (O OWInspector) Name() string

type ReceiverType

type ReceiverType int
const (
	Console ReceiverType = iota
	TCP
)

type TCPLogger

type TCPLogger struct {
	// contains filtered or unexported fields
}

func (*TCPLogger) Connect

func (T *TCPLogger) Connect(m map[string]string) error

func (*TCPLogger) Send

func (T *TCPLogger) Send(trace fact.Trace) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL