Thanks to visit codestin.com
Credit goes to pkg.go.dev

ldplugins

package
v7.13.4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Overview

Package ldplugins allows for writing extensions to the LaunchDarkly client functionality for purposes such as telemetry.

A developer does not need to use this package in the typical operation of the LaunchDarkly SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationMetadata

type ApplicationMetadata struct {
	// A unique identifier representing the application where the LaunchDarkly SDK is running.
	ID string
	// A unique identifier representing the version of the application where the LaunchDarkly SDK is running.
	Version string
}

ApplicationMetadata contains metadata about the application where the LaunchDarkly SDK is running.

type EnvironmentMetadata

type EnvironmentMetadata struct {
	// Metadata about the SDK that is running the plugin.
	Sdk SdkMetadata
	// SDK key that was used to initialize the client.
	SdkKey string
	// Metadata about the application where the LaunchDarkly SDK is running.
	Application ApplicationMetadata
}

EnvironmentMetadata contains metadata about the environment where the plugin is running.

type HooksProvider

type HooksProvider interface {
	GetHooks(metadata EnvironmentMetadata) []ldhooks.Hook
}

HooksProvider is composed of methods that are called to retrieve hooks provided by the Plugin.

type Metadata

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

Metadata contains information about a specific plugin implementation.

func NewMetadata

func NewMetadata(name string, opts ...MetadataOption) Metadata

NewMetadata creates Metadata with the provided name.

func (Metadata) Name

func (m Metadata) Name() string

Name gets the name of the plugin implementation.

type MetadataOption

type MetadataOption func(metadata *Metadata)

MetadataOption represents a functional means of setting additional, optional, attributes of the Metadata.

type Plugin

type Plugin interface {
	Metadata() Metadata
	Register(client interfaces.LDClientInterface, metadata EnvironmentMetadata)
	HooksProvider
}

A Plugin is used to extend the functionality of the SDK.

In order to avoid implementing unused methods, as well as easing maintenance of compatibility, implementors should compose the `Unimplemented`.

type MyPlugin struct {
  ldplugins.Unimplemented
}

type SdkMetadata

type SdkMetadata struct {
	// The name of the SDK.
	Name string
	// The version of the SDK.
	Version string
	// If this is a wrapper SDK, then this is the name of the wrapper.
	WrapperName string
	// If this is a wrapper SDK, then this is the version of the wrapper.
	WrapperVersion string
}

SdkMetadata contains metadata about the SDK that is running the plugin.

type Unimplemented

type Unimplemented struct {
}

Unimplemented implements all Plugin methods with empty functions. Plugin implementors should use this to avoid having to implement empty methods and to ease updates when the Plugin interface is extended.

type MyPlugin struct {
  ldplugins.Unimplemented
}

The plugin should implement Metadata and Register.

func (Unimplemented) GetHooks

GetHooks is a default implementation of the GetHooks method.

Jump to

Keyboard shortcuts

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