-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew feature or requestNew feature or request
Description
While writing tests I wanted to instrument multiple functions while using the same tracing channel, so I wrote this:
use crate::common::*;
use orchestrion_js::*;
#[test]
fn param_mutation() {
transpile_and_test(
file!(),
false,
Config::new(
vec![
InstrumentationConfig::new(
"param_mutation",
test_module_matcher(),
FunctionQuery::function_declaration("fetch_simple_args", FunctionKind::Sync),
),
InstrumentationConfig::new(
"param_mutation",
test_module_matcher(),
FunctionQuery::function_declaration("fetch_complex_args", FunctionKind::Sync),
),
],
None,
),
);
}but this will end up rewriting the file with this:
const { tracingChannel: tr_ch_apm_tracingChannel } = require("diagnostics_channel");
const tr_ch_apm$param_mutation = tr_ch_apm_tracingChannel("orchestrion:undici:param_mutation");
const tr_ch_apm$param_mutation = tr_ch_apm_tracingChannel("orchestrion:undici:param_mutation");thus creating the variable tr_ch_apm$param_mutation twice, which is not legal syntax.
We have real use cases for using the same channel for multiple functions. Maybe I just don't know how to do it with the current API, but if it's not possible currently, it would be a welcomed addition.
For now we can work around it by having channel1 and channel2 but it's not optimal.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request