Skip to content

Commit

Permalink
Promtail converters: encoding and decompression settings (#4671)
Browse files Browse the repository at this point in the history
  • Loading branch information
thampiotr authored and clayton-cornell committed Aug 14, 2023
1 parent 9c773d1 commit 88eb2a3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func (s *ScrapeConfigBuilder) Validate() {
if len(s.cfg.ServiceDiscoveryConfig.TritonSDConfigs) != 0 {
s.diags.Add(diag.SeverityLevelError, "triton_sd_configs is not supported")
}
if s.cfg.DecompressionCfg != nil && s.cfg.DecompressionCfg.Enabled {
//TODO: Support this once issue https://github.com/grafana/agent/issues/4669 is resolved
s.diags.Add(diag.SeverityLevelError, "decompression is currently not supported")
}
}

func (s *ScrapeConfigBuilder) AppendLokiSourceFile() {
Expand All @@ -84,6 +88,7 @@ func (s *ScrapeConfigBuilder) AppendLokiSourceFile() {

args := lokisourcefile.Arguments{
ForwardTo: forwardTo,
Encoding: s.cfg.Encoding,
}
overrideHook := func(val interface{}) interface{} {
if _, ok := val.([]discovery.Target); ok {
Expand Down
3 changes: 0 additions & 3 deletions converter/internal/promtailconvert/promtailconvert.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ func appendScrapeConfig(
diags *diag.Diagnostics,
gctx *build.GlobalContext,
) {
//TODO(thampiotr): need to support/warn about the following fields:
//Encoding string `mapstructure:"encoding,omitempty" yaml:"encoding,omitempty"`
//DecompressionCfg *DecompressionConfig `yaml:"decompression,omitempty"`

b := build.NewScrapeConfigBuilder(f, diags, cfg, gctx)
b.Validate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ loki.process "example" {
loki.source.file "example" {
targets = local.file_match.example.targets
forward_to = [loki.process.example.receiver]
encoding = "UTF-16"
}

loki.write "default" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ clients:
- url: http://localhost/loki/api/v1/push
scrape_configs:
- job_name: example
encoding: UTF-16
pipeline_stages:
- json:
expressions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
(Error) nerve_sd_configs is not supported
(Error) marathon_sd_configs is not supported
(Error) openstack_sd_configs is not supported
(Error) triton_sd_configs is not supported
(Error) triton_sd_configs is not supported
(Error) decompression is currently not supported
5 changes: 5 additions & 0 deletions converter/internal/promtailconvert/testdata/unsupported.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ scrape_configs:
- account: account
dns_suffix: .example.com
endpoint: triton.example.com
encoding: utf-16
decompression:
enabled: true
format: z
initial_delay: 30s

0 comments on commit 88eb2a3

Please sign in to comment.