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

[receiver/filelog] Add operator no longer able to pull env vars with the env function #26373

Closed
atoulme opened this issue Sep 1, 2023 · 1 comment · Fixed by #26467
Closed
Labels
bug Something isn't working receiver/filelog

Comments

@atoulme
Copy link
Contributor

atoulme commented Sep 1, 2023

Component(s)

receiver/filelog

What happened?

See signalfx/splunk-otel-collector-chart#904 for original report.

The commit 44e1f67#diff-1d453bc7c5b0dd32eec0c83b9b06e6aeb291890d5cf7585d437cee1c209e40b4L123 changed the default value of the env function to be os_env_func with the ability to patch back the calls to env to match os_env_func.

The backwards compatibility work is done when parsing the expression with a patcher struct that performs the string change:

type patcher struct{}

func (p *patcher) Visit(node *ast.Node) {
	n, ok := (*node).(*ast.CallNode)
	if !ok {
		return
	}
	c, ok := (n.Callee).(*ast.IdentifierNode)
	if !ok {
		return
	}
	if c.Value == "env" {
		c.Value = "os_env_func"
	}
}

However, this patcher struct is not used consistently across all usages of the expr compilation work. The add operator specifically doesn't use it, and therefore fails to find the environment variable lookup function.

#26374

Collector version

0.83.0

Environment information

Environment

OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

No response

Log output

No response

Additional context

No response

@atoulme atoulme added the bug Something isn't working label Sep 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working receiver/filelog
Projects
None yet
1 participant