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

CA-386582: Always create exporting thread for observers #5294

Merged
merged 3 commits into from
Dec 15, 2023

Conversation

Vincent-lau
Copy link
Contributor

create observer exporting thread regardless of whether we have observers in database.

ocaml/libs/tracing/tracing.ml Outdated Show resolved Hide resolved
Xapi_stdext_threads.Threadext.Mutex.execute lock (fun () ->
match !exporter_created with
| None ->
let tid = create_exporter () in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are creating an exporter - but assign to a tid - which is a thread ID? Naming could be more congruent such that the function creating a value is related to the variable holding that value. We have here exporter_created, create_exporter and tid which refer to related values but you can't tell this from their names.

Copy link
Contributor Author

@Vincent-lau Vincent-lau Dec 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tid is the thread id of the exporter, it is a temporary variable holding the value of that id. It's just easier to have this temporary variable rather than storing the value in exporter directly, which can be a bit awkward since it is a option value, and what we want to return is the actual value without the option

@Vincent-lau Vincent-lau force-pushed the private/shul2/observer-init branch 2 times, most recently from 7209431 to 053b9b2 Compare December 12, 2023 14:00
Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
Previously the exporting thread for observer is only created when there
is an observer stored in the database associated with a component. This
is not the original intent of how observers should be used.

We want to create the exporting thread regardless of whether we have any
observers so that when observers are created later on, their spans can be
exported, since creating an observer will not check for the existence of
an exporting thread.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
This allows the observer to be created _after_ clusterd has been started.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@robhoes robhoes merged commit f48d418 into xapi-project:master Dec 15, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants