Documentation
¶
Index ¶
- Constants
- func CountAttachedProxiedRequestMetricPartitions(ctx context.Context, db *bun.DB) (int64, error)
- func GetLastCreatedAttachedProxiedRequestMetricsPartitionName(ctx context.Context, db *bun.DB) (string, error)
- func Migrate(ctx context.Context, db *bun.DB, migrations migrate.Migrations, ...) (*migrate.MigrationSlice, error)
- type PostgresClient
- type PostgresDatabaseConfig
- type ProxiedRequestMetric
Constants ¶
const (
ProxiedRequestMetricsTableName = "proxied_request_metrics"
)
Variables ¶
This section is empty.
Functions ¶
func CountAttachedProxiedRequestMetricPartitions ¶
CountAttachedProxiedRequestMetricPartitions returns the current count of attached partitions for the ProxiedRequestMetricsTableName and error (if any)
func GetLastCreatedAttachedProxiedRequestMetricsPartitionName ¶
func GetLastCreatedAttachedProxiedRequestMetricsPartitionName(ctx context.Context, db *bun.DB) (string, error)
GetLastCreatedAttachedProxiedRequestMetricsPartitionName gets the table name for the last created (and attached) proxied request metrics partition
func Migrate ¶
func Migrate(ctx context.Context, db *bun.DB, migrations migrate.Migrations, logger *logging.ServiceLogger) (*migrate.MigrationSlice, error)
Migrate sets up and runs all migrations in the migrations model that haven't been run on the database being used by the proxy service returning error (if any) and a list of migrations that have been run and any that were not
Types ¶
type PostgresClient ¶
PostgresClient wraps a connection to a postgres database
func NewPostgresClient ¶
func NewPostgresClient(config PostgresDatabaseConfig) (PostgresClient, error)
NewPostgresClient returns a new connection to the specified postgres data and error (if any)
func (*PostgresClient) HealthCheck ¶
func (pg *PostgresClient) HealthCheck() error
HealthCheck returns an error if the database can not be connected to and queried, nil otherwise
type PostgresDatabaseConfig ¶
type PostgresDatabaseConfig struct {
DatabaseName string
DatabaseEndpointURL string
DatabaseUsername string
DatabasePassword string
ReadTimeoutSeconds int64
WriteTimeousSeconds int64
DatabaseMaxIdleConnections int64
DatabaseConnectionMaxIdleSeconds int64
DatabaseMaxOpenConnections int64
SSLEnabled bool
QueryLoggingEnabled bool
RunDatabaseMigrations bool
Logger *logging.ServiceLogger
}
PostgresDatabaseConfig contains values for creating a new connection to a postgres database
type ProxiedRequestMetric ¶
type ProxiedRequestMetric struct {
bun.BaseModel `bun:"table:proxied_request_metrics,alias:prm"`
ID int64 `bun:",pk,autoincrement"`
MethodName string
BlockNumber *int64
ResponseLatencyMilliseconds int64
Hostname string
RequestIP string `bun:"request_ip"`
RequestTime time.Time
UserAgent *string
Referer *string
Origin *string
}
ProxiedRequestMetric contains request metrics for a single request proxied by the proxy service
func ListProxiedRequestMetricsWithPagination ¶
func ListProxiedRequestMetricsWithPagination(ctx context.Context, db *bun.DB, cursor int64, limit int) ([]ProxiedRequestMetric, int64, error)
ListProxiedRequestMetricsWithPagination returns a page of max `limit` ProxiedRequestMetrics from the offset specified by`cursor` error (if any) along with a cursor to use to fetch the next page if the cursor is 0 no more pages exists
Directories
¶
| Path | Synopsis |
|---|---|
|
when this package is loaded the package directory will be searched for any go or sql migration files and register for them to the proxy service to run https://bun.uptrace.dev/guide/migrations.html#go-based-migrations
|
when this package is loaded the package directory will be searched for any go or sql migration files and register for them to the proxy service to run https://bun.uptrace.dev/guide/migrations.html#go-based-migrations |