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

Commit

Permalink
feat(firehose): added sink_type in labels to support entropy
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayushi Sharma committed Oct 13, 2023
1 parent 75d6205 commit 4cfeb0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/server/v1/firehose/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (api *firehoseAPI) handleCreate(w http.ResponseWriter, r *http.Request) {
labelTeam: groupSlug,
labelStream: *def.Configs.StreamName,
labelDescription: def.Description,
labelSinkType: def.Configs.EnvVars["SINK_TYPE"],
})

prj, err := project.GetProject(ctx, def.Project, api.Shield)
Expand Down Expand Up @@ -359,6 +360,7 @@ func (api *firehoseAPI) handlePartialUpdate(w http.ResponseWriter, r *http.Reque

if req.Configs.StreamName != "" {
existing.Configs.StreamName = &req.Configs.StreamName
labels[labelStream] = req.Configs.StreamName
}

if req.Configs.Replicas > 0 {
Expand All @@ -381,6 +383,10 @@ func (api *firehoseAPI) handlePartialUpdate(w http.ResponseWriter, r *http.Reque
}
}

if existing.Configs.EnvVars["SINK_TYPE"] != req.Configs.EnvVars["SINK_TYPE"] {
labels[labelSinkType] = req.Configs.EnvVars["SINK_TYPE"]
}

existing.Configs.EnvVars = cloneAndMergeMaps(
existing.Configs.EnvVars,
req.Configs.EnvVars,
Expand Down
1 change: 1 addition & 0 deletions internal/server/v1/firehose/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
labelTeam = "team"
labelStream = "stream_name"
labelDescription = "description"
labelSinkType = "sink_type"
)

var nonAlphaNumPattern = regexp.MustCompile("[^a-zA-Z0-9]+")
Expand Down

0 comments on commit 4cfeb0a

Please sign in to comment.