Skip to content

Commit bb0330e

Browse files
committed
feat: get endpoint/request_type from wasm response data
1 parent cdcc481 commit bb0330e

File tree

7 files changed

+26
-2
lines changed

7 files changed

+26
-2
lines changed

agent/src/flow_generator/protocol_logs/mq/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub use zmtp::{ZmtpInfo, ZmtpLog};
3232

3333
cfg_if::cfg_if! {
3434
if #[cfg(feature = "enterprise")] {
35-
mod webspheremq;
36-
pub use webspheremq::{WebSphereMqInfo, WebSphereMqLog};
35+
mod web_sphere_mq;
36+
pub use web_sphere_mq::{WebSphereMqInfo, WebSphereMqLog};
3737
}
3838
}

agent/src/flow_generator/protocol_logs/mq/webspheremq.rs renamed to agent/src/flow_generator/protocol_logs/mq/web_sphere_mq.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ impl WebSphereMqInfo {
228228
self.response_exception = custom.resp.exception;
229229
}
230230

231+
if !custom.resp.req_type.is_empty() {
232+
self.request_type = custom.resp.req_type;
233+
}
234+
235+
if !custom.resp.endpoint.is_empty() {
236+
self.endpoint = custom.resp.endpoint;
237+
}
238+
231239
//trace info rewrite
232240
self.trace_ids
233241
.merge_same_priority(PLUGIN_FIELD_PRIORITY, custom.trace.trace_ids);

agent/src/flow_generator/protocol_logs/plugin/custom_protocol_policy.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ impl From<(&CustomPolicyInfo, PacketDirection)> for CustomInfo {
181181
code: info.response_code.clone(),
182182
exception: info.response_exception.clone(),
183183
result: info.response_result.clone(),
184+
endpoint: info.endpoint.clone(),
185+
req_type: info.request_type.clone(),
184186
},
185187
trace: CustomInfoTrace {
186188
trace_ids,

agent/src/plugin/WasmPluginApi.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ message AppResponse {
2424
optional int32 code = 2;
2525
optional string exception = 3;
2626
optional string result = 4;
27+
optional string type = 5;
28+
optional string endpoint = 6;
2729
}
2830

2931
message AppTrace {

agent/src/plugin/c_ffi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ pub struct Response {
131131
pub(super) code: i32,
132132
pub(super) exception: [u8; 128],
133133
pub(super) result: [u8; 512],
134+
pub(super) req_type: [u8; 64],
135+
pub(super) endpoint: [u8; 128],
134136
}
135137
impl std::fmt::Debug for Response {
136138
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -277,6 +279,8 @@ impl TryFrom<ParseInfo> for CustomInfo {
277279
code: Some(resp.code),
278280
exception: c_str_to_string(&resp.exception).unwrap_or_default(),
279281
result: c_str_to_string(&resp.result).unwrap_or_default(),
282+
req_type: c_str_to_string(&resp.req_type).unwrap_or_default(),
283+
endpoint: c_str_to_string(&resp.endpoint).unwrap_or_default(),
280284
},
281285
)
282286
}

agent/src/plugin/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ pub struct CustomInfoResp {
6464
pub code: Option<i32>,
6565
pub exception: String,
6666
pub result: String,
67+
pub req_type: String,
68+
pub endpoint: String,
6769
}
6870

6971
#[derive(Debug, Default, Serialize, Clone)]
@@ -485,6 +487,8 @@ impl CustomInfo {
485487
code: r.code,
486488
result: r.result.unwrap_or_default(),
487489
exception: r.exception.unwrap_or_default(),
490+
req_type: r.r#type.unwrap_or_default(),
491+
endpoint: r.endpoint.unwrap_or_default(),
488492
};
489493
}
490494
_ => (),

agent/src/plugin/wasm/wasm_plugin.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ pub struct AppResponse {
2424
pub exception: ::core::option::Option<::prost::alloc::string::String>,
2525
#[prost(string, optional, tag = "4")]
2626
pub result: ::core::option::Option<::prost::alloc::string::String>,
27+
#[prost(string, optional, tag = "5")]
28+
pub r#type: ::core::option::Option<::prost::alloc::string::String>,
29+
#[prost(string, optional, tag = "6")]
30+
pub endpoint: ::core::option::Option<::prost::alloc::string::String>,
2731
}
2832
#[allow(clippy::derive_partial_eq_without_eq)]
2933
#[derive(Clone, PartialEq, ::prost::Message)]

0 commit comments

Comments
 (0)