logdog

package
v0.0.0-...-b779d65 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 31 Imported by: 5

Documentation

Overview

Package logdog implements output to a Logdog server via PubSub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scopes

func Scopes() []string

Scopes returns the set of OAuth scopes required for this Output.

Types

type Auth

type Auth interface {
	// Project is the current project taken from LUCI_CONTEXT (or "").
	Project() string
	// Realm is the current realm taken from LUCI_CONTEXT (or "").
	Realm() string
	// RPC returns an authenticator to use for RegisterPrefix RPC call.
	RPC() *auth.Authenticator
	// PubSub returns an authenticator to use for PubSub calls.
	PubSub() *auth.Authenticator
}

Auth incapsulates an authentication scheme to use.

Construct it using either LegacyAuth() or RealmsAwareAuth().

func LegacyAuth

func LegacyAuth(a *auth.Authenticator) Auth

LegacyAuth returns an authentication scheme with pre-realms logic.

Will be eventually removed once all call sites are aware of realms.

func RealmsAwareAuth

func RealmsAwareAuth(ctx context.Context) (Auth, error)

RealmsAwareAuth returns an authentication scheme with realms-aware logic.

The given context will be used to:

  1. Grab the current realm name from LUCI_CONTEXT.
  2. Construct a transport that uses the default account for auth (thus the context should have the default task account selected in it).
  3. Switch into "system" local account and construct a transport that uses this account for PubSub calls.

If there's no realm in the context, degrades to LegacyAuth using the "system" local account for all calls, as was the way before the realms mode.

type Config

type Config struct {
	// Auth incapsulates an authentication scheme to use.
	//
	// Construct it using either LegacyAuth() or RealmsAwareAuth().
	Auth Auth

	// Host is the name of the LogDog Host to connect to.
	Host string

	// Project is the project that this stream belongs to.
	Project string
	// Prefix is the stream prefix to register.
	Prefix types.StreamName
	// PrefixExpiration is the prefix expiration to use when registering.
	// If zero, no expiration will be expressed to the Coordinator, and it will
	// choose based on its configuration.
	PrefixExpiration time.Duration

	// SourceInfo, if not empty, is auxiliary source information to register
	// alongside the stream.
	SourceInfo []string

	// PublishContext is the special Context to use for publishing messages. If
	// nil, the Context supplied to Register will be used.
	//
	// This is useful when the Context supplied to Register responds to
	// cancellation (e.g., user sends SIGTERM), but we might not want to
	// immediately cancel pending publishes due to flushing.
	PublishContext context.Context

	// RPCTimeout, if > 0, is the timeout to apply to an individual RPC.
	RPCTimeout time.Duration
}

Config is the set of configuration parameters for this Output instance.

func (*Config) Register

func (cfg *Config) Register(c context.Context) (output.Output, error)

Register registers the supplied Prefix with the Coordinator. Upon success, an Output instance bound to that stream will be returned.

Jump to

Keyboard shortcuts

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