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

noisy debug logs with compare string to non-string #29015

Closed
trajano opened this issue Nov 7, 2023 · 11 comments · Fixed by #31813
Closed

noisy debug logs with compare string to non-string #29015

trajano opened this issue Nov 7, 2023 · 11 comments · Fixed by #31813
Labels
enhancement New feature or request pkg/ottl priority:p3 Lowest

Comments

@trajano
Copy link

trajano commented Nov 7, 2023

Component(s)

processor/filter

What happened?

Description

Seeing a lot of debug noise, but does not show any reason how to fix it (note this may be due to compare.go not providing a facility to mute invalid comparisons.

Steps to Reproduce

Define the filter

Expected Result

Quiet

Actual Result

Lots of debug statements

Collector version

0.88.0

Environment information

Environment

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

OpenTelemetry Collector configuration

processors:
  filter/drop_actuator:
    traces:
      span:
        - (attributes["http.method"] != nil) and (attributes["http.method"] == "GET") and (attributes["http.route"] == "/actuator/prometheus")
service:
  telemetry:
    logs:
      level: debug
      encoding: json
  pipelines:
    traces:
      receivers: [otlp]
      processors: [filter/drop_actuator,batch]

Log output

{"level":"debug","ts":1699397830.919674,"caller":"ottl@v0.88.0/compare.go:22","msg":"string to non-string","kind":"processor","name":"filter/drop_actuator","pipeline":"traces","op":0}
{"level":"debug","ts":1699397832.4553528,"caller":"ottl@v0.88.0/compare.go:22","msg":"string to non-string","kind":"processor","name":"filter/drop_actuator","pipeline":"traces","op":1}
{"level":"debug","ts":1699397832.4554641,"caller":"ottl@v0.88.0/compare.go:22","msg":"string to non-string","kind":"processor","name":"filter/drop_actuator","pipeline":"traces","op":0}
{"level":"debug","ts":1699397832.4554925,"caller":"ottl@v0.88.0/compare.go:22","msg":"string to non-string","kind":"processor","name":"filter/drop_actuator","pipeline":"traces","op":1}

Additional context

I also tried

    error_mode: ignore

still noisy.

@trajano trajano added bug Something isn't working needs triage New item requiring triage labels Nov 7, 2023
@github-actions github-actions bot added the processor/filter Filter processor label Nov 7, 2023
Copy link
Contributor

github-actions bot commented Nov 7, 2023

Pinging code owners:

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

@crobert-1
Copy link
Member

Hello @trajano, just to clarify, did you file this issue because you don't want so many logs in your collector's output, or because you want the specific message you're seeing to provide some kind of guidance to resolve the issue?

@trajano
Copy link
Author

trajano commented Nov 8, 2023

Too many logs in the collectors output

There's also two problems with the messaging

  1. it does not provide a way of fixing the problem if there is one.
  2. it does not tell me what specific data and ideally what line as well caused the problem (that could likely be done on compare.go

But I think the fix would be filter should do a cursory check or maybe compare can provide a validator before sending it to compare for processing.

@crobert-1
Copy link
Member

I think the best option is probably to add more information to the log output, specifically which string and non-string values are being compared.

I don't think anything should be done with the filter processor here, or other logic changes. The check will fail either way and this log message is really showing that we're properly validating data in our checks, and that everything is working as intended. The logic that's being used to compare values is in the ottl package which is widely used across different collector components. Because of this, I don't think it's a good idea to start adding logic around it in different components.

The log message is also showing where the check is coming from (filter/drop_actuator). From this, we know the comparisons defined here in your processor are what's logging errors:

        - (attributes["http.method"] != nil) and (attributes["http.method"] == "GET") and (attributes["http.route"] == "/actuator/prometheus")

So we know it's one of those conditions that's comparing a string to a non-string. Also, we know from the op value in the log that both equalities (0) and inequalities (1) are failing with this error.

// compareOp is the type of a comparison operator.
type compareOp int
// These are the allowed values of a compareOp
const (
EQ compareOp = iota
NE
LT
LTE
GTE
GT
)

@crobert-1 crobert-1 added pkg/ottl and removed needs triage New item requiring triage processor/filter Filter processor labels Nov 8, 2023
Copy link
Contributor

github-actions bot commented Nov 8, 2023

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1
Copy link
Member

(This is also relevant for all of the other comparisons as well, not just strings.)

@trajano
Copy link
Author

trajano commented Nov 8, 2023

I am thinking maybe it's the nil perhaps we it should log differently or ignore if nil == "string"

@TylerHelmuth
Copy link
Member

This is happening because you've enabled

service:
  telemetry:
    logs:
      level: debug

At the moment it is working as intended. The log could be improved. If you want to stop the influx of logs in the meantime you should switch to

service:
  telemetry:
    logs:
      level: info

@TylerHelmuth TylerHelmuth added priority:p3 Lowest and removed bug Something isn't working labels Nov 13, 2023
@trajano
Copy link
Author

trajano commented Nov 13, 2023

@TylerHelmuth thanks yes I know it's because of the debug level. I was trying to diagnose another issue which is why I was on debug mode. I just used grep -v to ignore the noise.

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Jan 15, 2024
@crobert-1 crobert-1 removed the Stale label Jan 16, 2024
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Mar 18, 2024
@crobert-1 crobert-1 removed the Stale label Mar 18, 2024
TylerHelmuth added a commit that referenced this issue Apr 5, 2024
**Description:**
When we added the boolean comparison feature we included a debug log to
help troubleshoot when 2 comparisons were invalid, such as checking if a
`string` was equal to a `float64`. Since then we've had complaints about
how noisy the log is, mainly because it happens when checking against
`nil`, which happens frequently when checking if an attribute has a
specific value when it is present.

This PR removes the log.

**Link to tracking Issue:**

Closes
#29015
adambenhassen pushed a commit to inigolabs/opentelemetry-collector-contrib that referenced this issue Jul 29, 2024
)

**Description:**
When we added the boolean comparison feature we included a debug log to
help troubleshoot when 2 comparisons were invalid, such as checking if a
`string` was equal to a `float64`. Since then we've had complaints about
how noisy the log is, mainly because it happens when checking against
`nil`, which happens frequently when checking if an attribute has a
specific value when it is present.

This PR removes the log.

**Link to tracking Issue:**

Closes
open-telemetry#29015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg/ottl priority:p3 Lowest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants