mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-20 06:28:13 +00:00
Gofmt the codebase.
This commit is contained in:
Vendored
+3
-3
@@ -17,8 +17,8 @@ const CompressionThreshold = 1024 // 1KB
|
|||||||
const MaxCacheSize = 10000
|
const MaxCacheSize = 10000
|
||||||
|
|
||||||
type CacheEntry struct {
|
type CacheEntry struct {
|
||||||
ExpiresAt time.Time
|
ExpiresAt time.Time
|
||||||
Value []byte
|
Value []byte
|
||||||
Compressed bool
|
Compressed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ func (c *Cache) CleanExpiredEntries() {
|
|||||||
// evictOldest removes the oldest n entries from the cache
|
// evictOldest removes the oldest n entries from the cache
|
||||||
func (c *Cache) evictOldest(n int) {
|
func (c *Cache) evictOldest(n int) {
|
||||||
type keyExpiry struct {
|
type keyExpiry struct {
|
||||||
key string
|
key string
|
||||||
expiresAt time.Time
|
expiresAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cfg *config
|
cfg *config
|
||||||
cfgMutex sync.RWMutex
|
cfgMutex sync.RWMutex
|
||||||
once sync.Once
|
once sync.Once
|
||||||
tracer *libpack_tracing.TracingSetup
|
tracer *libpack_tracing.TracingSetup
|
||||||
)
|
)
|
||||||
|
|
||||||
// getDetailsFromEnv retrieves the value from the environment or returns the default.
|
// getDetailsFromEnv retrieves the value from the environment or returns the default.
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ func extractUserInfo(c *fiber.Ctx) (string, string) {
|
|||||||
|
|
||||||
// Extract from JWT if available
|
// Extract from JWT if available
|
||||||
if authorization := c.Get("Authorization"); authorization != "" &&
|
if authorization := c.Get("Authorization"); authorization != "" &&
|
||||||
(len(cfg.Client.JWTUserClaimPath) > 0 || len(cfg.Client.JWTRoleClaimPath) > 0) {
|
(len(cfg.Client.JWTUserClaimPath) > 0 || len(cfg.Client.JWTRoleClaimPath) > 0) {
|
||||||
extractedUserID, extractedRoleName = extractClaimsFromJWTHeader(authorization)
|
extractedUserID, extractedRoleName = extractClaimsFromJWTHeader(authorization)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,6 +217,7 @@ func handleCaching(c *fiber.Ctx, parsedResult *parseGraphQLQueryResult, userID s
|
|||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// proxyAndCacheTheRequest proxies and caches the request if needed.
|
// proxyAndCacheTheRequest proxies and caches the request if needed.
|
||||||
func proxyAndCacheTheRequest(c *fiber.Ctx, queryCacheHash string, cacheTime int, currentEndpoint string) error {
|
func proxyAndCacheTheRequest(c *fiber.Ctx, queryCacheHash string, cacheTime int, currentEndpoint string) error {
|
||||||
if err := proxyTheRequest(c, currentEndpoint); err != nil {
|
if err := proxyTheRequest(c, currentEndpoint); err != nil {
|
||||||
|
|||||||
+2
-2
@@ -68,8 +68,8 @@ func NewTracing(ctx context.Context, endpoint string) (*TracingSetup, error) {
|
|||||||
semconv.DeploymentEnvironment("production"),
|
semconv.DeploymentEnvironment("production"),
|
||||||
attribute.String("application.type", "proxy"),
|
attribute.String("application.type", "proxy"),
|
||||||
),
|
),
|
||||||
resource.WithHost(), // Add host information
|
resource.WithHost(), // Add host information
|
||||||
resource.WithOSType(), // Add OS information
|
resource.WithOSType(), // Add OS information
|
||||||
resource.WithProcessPID(), // Add process information
|
resource.WithProcessPID(), // Add process information
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user