mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
fixup! Disable caller as it's not necessary and generates slight delay.
This commit is contained in:
Vendored
+1
-1
@@ -15,10 +15,10 @@ type CacheConfig struct {
|
|||||||
Logger *libpack_logger.Logger
|
Logger *libpack_logger.Logger
|
||||||
Client CacheClient
|
Client CacheClient
|
||||||
Redis struct {
|
Redis struct {
|
||||||
Enable bool `json:"enable"`
|
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
DB int `json:"db"`
|
DB int `json:"db"`
|
||||||
|
Enable bool `json:"enable"`
|
||||||
}
|
}
|
||||||
TTL int `json:"ttl"`
|
TTL int `json:"ttl"`
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+3
-3
@@ -11,10 +11,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type RedisConfig struct {
|
type RedisConfig struct {
|
||||||
client *redis.Client
|
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
prefix string
|
client *redis.Client
|
||||||
builderPool *sync.Pool
|
builderPool *sync.Pool
|
||||||
|
prefix string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RedisConfig) prependKeyName(key string) string {
|
func (c *RedisConfig) prependKeyName(key string) string {
|
||||||
@@ -29,8 +29,8 @@ func (c *RedisConfig) prependKeyName(key string) string {
|
|||||||
type RedisClientConfig struct {
|
type RedisClientConfig struct {
|
||||||
RedisServer string
|
RedisServer string
|
||||||
RedisPassword string
|
RedisPassword string
|
||||||
RedisDB int
|
|
||||||
Prefix string
|
Prefix string
|
||||||
|
RedisDB int
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(redisClientConfig *RedisClientConfig) *RedisConfig {
|
func New(redisClientConfig *RedisClientConfig) *RedisConfig {
|
||||||
|
|||||||
+3
-3
@@ -42,16 +42,16 @@ const (
|
|||||||
var defaultOutput = os.Stdout
|
var defaultOutput = os.Stdout
|
||||||
|
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
|
output io.Writer
|
||||||
format string
|
format string
|
||||||
minLogLevel int
|
minLogLevel int
|
||||||
showCaller bool
|
showCaller bool
|
||||||
output io.Writer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type LogMessage struct {
|
type LogMessage struct {
|
||||||
Message string
|
|
||||||
Pairs map[string]any
|
|
||||||
output io.Writer
|
output io.Writer
|
||||||
|
Pairs map[string]any
|
||||||
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *LogMessage) String() string {
|
func (m *LogMessage) String() string {
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ func (suite *LoggerTestSuite) Test_LogsLevelsPrint() {
|
|||||||
logger := New().SetOutput(output)
|
logger := New().SetOutput(output)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
pairs map[string]any
|
||||||
name string
|
name string
|
||||||
method string
|
method string
|
||||||
|
message string
|
||||||
loggerMinLevel int
|
loggerMinLevel int
|
||||||
messageLogLevel int
|
messageLogLevel int
|
||||||
message string
|
wantOutput bool
|
||||||
pairs map[string]any
|
|
||||||
wantOutput bool // Whether we expect output to be written
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Log: Debug, Level: Debug - no pairs",
|
name: "Log: Debug, Level: Debug - no pairs",
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
// Cache for sorted label keys to avoid repeated sorting
|
// Cache for sorted label keys to avoid repeated sorting
|
||||||
var sortedLabelKeysCache = struct {
|
var sortedLabelKeysCache = struct {
|
||||||
sync.RWMutex
|
|
||||||
m map[string][]string
|
m map[string][]string
|
||||||
|
sync.RWMutex
|
||||||
}{m: make(map[string][]string)}
|
}{m: make(map[string][]string)}
|
||||||
|
|
||||||
func (ms *MetricsSetup) get_metrics_name(name string, labels map[string]string) string {
|
func (ms *MetricsSetup) get_metrics_name(name string, labels map[string]string) string {
|
||||||
|
|||||||
@@ -167,9 +167,9 @@ func TestEnsureDefaultLabels(t *testing.T) {
|
|||||||
libpack_config.PKG_NAME = "example_microservice"
|
libpack_config.PKG_NAME = "example_microservice"
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
|
||||||
inputLabels map[string]string
|
inputLabels map[string]string
|
||||||
expectedLabels map[string]string
|
expectedLabels map[string]string
|
||||||
|
name string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Nil labels",
|
name: "Nil labels",
|
||||||
|
|||||||
Reference in New Issue
Block a user