Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fix(dlq): dlq listing api not using the right prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
StewartJingga committed Oct 24, 2023
1 parent 9e4de5b commit c35a0c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/server/v1/dlq/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (h *Handler) ListFirehoseDLQ(w http.ResponseWriter, r *http.Request) {
}
// check the variables for dlq related config.
bucketName := conf.EnvVariables[firehose.ConfigDLQBucket]
directoryPrefix := conf.EnvVariables[firehose.ConfigDLQDirectoryPrefix]
directoryPrefix := buildDlqPrefixDirectory(conf.EnvVariables[firehose.ConfigDLQDirectoryPrefix], resp.GetResource().GetName())
topicDates, err := h.service.gcsClient.ListDlqMetadata(gcs.BucketInfo{
BucketName: bucketName,
Prefix: directoryPrefix,
Expand Down
7 changes: 7 additions & 0 deletions internal/server/v1/dlq/helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dlq

import "strings"

func buildDlqPrefixDirectory(template string, firehoseName string) string {
return strings.Replace(template, "{{ .name }}", firehoseName, 1)
}
3 changes: 1 addition & 2 deletions internal/server/v1/dlq/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"strconv"
"strings"

entropyv1beta1 "buf.build/gen/go/gotocompany/proton/protocolbuffers/go/gotocompany/entropy/v1beta1"
"github.com/go-openapi/strfmt"
Expand Down Expand Up @@ -68,7 +67,7 @@ func enrichDlqJob(job *models.DlqJob, res *entropyv1beta1.Resource) error {
dataType := envs["INPUT_SCHEMA_PROTO_CLASS"]
groupID := firehoseLabels["group"]
groupSlug := firehoseLabels["team"]
dlqPrefixDirectory := strings.Replace(envs["DLQ_GCS_DIRECTORY_PREFIX"], "{{ .name }}", res.Name, 1)
dlqPrefixDirectory := buildDlqPrefixDirectory(envs["DLQ_GCS_DIRECTORY_PREFIX"], res.Name)
metricStatsDTag := fmt.Sprintf(
"namespace=%s,app=%s,sink=%s,team=%s,proto=%s,firehose=%s",
namespace,
Expand Down

0 comments on commit c35a0c7

Please sign in to comment.