Getting Started with OpenTelemetry Rust Logs in 5 Minutes - Exporting logs to user_events#2
Getting Started with OpenTelemetry Rust Logs in 5 Minutes - Exporting logs to user_events#2lalitb wants to merge 20 commits into
Conversation
|
|
||
| ### How to configure: | ||
|
|
||
| 1. Create ExporterConfig with below settings: |
There was a problem hiding this comment.
I think 2,3 here are irrelevant, and we should hide it from users.
There was a problem hiding this comment.
step 2 is setting up the provider_name. Will remove step 3.
Or do you mean to add wrapper on top of these APIs to hide from users ?
There was a problem hiding this comment.
yes. but it can be done later.
something like loggerProviderBuilder.add_user_event_exporter(provider_name)
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
|
|
||
| 2. Create LogProcessor instance: | ||
| ```rust | ||
| let processor = ReentrantLogProcessor::new("test_provider", None, exporter_config); |
There was a problem hiding this comment.
Curious - what's the semantic of the first parameter?
There was a problem hiding this comment.
It's documented here - https://github.com/microsoft/LinuxTracepoints/tree/main/libeventheader-tracepoint#provider-names :
--clip
A provider is a component that generates events. Each event from a provider is associated with a Provider Name that uniquely identifies the provider.
The provider name should be short, yet descriptive enough to minimize the chance of collision and to help developers track down the component generating the events. Hierarchical namespaces may be useful for provider names, e.g. MyCompany_MyOrg_MyComponent.
-clap
Have added the link in this document.
There was a problem hiding this comment.
So a Provider can generate different unique events. In future, we can have each event mapped to a unique EventKeyword. And the combination of ProviderName + EventKeyword + Level represents a tracepoint name.
There was a problem hiding this comment.
I don't understand why a LinuxTracepoint provider has something to do with a ReentrantLogProcessor. If you look at the name of ReentrantLogProcessor, it has nothing to do with provider.
There was a problem hiding this comment.
Yes, the plan is to move the provider into ExporterConfig for the next release.
Co-authored-by: Reiley Yang <reyang@microsoft.com>
| * Rust and Cargo: [Install](https://doc.rust-lang.org/cargo/getting-started/installation.html) them if you haven't. | ||
| * A Linux system with [user_events](https://docs.kernel.org/trace/user_events.html) enabled: Ubuntu 23.10 (once available), or kernel 6.4 or later build with user_events support. | ||
| * Correct Permissions: Linux user(preferable non-root) with write permission to the tracefs. | ||
| * A listener/agent to listen for new events. Or else [perf](https://perf.wiki.kernel.org/index.php/Main_Page) and [decode-perf](https://github.com/microsoft/LinuxTracepoints/tree/main/libeventheader-decode-cpp/tools) tools installed for validation. |
There was a problem hiding this comment.
Since this is more of a getting-started example, we don't have to list all possible ways, I suggest that we just provide the most common way or an easy way (e.g. download XYZ tool and use that).
There was a problem hiding this comment.
Good point. Only using the perf/decode-perf tool now.
| event_id = 20, | ||
| user_name = "otel user", | ||
| user_email = "otel@opentelemetry.io" | ||
| //event_name = "my-event-name", |
There was a problem hiding this comment.
@cijothomas what's the expected way (end goal) of specifying event name?
There was a problem hiding this comment.
It is supposed to be error!( name: "myevent", ...) ref - https://github.com/tokio-rs/tracing/blob/b8c45ccd067a6aebdd9257c5edda6bc90bcf9028/tracing/src/lib.rs#L247
Have updated the example accordingly. Thanks for pointing out.
|
|
||
| The example code uses `test` as the ProviderName and `1` as the EventKeyword. So, it makes these 5 tracepoints: | ||
|
|
||
| * test_L5K1Gtest |
There was a problem hiding this comment.
This needs to be updated to reflect the provider name change?
Co-authored-by: Reiley Yang <reyang@microsoft.com>
Co-authored-by: Reiley Yang <reyang@microsoft.com>
Co-authored-by: Reiley Yang <reyang@microsoft.com>
| ### What you need to know: | ||
|
|
||
| * [ProviderName](https://github.com/microsoft/LinuxTracepoints/tree/main/libeventheader-tracepoint#provider-names) and [EventKeyword](https://github.com/microsoft/LinuxTracepoints/tree/main/libeventheader-tracepoint#tracepoint-names) can be changed using Exporter configuration. | ||
| * `ProviderGroup` is assigned the value of `ProviderName`. |
There was a problem hiding this comment.
I thought it is good for them to know that ProviderGroupis not configurable, and also make them understand why myprovider comes twice in tracepoint name myprovider_L5K1Gmyprovider
There was a problem hiding this comment.
Got it.! Yea it can be confusing without this to see myprovider twice.
| $ perf record -e user_events:myprovider_L2K1Gmyprovider | ||
| <ctrl-c after running example code> | ||
| $ decode-perf ./perf.data | ||
| <log data is output here> |
There was a problem hiding this comment.
can you paste an actual output, so it is easy to compare where things land?
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
|
Thank you for your contribution! This PR has been automatically marked as stale because it has not had activity in the last 14 days. This may be due to a delay in review on our side or awaiting a response from you; either is fine, and we appreciate your patience. It will be closed in 14 days if no further activity occurs. Pushing a new commit or leaving a comment will remove the stale label and keep the PR open. |
Fixes #
Design discussion issue (if applicable) #
Changes
Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changes