Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ vendor/
build/
__pycache__
site/
local*.sh
7 changes: 4 additions & 3 deletions principal/redisproxy/redisproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,11 @@ func extractAgentNameFromRedisCommandKey(redisKey string, logCtx *logrus.Entry)
namespaceAndName := splitByPipe[2]

// It is not possible to create a namespace name containing a '_' value, so this is a correct delimiter
// If the namespace/name doesn't contain '_', it's a classic (non-agent-managed) application
// and should be forwarded to principal redis
if !strings.Contains(namespaceAndName, "_") {
errMsg := fmt.Sprintf("unexpected lack of '_' namespace/name separate: '%s'", redisKey)
logCtx.Error(errMsg)
return "", fmt.Errorf("%s", errMsg)
logCtx.Debugf("Redis key without agent prefix detected: '%s'. Routing to principal redis.", redisKey)
return "", nil
}

// namespace is the agent name
Expand Down
8 changes: 4 additions & 4 deletions principal/redisproxy/redisproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ func Test_extractAgentNameFromRedisCommandKey(t *testing.T) {
errorExpected: false,
},
{
name: "'app|managed-resources' with only namespace",
name: "'app|managed-resources' with only namespace (classic app without agent prefix)",
key: "app|managed-resources|my-app|1.8.3",
value: "",
errorExpected: true,
errorExpected: false,
},
{
name: "'app|resources-tree' with only namespace",
name: "'app|resources-tree' with only namespace (classic app without agent prefix)",
key: "app|resources-tree|my-app|1.8.3.gz",
value: "",
errorExpected: true,
errorExpected: false,
},
{
name: "'app|resources-tree' with unexpected field format",
Expand Down