Skip to content

Commit

Permalink
move helpers function
Browse files Browse the repository at this point in the history
  • Loading branch information
nina9753 committed Dec 11, 2024
1 parent 07bf3dd commit 3f8f5dc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
35 changes: 1 addition & 34 deletions trace-mini-agent/src/trace_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ mod tests {
trace_processor::{self, TraceProcessor},
};
use datadog_trace_protobuf::pb;
use datadog_trace_utils::test_utils::create_test_gcp_span;
use datadog_trace_utils::test_utils::{create_test_gcp_span, create_test_gcp_json_span};
use datadog_trace_utils::trace_utils::MiniAgentMetadata;
use datadog_trace_utils::{
test_utils::create_test_json_span, trace_utils, tracer_payload::TracerPayloadCollection,
Expand All @@ -146,39 +146,6 @@ mod tests {
UNIX_EPOCH.elapsed().unwrap().as_nanos() as i64
}

pub fn create_test_gcp_json_span(
trace_id: u64,
span_id: u64,
parent_id: u64,
start: i64,
) -> serde_json::Value {
json!(
{
"trace_id": trace_id,
"span_id": span_id,
"service": "test-service",
"functionname": "dummy_function_name",
"name": "test_name",
"resource": "test-resource",
"parent_id": parent_id,
"start": start,
"duration": 5,
"error": 0,
"meta": {
"service": "test-service",
"env": "test-env",
"runtime-id": "test-runtime-id-value",
"gcrfx.project_id": "dummy_project_id",
"_dd.mini_agent_version": "dummy_version",
"_dd.gcrfx.resource_name": "projects/dummy_project_id/locations/dummy_region_west/functions/dummy_function_name",
"gcrfx.location": "dummy_region_west"
},
"metrics": {},
"meta_struct": {},
}
)
}

fn create_test_config() -> Config {
Config {
app_name: Some("dummy_function_name".to_string()),
Expand Down
33 changes: 33 additions & 0 deletions trace-utils/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,39 @@ pub fn create_test_gcp_span(
span
}

pub fn create_test_gcp_json_span(
trace_id: u64,
span_id: u64,
parent_id: u64,
start: i64,
) -> serde_json::Value {
json!(
{
"trace_id": trace_id,
"span_id": span_id,
"service": "test-service",
"functionname": "dummy_function_name",
"name": "test_name",
"resource": "test-resource",
"parent_id": parent_id,
"start": start,
"duration": 5,
"error": 0,
"meta": {
"service": "test-service",
"env": "test-env",
"runtime-id": "test-runtime-id-value",
"gcrfx.project_id": "dummy_project_id",
"_dd.mini_agent_version": "dummy_version",
"_dd.gcrfx.resource_name": "projects/dummy_project_id/locations/dummy_region_west/functions/dummy_function_name",
"gcrfx.location": "dummy_region_west"
},
"metrics": {},
"meta_struct": {},
}
)
}

pub fn create_test_json_span(
trace_id: u64,
span_id: u64,
Expand Down

0 comments on commit 3f8f5dc

Please sign in to comment.