modules

package
v0.0.0-...-6cfc1b2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

README

Create a new module

  1. Create a new module create a go package under backend/pkg/modules/internal
  2. Implement the backend/pkg/modules/internal/core.Module interface
  3. Create an init function and call the core.RegisterModule function that should do the initialization stems and return the module
  4. Create a openapi.yaml for the http handlers and generate the code using oapi-codegen
    1. Tip: create a gen.go file and add a //go:generate annotation for generating the server easier
  5. Add the import to the new module with underscore. Eg: _ "github.com/openclarity/apiclarity/backend/pkg/modules/internal/demo"

Create alerts

Alerts are a way to annotate an event to signal that it has issues. The alerts can be of 2 types: ALERT_INFO and ALERT_WARN

The alerts are just annotations and should be treated as such the core has the predefined alerts core.AlertInfoAnn and core.AlertWarnAnn

Example setting Alerts:

accessor.CreateAPIEventAnnotations(ctx, "module_name", 1, core.AlertInfoAnn)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewMockModulesManager  = core.NewMockModule
	NewMockBackendAccessor = core.NewMockBackendAccessor
)

Functions

func New

func New(ctx context.Context, dbHandler *database.Handler, clientset kubernetes.Interface, samplingManager *sampling.TraceSamplingManager, speculatorAccessor speculatoraccessor.SpeculatorsAccessor, notifier *notifier.Notifier, config *config.Config) (ModulesManager, []ModuleInfo, error)

Types

type Annotation

type Annotation = core.Annotation

type BackendAccessor

type BackendAccessor = core.BackendAccessor

type Event

type Event = core.Event

type MockBackendAccessor

type MockBackendAccessor = core.MockBackendAccessor

type MockModule

type MockModule = core.MockModule

type ModuleInfo

type ModuleInfo = core.ModuleInfo

type ModulesManager

type ModulesManager = core.Module //nolint:revive

Directories

Path Synopsis
internal
bfla/bfladetector
Package bfladetector is a generated GoMock package.
Package bfladetector is a generated GoMock package.
bfla/recovery
Package recovery is a generated GoMock package.
Package recovery is a generated GoMock package.
bfla/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
core
Package core is a generated GoMock package.
Package core is a generated GoMock package.
demo
Package demo provides primitives to interact with the openapi HTTP API.
Package demo provides primitives to interact with the openapi HTTP API.
fuzzer/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
spec_differ
nolint: revive,stylecheck
nolint: revive,stylecheck
spec_differ/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
specreconstructor/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.
traceanalyzer/restapi
Package restapi provides primitives to interact with the openapi HTTP API.
Package restapi provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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