Skip to content

SQL template: JOIN condition is wrong on querySample.tmpl #46548

@ebrdarSplunk

Description

@ebrdarSplunk

Component(s)

receiver/mysql

What happened?

Description

While testing some scenarios in MySql and reviewing codebase, I came across an issue where I noticed that the active session query currently does the following join on template(https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/mysqlreceiver/templates/querySample.tmpl) line 23:

LEFT JOIN information_schema.processlist AS processlist on processlist.id = thread.thread_id

processlist.id corresponds to thread.processlist_id, not thread.thread_id. These are different values -- thread_id is the internal performance_schema thread identifier, while processlist_id is the MySQL connection/session ID that appears in SHOW PROCESSLIST

Steps to Reproduce

Taking the query and running it against a MySQL instance

Expected Result

The query to join information_schema.processlist and information_schema.threads on the correct key

Actual Result

The query is joining information_schema.processlist to thread on the incorrect column

Collector version

v0.146.0

Environment information

Environment

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

OpenTelemetry Collector configuration

Log output

Additional context

Proposed Fix:

Change line 23 to:

LEFT JOIN information_schema.processlist AS processlist on processlist.id = thread.processlist_id

by changing it to "thread.processlist_id" allows the correct join to take place

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions