faker

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

faker

Faker models a cluster of nodes, where services are deployed, exposing an API that is used by clients to interact with.

Overview

graph LR
F[Frontend]-->A[API]
A-->B[Backend]
B-->C[Cache]
B-->D[DB]
sequenceDiagram
Frontend->>API: HTTP GET /
API->>Backend: gRPC Get()
Backend->>Cache: INCR counter
Cache-->>Backend: counter
Backend->>DB: SELECT * FROM table
DB-->>Backend: posts (psql)
Backend-->>API: posts (pb)
API-->>Frontend: posts (json)

Services

Frontend

Represents a web browser.

Static
  • IP address
  • User agent
  • Target web domain
Dynamic
  • External port
API

Represents a web server that exposes an HTTP API. Accepts an HTTP request, forwards it to backend via gRPC and returns the response in json format.

Static
  • IP address
  • Server
Dynamic
  • External port

Documentation

Overview

Package faker implement a fake telemetry generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

API represents API service configuration.

API service acts as an entrypoint and handles requests from clients, proxying them to Backend.

type Backend

type Backend struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

Backend handles requests from API service.

Backend service is used to process user requests from API. Handles business logic and uses database and cache services.

type Cache

type Cache struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

Cache represents cache service configuration.

Cache service is used by [Backend]for short term data storage with fast access.

Example: Redis.

type Config

type Config struct {
	// Number of nodes.
	Nodes int `json:"nodes" yaml:"nodes"`
	// Number of requests per second.
	RPS int `json:"rps" yaml:"rps"`
	// Services configuration.
	Services Services `json:"services" yaml:"services"`
	// Random number generator.
	Rand *rand.Rand
	// Factory for TracerProvider that can create providers from new
	TracerProviderFactory TracerProviderFactory
	// Factory for MeterProvider that can create providers from new
	MeterProviderFactory MeterProviderFactory
}

Config models a single cluster of multiple nodes, where services are deployed on each node.

Services are interacting with each other, generating telemetry.

Multiple clients are modeled, sending requests to the services.

type DB

type DB struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

DB represents database service configuration.

type Frontend

type Frontend struct {
	Replicas int `json:"replicas" yaml:"replicas"`
}

Frontend represents user web client configuration.

Frontend service sends requests to API on behalf of the user.

type MeterProviderFactory added in v0.1.0

type MeterProviderFactory interface {
	New(...metric.Option) *metric.MeterProvider
}

MeterProviderFactory is a factory for MeterProvider.

type Router

type Router interface {
	Frontend(ctx context.Context)
	API(ctx context.Context)
	Backend(ctx context.Context)
	Cache(ctx context.Context)
	DB(ctx context.Context)
}

Router routes request to services.

type Services

type Services struct {
	API      API      `json:"api" yaml:"api"`
	Backend  Backend  `json:"backend" yaml:"backend"`
	Frontend Frontend `json:"frontend" yaml:"frontend"`
	DB       DB       `json:"db" yaml:"db"`
	Cache    Cache    `json:"cache" yaml:"cache"`
}

Services wraps all services configuration, describing topology of the cluster and load.

type TracerProviderFactory added in v0.1.0

type TracerProviderFactory interface {
	New(...tracesdk.TracerProviderOption) *tracesdk.TracerProvider
}

TracerProviderFactory is a factory for TracerProvider.

Jump to

Keyboard shortcuts

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