Skip to content

Commit

Permalink
Converter integrations next wired in to the UI and backend (#188)
Browse files Browse the repository at this point in the history
* update agent version

Signed-off-by: erikbaranowski <[email protected]>

* fix go.mod

document how to test out the local API server and convert feature

Signed-off-by: erikbaranowski <[email protected]>

* update agent version (#186)

Signed-off-by: erikbaranowski <[email protected]>

* wire in Grafana Agent Static Integrations Next for the converter feature

Signed-off-by: erikbaranowski <[email protected]>

---------

Signed-off-by: erikbaranowski <[email protected]>
  • Loading branch information
erikbaranowski authored Feb 1, 2024
1 parent 7a4a633 commit a1af550
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ func convert(w http.ResponseWriter, r *http.Request) {
http.Error(w, fmt.Sprintf("decoding request: %s", err.Error()), http.StatusBadRequest)
return
}
out, diag := converter.Convert([]byte(cr.Data), cr.Type, nil)

var extraArgs []string = nil
if cr.Type == "static integrations-next" {
cr.Type = "static"
extraArgs = []string{"-enable-features", "integrations-next", "-config.expand-env"}
}

out, diag := converter.Convert([]byte(cr.Data), cr.Type, extraArgs)
json.NewEncoder(w).Encode(ConversionResponse{
Data: string(out),
Diagnostics: diag,
Expand Down
6 changes: 5 additions & 1 deletion src/components/Converter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useModelContext } from "../../state";
import { Controller, FormProvider, useForm } from "react-hook-form";
import { useMemo, useState } from "react";

type InputType = "prometheus" | "promtail" | "static";
type InputType = "prometheus" | "promtail" | "static" | "static integrations-next";

interface Diagnostic {
Severity: number;
Expand Down Expand Up @@ -116,6 +116,10 @@ const Converter = ({ dismiss }: { dismiss: () => void }) => {
label: "Grafana Agent Static",
value: "static",
},
{
label: "Grafana Agent Static Integrations Next",
value: "static integrations-next",
},
{
label: "Prometheus",
value: "prometheus",
Expand Down

0 comments on commit a1af550

Please sign in to comment.