Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka exporter: panic: reflect.Set: value of type string is not assignable to type config.Secret #6044

Closed
max107 opened this issue Jan 4, 2024 · 2 comments · Fixed by #6046
Assignees
Labels
bug Something isn't working frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.

Comments

@max107
Copy link

max107 commented Jan 4, 2024

What's wrong?

panic

panic: reflect.Set: value of type string is not assignable to type config.Secret

no sasl_password covered in tests https://github.com/grafana/agent/blob/main/component/prometheus/exporter/kafka/kafka_test.go

Steps to reproduce

example configuration

prometheus.exporter.kafka "kafka_hetzner" {
    kafka_uris = ["broker1"]
    use_sasl = true
    sasl_password = "foobar" // <-- here
}

System information

No response

Software version

0.38.1

Configuration

prometheus.exporter.kafka "kafka_hetzner" {
    kafka_uris = ["broker1"]
    use_sasl = true
    sasl_password = "foobar" // <-- here
}

Logs

ts=2024-01-04T11:08:34.175127661Z level=info msg="finished node evaluation" controller_id="" trace_id=4759262a337e25869bad3076f7596e8b node_id=http duration=23.701µs
ts=2024-01-04T11:08:34.175153422Z level=info msg="finished node evaluation" controller_id="" trace_id=4759262a337e25869bad3076f7596e8b node_id=ui duration=869ns
ts=2024-01-04T11:08:34.175243388Z level=info msg="finished node evaluation" controller_id="" trace_id=4759262a337e25869bad3076f7596e8b node_id=prometheus.exporter.kafka.kafka_hetzner duration=68.756µs
ts=2024-01-04T11:08:34.175280922Z level=info msg="finished complete graph evaluation" controller_id="" trace_id=4759262a337e25869bad3076f7596e8b duration=438.628µs
panic: reflect.Set: value of type string is not assignable to type config.Secret

goroutine 1 [running]:
reflect.Value.assignTo({0x60e8ac0?, 0xc002953220?, 0x7fdf4c339b38?}, {0x773f8e5, 0xb}, 0x66846a0, 0x0)
        /usr/local/go/src/reflect/value.go:3307 +0x289
reflect.Value.Set({0x66846a0?, 0xc00290aa40?, 0x6791a00?}, {0x60e8ac0?, 0xc002953220?, 0x66846a0?})
        /usr/local/go/src/reflect/value.go:2260 +0xe6
github.com/grafana/river/internal/value.(*decoder).decode(0xc002b861b7, {{0x60e8ac0?, 0xc002953210?, 0x412a09?}, 0x88?}, {0x66846a0, 0xc00290aa40, 0x198})
        /go/pkg/mod/github.com/grafana/[email protected]/internal/value/decode.go:215 +0x1266
github.com/grafana/river/internal/value.Decode({{0x60e8ac0?, 0xc002953210?, 0xc00297f0e0?}, 0xa8?}, {0x68cf9c0?, 0xc00290aa40?})
        /go/pkg/mod/github.com/grafana/[email protected]/internal/value/decode.go:80 +0xed
github.com/grafana/river/vm.(*structDecoder).decodeAttr(0xc00257e088, 0xc0029741c8, {0x758e100?, 0xc00290aa00?, 0x13?}, 0xc00257d9f0)
        /go/pkg/mod/github.com/grafana/[email protected]/vm/struct_decoder.go:181 +0x75d
github.com/grafana/river/vm.(*structDecoder).Decode(0xc00257e088, {0xc00283b900, 0x8, 0x68ef4c0?}, {0x758e100?, 0xc00290aa00?, 0x5b31563?})
        /go/pkg/mod/github.com/grafana/[email protected]/vm/struct_decoder.go:71 +0x726
github.com/grafana/river/vm.(*Evaluator).evaluateDecode(0xc002952bf0, 0xc002953020, 0xc00297f0e0, {0x87a7f00?, 0xc002974378?}, {0x68ef4c0?, 0xc00290aa00?, 0x30?})
        /go/pkg/mod/github.com/grafana/[email protected]/vm/vm.go:169 +0x34d
github.com/grafana/river/vm.(*Evaluator).evaluateBlockOrBody(0x128?, 0x758e100?, 0xc00257e188?, {0x87a7f00, 0xc002974378}, {0x68ef4c0?, 0xc00290aa00?, 0xc00290aa00?})
        /go/pkg/mod/github.com/grafana/[email protected]/vm/vm.go:93 +0x10d
github.com/grafana/river/vm.(*Evaluator).Evaluate(0xc002952bf0, 0x19?, {0x68ef4c0, 0xc00290aa00})
        /go/pkg/mod/github.com/grafana/[email protected]/vm/vm.go:58 +0x17b
github.com/grafana/agent/pkg/flow/internal/controller.(*ComponentNode).evaluate(0xc002934480, 0x0?)
        /src/agent/pkg/flow/internal/controller/node_component.go:268 +0x130
github.com/grafana/agent/pkg/flow/internal/controller.(*ComponentNode).Evaluate(0xc00276b8b0?, 0xcf3f280?)
        /src/agent/pkg/flow/internal/controller/node_component.go:251 +0x1c
github.com/grafana/agent/pkg/flow/internal/controller.(*Loader).evaluate(0xc002391800, {0x87a44c0, 0xc00297c410}, {0x87fe1a0?, 0xc002934480?})
        /src/agent/pkg/flow/internal/controller/loader.go:701 +0x58
github.com/grafana/agent/pkg/flow/internal/controller.(*Loader).Apply.func2({0x87a7fa0, 0xc002934480})
        /src/agent/pkg/flow/internal/controller/loader.go:177 +0x585
github.com/grafana/agent/pkg/flow/internal/dag.WalkTopological(0xc00297a1c0, {0xc00283bd00, 0x5, 0xcbf79f0?}, 0xc00257f038)
        /src/agent/pkg/flow/internal/dag/walk.go:83 +0x226
github.com/grafana/agent/pkg/flow/internal/controller.(*Loader).Apply(0xc002391800, 0x2a0?, {0xc00297a1a0?, 0x3, 0x4}, {0xc002736658, 0x1, 0x1})
        /src/agent/pkg/flow/internal/controller/loader.go:160 +0xaad
github.com/grafana/agent/pkg/flow.(*Flow).LoadSource(0xc002172870, 0xc002976300, 0x7725e6b?)
        /src/agent/pkg/flow/flow.go:283 +0xd6
github.com/grafana/agent/cmd/internal/flowmode.(*flowRun).Run.func4()
        /src/agent/cmd/internal/flowmode/cmd_run.go:273 +0x268
github.com/grafana/agent/cmd/internal/flowmode.(*flowRun).Run(0xc002874540, {0x7fff097166b5, 0x17})
        /src/agent/cmd/internal/flowmode/cmd_run.go:306 +0xea2
github.com/grafana/agent/cmd/internal/flowmode.runCommand.func1(0xc002837b00?, {0xc0029301c0?, 0x4?, 0x7725e9f?})
        /src/agent/cmd/internal/flowmode/cmd_run.go:93 +0x2b
github.com/spf13/cobra.(*Command).execute(0xc002345800, {0xc002930150, 0x7, 0x7})
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xc002344f00)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/grafana/agent/cmd/internal/flowmode.Run()
        /src/agent/cmd/internal/flowmode/flowmode.go:33 +0x305
main.main()
        /src/agent/cmd/grafana-agent/main.go:50 +0x6bd
@max107 max107 added the bug Something isn't working label Jan 4, 2024
@rfratto rfratto self-assigned this Jan 4, 2024
rfratto added a commit to rfratto/agent that referenced this issue Jan 4, 2024
Use rivertypes.Secret for sensitive fields instead of Prometheus' secret
type.

Fixes grafana#6044.
rfratto added a commit that referenced this issue Jan 4, 2024
Use rivertypes.Secret for sensitive fields instead of Prometheus' secret
type.

Fixes #6044.
@max107
Copy link
Author

max107 commented Jan 4, 2024

@rfratto thanks! possible to get dev docker image with fix?

@rfratto
Copy link
Member

rfratto commented Jan 4, 2024

@max107 Yes, it was automatically published as grafana/agent:main-6e4a9b9 (or grafana/agent:main if you want something which automatically updates as commits are merged)

hainenber pushed a commit to hainenber/agent that referenced this issue Jan 6, 2024
Use rivertypes.Secret for sensitive fields instead of Prometheus' secret
type.

Fixes grafana#6044.
BarunKGP pushed a commit to BarunKGP/grafana-agent that referenced this issue Feb 20, 2024
Use rivertypes.Secret for sensitive fields instead of Prometheus' secret
type.

Fixes grafana#6044.
@github-actions github-actions bot added the frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed. label Feb 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working frozen-due-to-age Locked due to a period of inactivity. Please open new issues or PRs if more discussion is needed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants