forked from grafana/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial wiring agent integration for integration-next (grafana#5638)
* initial wiring agent integration for integration-next Signed-off-by: erikbaranowski <[email protected]> --------- Signed-off-by: erikbaranowski <[email protected]>
- Loading branch information
1 parent
c0a75ec
commit fdf7dcb
Showing
8 changed files
with
172 additions
and
21 deletions.
There are no files selected for viewing
22 changes: 11 additions & 11 deletions
22
converter/internal/staticconvert/internal/build/agent_exporter.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
package build | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/grafana/agent/component/discovery" | ||
"github.com/grafana/agent/component/prometheus/exporter/agent" | ||
"github.com/grafana/agent/converter/internal/common" | ||
agent_exporter "github.com/grafana/agent/pkg/integrations/agent" | ||
agent_exporter_v2 "github.com/grafana/agent/pkg/integrations/v2/agent" | ||
) | ||
|
||
func (b *IntegrationsConfigBuilder) appendAgentExporter(config *agent_exporter.Config) discovery.Exports { | ||
args := toAgentExporter(config) | ||
compLabel := common.LabelForParts(b.globalCtx.LabelPrefix, config.Name()) | ||
b.f.Body().AppendBlock(common.NewBlockWithOverride( | ||
[]string{"prometheus", "exporter", "agent"}, | ||
compLabel, | ||
args, | ||
)) | ||
|
||
return common.NewDiscoveryExports(fmt.Sprintf("prometheus.exporter.agent.%s.targets", compLabel)) | ||
return b.appendExporterBlock(args, config.Name(), "agent") | ||
} | ||
|
||
func toAgentExporter(config *agent_exporter.Config) *agent.Arguments { | ||
return &agent.Arguments{} | ||
} | ||
|
||
func (b *IntegrationsConfigBuilder) appendAgentExporterV2(config *agent_exporter_v2.Config) discovery.Exports { | ||
args := toAgentExporterV2(config) | ||
return b.appendExporterBlock(args, config.Name(), "agent") | ||
} | ||
|
||
func toAgentExporterV2(config *agent_exporter_v2.Config) *agent.Arguments { | ||
return &agent.Arguments{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
prometheus.remote_write "metrics_default" { | ||
endpoint { | ||
name = "default-8be96f" | ||
url = "http://localhost:9009/api/prom/push" | ||
|
||
queue_config { } | ||
|
||
metadata_config { } | ||
} | ||
} | ||
|
||
prometheus.exporter.agent "integrations_agent" { } | ||
|
||
discovery.relabel "integrations_agent" { | ||
targets = prometheus.exporter.agent.integrations_agent.targets | ||
|
||
rule { | ||
source_labels = ["__address__"] | ||
target_label = "test_label" | ||
replacement = "test_label_value" | ||
} | ||
|
||
rule { | ||
source_labels = ["__address__"] | ||
target_label = "test_label_2" | ||
replacement = "test_label_value_2" | ||
} | ||
} | ||
|
||
prometheus.scrape "integrations_agent" { | ||
targets = discovery.relabel.integrations_agent.output | ||
forward_to = [prometheus.remote_write.metrics_default.receiver] | ||
job_name = "integrations/agent" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
converter/internal/staticconvert/testdata-v2/missing_metrics_config.diags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(Critical) integration agent is looking for an undefined metrics config: not_default | ||
(Warning) Please review your agent command line flags and ensure they are set in your Flow mode config file where necessary. |
12 changes: 12 additions & 0 deletions
12
converter/internal/staticconvert/testdata-v2/missing_metrics_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
metrics: | ||
global: | ||
remote_write: | ||
- url: http://localhost:9009/api/prom/push | ||
configs: | ||
- name: default | ||
|
||
integrations: | ||
agent: | ||
instance: "default" | ||
autoscrape: | ||
metrics_instance: "not_default" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters