diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ebc802cf5b..b88ba6b5ff 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -22,7 +22,7 @@ Cross.toml @Datadog/apm-common-components-core datadog-ffe @Datadog/feature-flagging-and-experimentation-sdk datadog-ffe-ffi @Datadog/feature-flagging-and-experimentation-sdk datadog-ipc*/ @Datadog/libdatadog-php -datadog-live-debugger*/ @Datadog/libdatadog-php @Datadog/libdatadog-apm +libdd-live-debugger*/ @Datadog/libdatadog-php @Datadog/libdatadog-apm datadog-profiling-replayer @Datadog/libdatadog-profiling datadog-remote-config @Datadog/libdatadog-php @Datadog/libdatadog-apm @Datadog/remote-config datadog-sidecar @Datadog/libdatadog-php @Datadog/libdatadog-apm diff --git a/Cargo.lock b/Cargo.lock index ea20e4c7ce..530ec02f5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1287,43 +1287,6 @@ dependencies = [ "syn 2.0.110", ] -[[package]] -name = "datadog-live-debugger" -version = "0.0.1" -dependencies = [ - "anyhow", - "constcat", - "http-body-util", - "hyper", - "libdd-common", - "libdd-data-pipeline", - "percent-encoding", - "regex", - "regex-automata", - "serde", - "serde_json", - "smallvec", - "sys-info", - "tokio", - "uuid", -] - -[[package]] -name = "datadog-live-debugger-ffi" -version = "0.0.1" -dependencies = [ - "build_common", - "datadog-live-debugger", - "libdd-common", - "libdd-common-ffi", - "log", - "percent-encoding", - "serde_json", - "tokio", - "tokio-util", - "uuid", -] - [[package]] name = "datadog-profiling-replayer" version = "24.0.1" @@ -1342,7 +1305,6 @@ version = "0.0.1" dependencies = [ "anyhow", "base64 0.22.1", - "datadog-live-debugger", "datadog-remote-config", "futures", "futures-util", @@ -1351,6 +1313,7 @@ dependencies = [ "hyper", "hyper-util", "libdd-common", + "libdd-live-debugger", "libdd-trace-protobuf", "manual_future", "serde", @@ -1376,7 +1339,6 @@ dependencies = [ "console-subscriber", "datadog-ipc", "datadog-ipc-macros", - "datadog-live-debugger", "datadog-remote-config", "datadog-sidecar-macros", "futures", @@ -1391,6 +1353,7 @@ dependencies = [ "libdd-crashtracker-ffi", "libdd-data-pipeline", "libdd-dogstatsd-client", + "libdd-live-debugger", "libdd-telemetry", "libdd-tinybytes", "libdd-trace-utils", @@ -1425,7 +1388,6 @@ name = "datadog-sidecar-ffi" version = "0.0.1" dependencies = [ "datadog-ipc", - "datadog-live-debugger", "datadog-remote-config", "datadog-sidecar", "http", @@ -1434,6 +1396,7 @@ dependencies = [ "libdd-common-ffi", "libdd-crashtracker-ffi", "libdd-dogstatsd-client", + "libdd-live-debugger", "libdd-telemetry", "libdd-telemetry-ffi", "libdd-tinybytes", @@ -2816,6 +2779,43 @@ dependencies = [ "tempfile", ] +[[package]] +name = "libdd-live-debugger" +version = "1.0.0" +dependencies = [ + "anyhow", + "constcat", + "http-body-util", + "hyper", + "libdd-common", + "libdd-data-pipeline", + "percent-encoding", + "regex", + "regex-automata", + "serde", + "serde_json", + "smallvec", + "sys-info", + "tokio", + "uuid", +] + +[[package]] +name = "libdd-live-debugger-ffi" +version = "1.0.0" +dependencies = [ + "build_common", + "libdd-common", + "libdd-common-ffi", + "libdd-live-debugger", + "log", + "percent-encoding", + "serde_json", + "tokio", + "tokio-util", + "uuid", +] + [[package]] name = "libdd-log" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index b26c0a9de4..c6b7b98cc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ members = [ "datadog-ipc-macros", "libdd-library-config", "libdd-library-config-ffi", - "datadog-live-debugger", - "datadog-live-debugger-ffi", + "libdd-live-debugger", + "libdd-live-debugger-ffi", "libdd-profiling", "libdd-profiling-ffi", "libdd-profiling-protobuf", diff --git a/LICENSE-3rdparty.yml b/LICENSE-3rdparty.yml index 98471bbefa..5eb30b7188 100644 --- a/LICENSE-3rdparty.yml +++ b/LICENSE-3rdparty.yml @@ -1,4 +1,4 @@ -root_name: builder, build_common, tools, libdd-alloc, libdd-crashtracker, libdd-common, libdd-telemetry, libdd-ddsketch, libdd-crashtracker-ffi, libdd-common-ffi, datadog-ffe, datadog-ffe-ffi, datadog-ipc, datadog-ipc-macros, libdd-tinybytes, tarpc, tarpc-plugins, spawn_worker, cc_utils, libdd-library-config, libdd-library-config-ffi, datadog-live-debugger, libdd-data-pipeline, libdd-dogstatsd-client, libdd-trace-protobuf, libdd-trace-stats, libdd-trace-utils, libdd-trace-normalization, libdd-log, datadog-live-debugger-ffi, libdd-profiling, libdd-profiling-protobuf, libdd-profiling-ffi, libdd-data-pipeline-ffi, libdd-ddsketch-ffi, libdd-log-ffi, libdd-telemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, datadog-remote-config, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, libdd-trace-obfuscation, datadog-tracer-flare, sidecar_mockgen, test_spawn_from_lib +root_name: builder, build_common, tools, libdd-alloc, libdd-crashtracker, libdd-common, libdd-telemetry, libdd-ddsketch, libdd-crashtracker-ffi, libdd-common-ffi, datadog-ffe, datadog-ffe-ffi, datadog-ipc, datadog-ipc-macros, libdd-tinybytes, tarpc, tarpc-plugins, spawn_worker, cc_utils, libdd-library-config, libdd-library-config-ffi, libdd-live-debugger, libdd-data-pipeline, libdd-dogstatsd-client, libdd-trace-protobuf, libdd-trace-stats, libdd-trace-utils, libdd-trace-normalization, libdd-log, libdd-live-debugger-ffi, libdd-profiling, libdd-profiling-protobuf, libdd-profiling-ffi, libdd-data-pipeline-ffi, libdd-ddsketch-ffi, libdd-log-ffi, libdd-telemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, datadog-remote-config, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, libdd-trace-obfuscation, datadog-tracer-flare, sidecar_mockgen, test_spawn_from_lib third_party_libraries: - package_name: addr2line package_version: 0.24.2 @@ -27494,9 +27494,9 @@ third_party_libraries: - package_name: stringmetrics package_version: 2.2.2 repository: https://github.com/pluots/stringmetrics - license: License specified in file ($CARGO_HOME/registry/src/index.crates.io-1949cf8c6b5b557f/stringmetrics-2.2.2/LICENSE) + license: License specified in file ($CARGO_HOME/registry/src/index.crates.io-6f17d22bba15001f/stringmetrics-2.2.2/LICENSE) licenses: - - license: License specified in file ($CARGO_HOME/registry/src/index.crates.io-1949cf8c6b5b557f/stringmetrics-2.2.2/LICENSE) + - license: License specified in file ($CARGO_HOME/registry/src/index.crates.io-6f17d22bba15001f/stringmetrics-2.2.2/LICENSE) text: | Copyright 2022 Trevor Gross diff --git a/datadog-remote-config/Cargo.toml b/datadog-remote-config/Cargo.toml index 085fb46f2e..0b8adca4ea 100644 --- a/datadog-remote-config/Cargo.toml +++ b/datadog-remote-config/Cargo.toml @@ -22,14 +22,14 @@ client = [ "time", "tracing" ] -live-debugger = ["datadog-live-debugger"] +live-debugger = ["libdd-live-debugger"] test = ["hyper/server", "hyper-util"] [dependencies] anyhow = { version = "1.0" } libdd-common = { path = "../libdd-common"} libdd-trace-protobuf = { path = "../libdd-trace-protobuf", optional = true } -datadog-live-debugger = { path = "../datadog-live-debugger", optional = true } +libdd-live-debugger = { path = "../libdd-live-debugger", optional = true } hyper = { workspace = true, optional = true } http-body-util = {version = "0.1", optional = true } http = { version = "1.0", optional = true } diff --git a/datadog-remote-config/src/parse.rs b/datadog-remote-config/src/parse.rs index 859df1a19a..b8402f4b70 100644 --- a/datadog-remote-config/src/parse.rs +++ b/datadog-remote-config/src/parse.rs @@ -8,7 +8,7 @@ use crate::{ RemoteConfigPath, RemoteConfigProduct, RemoteConfigSource, }; #[cfg(feature = "live-debugger")] -use datadog_live_debugger::LiveDebuggingData; +use libdd_live_debugger::LiveDebuggingData; #[derive(Debug)] pub enum RemoteConfigData { @@ -37,7 +37,7 @@ impl RemoteConfigData { } #[cfg(feature = "live-debugger")] RemoteConfigProduct::LiveDebugger => { - let parsed = datadog_live_debugger::parse_json(&String::from_utf8_lossy(data))?; + let parsed = libdd_live_debugger::parse_json(&String::from_utf8_lossy(data))?; RemoteConfigData::LiveDebugger(parsed) } _ => RemoteConfigData::Ignored(product), diff --git a/datadog-sidecar-ffi/Cargo.toml b/datadog-sidecar-ffi/Cargo.toml index e9559b5c35..3ed2568247 100644 --- a/datadog-sidecar-ffi/Cargo.toml +++ b/datadog-sidecar-ffi/Cargo.toml @@ -20,7 +20,7 @@ libdd-common = { path = "../libdd-common" } libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false } libdd-telemetry-ffi = { path = "../libdd-telemetry-ffi", default-features = false } datadog-remote-config = { path = "../datadog-remote-config" } -datadog-live-debugger = { path = "../datadog-live-debugger" } +libdd-live-debugger = { path = "../libdd-live-debugger" } libdd-dogstatsd-client = { path = "../libdd-dogstatsd-client" } libdd-tinybytes = { path = "../libdd-tinybytes", features = ["bytes_string"] } paste = "1" diff --git a/datadog-sidecar-ffi/cbindgen.toml b/datadog-sidecar-ffi/cbindgen.toml index d7d8e480f6..4cd2a248b2 100644 --- a/datadog-sidecar-ffi/cbindgen.toml +++ b/datadog-sidecar-ffi/cbindgen.toml @@ -44,4 +44,4 @@ must_use = "DDOG_CHECK_RETURN" [parse] parse_deps = true -include = ["libdd-common", "libdd-telemetry", "datadog-sidecar", "libdd-telemetry-ffi", "libdd-common-ffi", "datadog-ipc", "datadog-live-debugger", "datadog-remote-config"] +include = ["libdd-common", "libdd-telemetry", "datadog-sidecar", "libdd-telemetry-ffi", "libdd-common-ffi", "datadog-ipc", "libdd-live-debugger", "datadog-remote-config"] diff --git a/datadog-sidecar-ffi/src/lib.rs b/datadog-sidecar-ffi/src/lib.rs index e3421dfd8d..8244a6e80f 100644 --- a/datadog-sidecar-ffi/src/lib.rs +++ b/datadog-sidecar-ffi/src/lib.rs @@ -13,7 +13,6 @@ use crate::span::TracesBytes; use datadog_ipc::platform::{ FileBackedHandle, MappedMem, NamedShmHandle, PlatformHandle, ShmHandle, }; -use datadog_live_debugger::debugger_defs::DebuggerPayload; use datadog_remote_config::fetch::ConfigInvariants; use datadog_remote_config::{RemoteConfigCapabilities, RemoteConfigProduct, Target}; use datadog_sidecar::agent_remote_config::{ @@ -39,6 +38,7 @@ use libdd_common_ffi::{self as ffi, MaybeError}; #[cfg(windows)] use libdd_crashtracker_ffi::Metadata; use libdd_dogstatsd_client::DogStatsDActionOwned; +use libdd_live_debugger::debugger_defs::DebuggerPayload; use libdd_telemetry::{ data::{self, Dependency, Integration}, worker::{LifecycleAction, LogIdentifier, TelemetryActions}, diff --git a/datadog-sidecar/Cargo.toml b/datadog-sidecar/Cargo.toml index a49a57e61b..032f51e200 100644 --- a/datadog-sidecar/Cargo.toml +++ b/datadog-sidecar/Cargo.toml @@ -24,7 +24,7 @@ libdd-telemetry = { path = "../libdd-telemetry", features = ["tracing"] } libdd-data-pipeline = { path = "../libdd-data-pipeline" } libdd-trace-utils = { path = "../libdd-trace-utils" } datadog-remote-config = { path = "../datadog-remote-config" , features = ["live-debugger"]} -datadog-live-debugger = { path = "../datadog-live-debugger" } +libdd-live-debugger = { path = "../libdd-live-debugger" } libdd-crashtracker = { path = "../libdd-crashtracker" } libdd-dogstatsd-client = { path = "../libdd-dogstatsd-client" } libdd-tinybytes = { path = "../libdd-tinybytes" } diff --git a/datadog-sidecar/src/service/blocking.rs b/datadog-sidecar/src/service/blocking.rs index 1b43daffe9..9cb70fe9ae 100644 --- a/datadog-sidecar/src/service/blocking.rs +++ b/datadog-sidecar/src/service/blocking.rs @@ -7,11 +7,11 @@ use super::{ }; use datadog_ipc::platform::{Channel, FileBackedHandle, ShmHandle}; use datadog_ipc::transport::blocking::BlockingTransport; -use datadog_live_debugger::debugger_defs::DebuggerPayload; -use datadog_live_debugger::sender::DebuggerType; use libdd_common::tag::Tag; use libdd_common::MutexExt; use libdd_dogstatsd_client::DogStatsDActionOwned; +use libdd_live_debugger::debugger_defs::DebuggerPayload; +use libdd_live_debugger::sender::DebuggerType; use serde::Serialize; use std::sync::{Mutex, MutexGuard}; use std::{ diff --git a/datadog-sidecar/src/service/debugger_diagnostics_bookkeeper.rs b/datadog-sidecar/src/service/debugger_diagnostics_bookkeeper.rs index 890ebbf2fd..31c4e7d811 100644 --- a/datadog-sidecar/src/service/debugger_diagnostics_bookkeeper.rs +++ b/datadog-sidecar/src/service/debugger_diagnostics_bookkeeper.rs @@ -1,9 +1,7 @@ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/ // SPDX-License-Identifier: Apache-2.0 -use datadog_live_debugger::debugger_defs::{ - DebuggerData, DebuggerPayload, Diagnostics, ProbeStatus, -}; use libdd_common::MutexExt; +use libdd_live_debugger::debugger_defs::{DebuggerData, DebuggerPayload, Diagnostics, ProbeStatus}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; @@ -146,7 +144,7 @@ pub struct DebuggerDiagnosticsBookkeeperStats { #[cfg(test)] mod tests { use super::*; - use datadog_live_debugger::debugger_defs::{ + use libdd_live_debugger::debugger_defs::{ DebuggerData, DebuggerPayload, Diagnostics, ProbeStatus, }; use std::borrow::Cow; diff --git a/datadog-sidecar/src/service/runtime_info.rs b/datadog-sidecar/src/service/runtime_info.rs index bca8c0abad..0f66b5bbff 100644 --- a/datadog-sidecar/src/service/runtime_info.rs +++ b/datadog-sidecar/src/service/runtime_info.rs @@ -6,8 +6,8 @@ use crate::service::session_info::SessionInfo; use crate::service::{ remote_configs::RemoteConfigsGuard, DynamicInstrumentationConfigState, InstanceId, QueueId, }; -use datadog_live_debugger::sender::{generate_tags, PayloadSender}; use libdd_common::{tag::Tag, MutexExt}; +use libdd_live_debugger::sender::{generate_tags, PayloadSender}; use simd_json::prelude::ArrayTrait; use std::collections::HashMap; use std::fmt::Display; @@ -100,7 +100,7 @@ impl ActiveApplication { /// # Returns /// /// * `Arc` - A percent encoded string to be passed to - /// datadog_live_debugger::sender::send. + /// libdd_live_debugger::sender::send. /// * `bool` - Whether new tags were set and a new sender needs to be started. pub fn get_debugger_tags( &mut self, diff --git a/datadog-sidecar/src/service/session_info.rs b/datadog-sidecar/src/service/session_info.rs index 6ae0c1d0ce..10e191601e 100644 --- a/datadog-sidecar/src/service/session_info.rs +++ b/datadog-sidecar/src/service/session_info.rs @@ -12,9 +12,9 @@ use futures::future; use crate::log::{MultiEnvFilterGuard, MultiWriterGuard}; use crate::{spawn_map_err, tracer}; -use datadog_live_debugger::sender::{DebuggerType, PayloadSender}; use datadog_remote_config::fetch::ConfigOptions; use libdd_common::MutexExt; +use libdd_live_debugger::sender::{DebuggerType, PayloadSender}; use tracing::log::warn; use tracing::{debug, error, info, trace}; @@ -29,7 +29,7 @@ use crate::service::{InstanceId, QueueId, RuntimeInfo}; pub(crate) struct SessionInfo { runtimes: Arc>>, pub(crate) session_config: Arc>>, - debugger_config: Arc>, + debugger_config: Arc>, tracer_config: Arc>, dogstatsd: Arc>>, remote_config_options: Arc>>, @@ -191,13 +191,13 @@ impl SessionInfo { f(&mut self.get_dogstatsd()); } - pub fn get_debugger_config(&self) -> MutexGuard<'_, datadog_live_debugger::sender::Config> { + pub fn get_debugger_config(&self) -> MutexGuard<'_, libdd_live_debugger::sender::Config> { self.debugger_config.lock_or_panic() } pub fn modify_debugger_config(&self, mut f: F) where - F: FnMut(&mut datadog_live_debugger::sender::Config), + F: FnMut(&mut libdd_live_debugger::sender::Config), { f(&mut self.get_debugger_config()); } @@ -218,7 +218,7 @@ impl SessionInfo { payload: R, ) { async fn do_send( - config: Arc>, + config: Arc>, debugger_type: DebuggerType, new_tags: bool, tags: Arc, @@ -264,7 +264,7 @@ impl SessionInfo { } async fn send + Sync + Send>( - config: Arc>, + config: Arc>, debugger_type: DebuggerType, new_tags: bool, tags: Arc, diff --git a/datadog-sidecar/src/service/sidecar_interface.rs b/datadog-sidecar/src/service/sidecar_interface.rs index 84ec58558e..baf416a938 100644 --- a/datadog-sidecar/src/service/sidecar_interface.rs +++ b/datadog-sidecar/src/service/sidecar_interface.rs @@ -10,9 +10,9 @@ use crate::service::{ use anyhow::Result; use datadog_ipc::platform::ShmHandle; use datadog_ipc::tarpc; -use datadog_live_debugger::sender::DebuggerType; use libdd_common::tag::Tag; use libdd_dogstatsd_client::DogStatsDActionOwned; +use libdd_live_debugger::sender::DebuggerType; use serde::{Deserialize, Serialize}; use std::time::Duration; diff --git a/datadog-sidecar/src/service/sidecar_server.rs b/datadog-sidecar/src/service/sidecar_server.rs index fdc914972b..00c1caaa13 100644 --- a/datadog-sidecar/src/service/sidecar_server.rs +++ b/datadog-sidecar/src/service/sidecar_server.rs @@ -47,12 +47,10 @@ use crate::service::tracing::trace_flusher::TraceFlusherStats; use crate::tokio_util::run_or_spawn_shared; use datadog_ipc::platform::FileBackedHandle; use datadog_ipc::tarpc::server::{Channel, InFlightRequest}; -use datadog_live_debugger::sender::{ - agent_info_supports_dedicated_snapshots_endpoint, DebuggerType, -}; use datadog_remote_config::fetch::{ConfigInvariants, ConfigOptions, MultiTargetStats}; use libdd_common::tag::Tag; use libdd_dogstatsd_client::{new, DogStatsDActionOwned}; +use libdd_live_debugger::sender::{agent_info_supports_dedicated_snapshots_endpoint, DebuggerType}; use libdd_telemetry::config::Config; use libdd_tinybytes as tinybytes; use libdd_trace_utils::tracer_header_tags::TracerHeaderTags; @@ -585,11 +583,11 @@ impl SidecarInterface for SidecarServer { }); session.modify_debugger_config(|cfg| { let logs_endpoint = get_product_endpoint( - datadog_live_debugger::sender::PROD_LOGS_INTAKE_SUBDOMAIN, + libdd_live_debugger::sender::PROD_LOGS_INTAKE_SUBDOMAIN, &config.endpoint, ); let diagnostics_endpoint = get_product_endpoint( - datadog_live_debugger::sender::PROD_DIAGNOSTICS_INTAKE_SUBDOMAIN, + libdd_live_debugger::sender::PROD_DIAGNOSTICS_INTAKE_SUBDOMAIN, &config.endpoint, ); cfg.set_endpoint(logs_endpoint, diagnostics_endpoint).ok(); diff --git a/datadog-live-debugger-ffi/Cargo.toml b/libdd-live-debugger-ffi/Cargo.toml similarity index 72% rename from datadog-live-debugger-ffi/Cargo.toml rename to libdd-live-debugger-ffi/Cargo.toml index 466e87a0bd..17a1979cc0 100644 --- a/datadog-live-debugger-ffi/Cargo.toml +++ b/libdd-live-debugger-ffi/Cargo.toml @@ -2,9 +2,13 @@ # This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. [package] -name = "datadog-live-debugger-ffi" -version = "0.0.1" -edition = "2021" +name = "libdd-live-debugger-ffi" +version = "1.0.0" +repository = "https://github.com/DataDog/libdatadog/tree/main/libdd-live-debugger-ffi" +edition.workspace = true +rust-version.workspace = true +license.workspace = true +authors.workspace = true publish = false [lib] @@ -12,7 +16,7 @@ crate-type = ["lib", "staticlib", "cdylib"] bench = false [dependencies] -datadog-live-debugger = { path = "../datadog-live-debugger" } +libdd-live-debugger = { path = "../libdd-live-debugger" } libdd-common = { path = "../libdd-common" } libdd-common-ffi = { path = "../libdd-common-ffi", default-features = false } percent-encoding = "2.1" diff --git a/datadog-live-debugger-ffi/build.rs b/libdd-live-debugger-ffi/build.rs similarity index 100% rename from datadog-live-debugger-ffi/build.rs rename to libdd-live-debugger-ffi/build.rs diff --git a/datadog-live-debugger-ffi/cbindgen.toml b/libdd-live-debugger-ffi/cbindgen.toml similarity index 94% rename from datadog-live-debugger-ffi/cbindgen.toml rename to libdd-live-debugger-ffi/cbindgen.toml index cf1b7af5aa..e71911db20 100644 --- a/datadog-live-debugger-ffi/cbindgen.toml +++ b/libdd-live-debugger-ffi/cbindgen.toml @@ -32,4 +32,4 @@ must_use = "DDOG_CHECK_RETURN" [parse] parse_deps = true -include = ["datadog-live-debugger", "libdd-common-ffi"] +include = ["libdd-live-debugger", "libdd-common-ffi"] diff --git a/datadog-live-debugger-ffi/src/data.rs b/libdd-live-debugger-ffi/src/data.rs similarity index 80% rename from datadog-live-debugger-ffi/src/data.rs rename to libdd-live-debugger-ffi/src/data.rs index 58f32900d0..556911d3fa 100644 --- a/datadog-live-debugger-ffi/src/data.rs +++ b/libdd-live-debugger-ffi/src/data.rs @@ -1,13 +1,13 @@ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache // License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. -use datadog_live_debugger::debugger_defs::{ProbeMetadata, ProbeMetadataLocation, ProbeStatus}; -use datadog_live_debugger::{ +use libdd_common_ffi::slice::AsBytes; +use libdd_common_ffi::{CharSlice, Option}; +use libdd_live_debugger::debugger_defs::{ProbeMetadata, ProbeMetadataLocation, ProbeStatus}; +use libdd_live_debugger::{ CaptureConfiguration, DslString, EvaluateAt, InBodyLocation, MetricKind, ProbeCondition, ProbeValue, SpanProbeTarget, }; -use libdd_common_ffi::slice::AsBytes; -use libdd_common_ffi::{CharSlice, Option}; use std::borrow::Cow; #[repr(C)] @@ -47,8 +47,8 @@ pub struct MetricProbe<'a> { pub value: &'a ProbeValue, } -impl<'a> From<&'a datadog_live_debugger::MetricProbe> for MetricProbe<'a> { - fn from(from: &'a datadog_live_debugger::MetricProbe) -> Self { +impl<'a> From<&'a libdd_live_debugger::MetricProbe> for MetricProbe<'a> { + fn from(from: &'a libdd_live_debugger::MetricProbe) -> Self { MetricProbe { kind: from.kind, name: from.name.as_str().into(), @@ -66,8 +66,8 @@ pub struct LogProbe<'a> { pub sampling_snapshots_per_second: u32, } -impl<'a> From<&'a datadog_live_debugger::LogProbe> for LogProbe<'a> { - fn from(from: &'a datadog_live_debugger::LogProbe) -> Self { +impl<'a> From<&'a libdd_live_debugger::LogProbe> for LogProbe<'a> { + fn from(from: &'a libdd_live_debugger::LogProbe) -> Self { LogProbe { segments: &from.segments, when: &from.when, @@ -98,8 +98,8 @@ pub struct SpanDecorationProbe<'a> { pub span_tags_num: usize, } -impl<'a> From<&'a datadog_live_debugger::SpanDecorationProbe> for SpanDecorationProbe<'a> { - fn from(from: &'a datadog_live_debugger::SpanDecorationProbe) -> Self { +impl<'a> From<&'a libdd_live_debugger::SpanDecorationProbe> for SpanDecorationProbe<'a> { + fn from(from: &'a libdd_live_debugger::SpanDecorationProbe) -> Self { let mut tags = vec![]; let mut conditions = vec![]; for decoration in from.decorations.iter() { @@ -157,13 +157,13 @@ pub enum ProbeType<'a> { SpanDecoration(SpanDecorationProbe<'a>), } -impl<'a> From<&'a datadog_live_debugger::ProbeType> for ProbeType<'a> { - fn from(from: &'a datadog_live_debugger::ProbeType) -> Self { +impl<'a> From<&'a libdd_live_debugger::ProbeType> for ProbeType<'a> { + fn from(from: &'a libdd_live_debugger::ProbeType) -> Self { match from { - datadog_live_debugger::ProbeType::Metric(metric) => ProbeType::Metric(metric.into()), - datadog_live_debugger::ProbeType::Log(log) => ProbeType::Log(log.into()), - datadog_live_debugger::ProbeType::Span(_) => ProbeType::Span, - datadog_live_debugger::ProbeType::SpanDecoration(span_decoration) => { + libdd_live_debugger::ProbeType::Metric(metric) => ProbeType::Metric(metric.into()), + libdd_live_debugger::ProbeType::Log(log) => ProbeType::Log(log.into()), + libdd_live_debugger::ProbeType::Span(_) => ProbeType::Span, + libdd_live_debugger::ProbeType::SpanDecoration(span_decoration) => { ProbeType::SpanDecoration(span_decoration.into()) } } @@ -181,8 +181,8 @@ pub struct ProbeTarget<'a> { pub in_body_location: InBodyLocation, } -impl<'a> From<&'a datadog_live_debugger::ProbeTarget> for ProbeTarget<'a> { - fn from(from: &'a datadog_live_debugger::ProbeTarget) -> Self { +impl<'a> From<&'a libdd_live_debugger::ProbeTarget> for ProbeTarget<'a> { + fn from(from: &'a libdd_live_debugger::ProbeTarget) -> Self { ProbeTarget { type_name: from .type_name @@ -220,8 +220,8 @@ pub struct Probe<'a> { pub status_stacktrace: CharSlice<'a>, } -impl<'a> From<&'a datadog_live_debugger::Probe> for Probe<'a> { - fn from(from: &'a datadog_live_debugger::Probe) -> Self { +impl<'a> From<&'a libdd_live_debugger::Probe> for Probe<'a> { + fn from(from: &'a libdd_live_debugger::Probe) -> Self { Probe { id: from.id.as_str().into(), version: from.version, @@ -268,8 +268,8 @@ pub struct FilterList<'a> { pub classes: CharSliceVec<'a>, } -impl<'a> From<&'a datadog_live_debugger::FilterList> for FilterList<'a> { - fn from(from: &'a datadog_live_debugger::FilterList) -> Self { +impl<'a> From<&'a libdd_live_debugger::FilterList> for FilterList<'a> { + fn from(from: &'a libdd_live_debugger::FilterList) -> Self { FilterList { package_prefixes: (&from.package_prefixes).into(), classes: (&from.classes).into(), @@ -285,8 +285,8 @@ pub struct ServiceConfiguration<'a> { pub sampling_snapshots_per_second: u32, } -impl<'a> From<&'a datadog_live_debugger::ServiceConfiguration> for ServiceConfiguration<'a> { - fn from(from: &'a datadog_live_debugger::ServiceConfiguration) -> Self { +impl<'a> From<&'a libdd_live_debugger::ServiceConfiguration> for ServiceConfiguration<'a> { + fn from(from: &'a libdd_live_debugger::ServiceConfiguration) -> Self { ServiceConfiguration { id: from.id.as_str().into(), allow: (&from.allow).into(), @@ -303,13 +303,13 @@ pub enum LiveDebuggingData<'a> { ServiceConfiguration(ServiceConfiguration<'a>), } -impl<'a> From<&'a datadog_live_debugger::LiveDebuggingData> for LiveDebuggingData<'a> { - fn from(from: &'a datadog_live_debugger::LiveDebuggingData) -> Self { +impl<'a> From<&'a libdd_live_debugger::LiveDebuggingData> for LiveDebuggingData<'a> { + fn from(from: &'a libdd_live_debugger::LiveDebuggingData) -> Self { match from { - datadog_live_debugger::LiveDebuggingData::Probe(probe) => { + libdd_live_debugger::LiveDebuggingData::Probe(probe) => { LiveDebuggingData::Probe(probe.into()) } - datadog_live_debugger::LiveDebuggingData::ServiceConfiguration(config) => { + libdd_live_debugger::LiveDebuggingData::ServiceConfiguration(config) => { LiveDebuggingData::ServiceConfiguration(config.into()) } } diff --git a/datadog-live-debugger-ffi/src/evaluator.rs b/libdd-live-debugger-ffi/src/evaluator.rs similarity index 84% rename from datadog-live-debugger-ffi/src/evaluator.rs rename to libdd-live-debugger-ffi/src/evaluator.rs index a3c690799d..4165037850 100644 --- a/datadog-live-debugger-ffi/src/evaluator.rs +++ b/libdd-live-debugger-ffi/src/evaluator.rs @@ -1,10 +1,10 @@ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache // License Version 2.0. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc. -use datadog_live_debugger::debugger_defs::SnapshotEvaluationError; -use datadog_live_debugger::{DslString, ProbeCondition, ProbeValue, ResultError, ResultValue}; use libdd_common_ffi::slice::AsBytes; use libdd_common_ffi::CharSlice; +use libdd_live_debugger::debugger_defs::SnapshotEvaluationError; +use libdd_live_debugger::{DslString, ProbeCondition, ProbeValue, ResultError, ResultValue}; use std::borrow::Cow; use std::ffi::c_void; @@ -17,16 +17,16 @@ pub enum IntermediateValue<'a> { Referenced(&'a c_void), } -impl<'a> From<&'a datadog_live_debugger::IntermediateValue<'a, c_void>> for IntermediateValue<'a> { - fn from(value: &'a datadog_live_debugger::IntermediateValue<'a, c_void>) -> Self { +impl<'a> From<&'a libdd_live_debugger::IntermediateValue<'a, c_void>> for IntermediateValue<'a> { + fn from(value: &'a libdd_live_debugger::IntermediateValue<'a, c_void>) -> Self { match value { - datadog_live_debugger::IntermediateValue::String(s) => { + libdd_live_debugger::IntermediateValue::String(s) => { IntermediateValue::String(s.as_ref().into()) } - datadog_live_debugger::IntermediateValue::Number(n) => IntermediateValue::Number(*n), - datadog_live_debugger::IntermediateValue::Bool(b) => IntermediateValue::Bool(*b), - datadog_live_debugger::IntermediateValue::Null => IntermediateValue::Null, - datadog_live_debugger::IntermediateValue::Referenced(value) => { + libdd_live_debugger::IntermediateValue::Number(n) => IntermediateValue::Number(*n), + libdd_live_debugger::IntermediateValue::Bool(b) => IntermediateValue::Bool(*b), + libdd_live_debugger::IntermediateValue::Null => IntermediateValue::Null, + libdd_live_debugger::IntermediateValue::Referenced(value) => { IntermediateValue::Referenced(value) } } @@ -101,27 +101,27 @@ fn to_fetch_result<'e>(value: *const c_void) -> ResultValue<&'e c_void> { } } -impl<'e> datadog_live_debugger::Evaluator<'e, c_void> for EvalCtx<'e> { +impl<'e> libdd_live_debugger::Evaluator<'e, c_void> for EvalCtx<'e> { fn equals( &mut self, - a: datadog_live_debugger::IntermediateValue<'e, c_void>, - b: datadog_live_debugger::IntermediateValue<'e, c_void>, + a: libdd_live_debugger::IntermediateValue<'e, c_void>, + b: libdd_live_debugger::IntermediateValue<'e, c_void>, ) -> bool { (self.eval.equals)(self.context, (&a).into(), (&b).into()) } fn greater_than( &mut self, - a: datadog_live_debugger::IntermediateValue<'e, c_void>, - b: datadog_live_debugger::IntermediateValue<'e, c_void>, + a: libdd_live_debugger::IntermediateValue<'e, c_void>, + b: libdd_live_debugger::IntermediateValue<'e, c_void>, ) -> bool { (self.eval.greater_than)(self.context, (&a).into(), (&b).into()) } fn greater_or_equals( &mut self, - a: datadog_live_debugger::IntermediateValue<'e, c_void>, - b: datadog_live_debugger::IntermediateValue<'e, c_void>, + a: libdd_live_debugger::IntermediateValue<'e, c_void>, + b: libdd_live_debugger::IntermediateValue<'e, c_void>, ) -> bool { (self.eval.greater_or_equals)(self.context, (&a).into(), (&b).into()) } @@ -136,7 +136,7 @@ impl<'e> datadog_live_debugger::Evaluator<'e, c_void> for EvalCtx<'e> { fn fetch_index( &mut self, value: &'e c_void, - index: datadog_live_debugger::IntermediateValue<'e, c_void>, + index: libdd_live_debugger::IntermediateValue<'e, c_void>, ) -> ResultValue<&'e c_void> { to_fetch_result((self.eval.fetch_index)( self.context, @@ -148,7 +148,7 @@ impl<'e> datadog_live_debugger::Evaluator<'e, c_void> for EvalCtx<'e> { fn fetch_nested( &mut self, value: &'e c_void, - member: datadog_live_debugger::IntermediateValue<'e, c_void>, + member: libdd_live_debugger::IntermediateValue<'e, c_void>, ) -> ResultValue<&'e c_void> { to_fetch_result((self.eval.fetch_nested)( self.context, @@ -225,7 +225,7 @@ pub extern "C" fn ddog_evaluate_condition( context: &mut c_void, ) -> ConditionEvaluationResult { let mut ctx = EvalCtx::new(context); - match datadog_live_debugger::eval_condition(&mut ctx, condition) { + match libdd_live_debugger::eval_condition(&mut ctx, condition) { Ok(true) => ConditionEvaluationResult::Success, Ok(false) => ConditionEvaluationResult::Failure, Err(error) => ConditionEvaluationResult::Error(Box::new(vec![error])), @@ -238,7 +238,7 @@ pub fn ddog_evaluate_string<'a>( errors: &mut Option>>, ) -> Cow<'a, str> { let mut ctx = EvalCtx::new(context); - let (result, new_errors) = datadog_live_debugger::eval_string(&mut ctx, condition); + let (result, new_errors) = libdd_live_debugger::eval_string(&mut ctx, condition); let found_errors = if !new_errors.is_empty() { Some(Box::new(new_errors)) } else { @@ -280,7 +280,7 @@ pub extern "C" fn ddog_evaluate_unmanaged_string( into_void_collection_string(&ddog_evaluate_string(segments, context, errors)) } -pub struct InternalIntermediateValue<'a>(datadog_live_debugger::IntermediateValue<'a, c_void>); +pub struct InternalIntermediateValue<'a>(libdd_live_debugger::IntermediateValue<'a, c_void>); #[repr(C)] pub enum ValueEvaluationResult<'a> { @@ -294,7 +294,7 @@ pub extern "C" fn ddog_evaluate_value<'a>( context: &'a mut c_void, ) -> ValueEvaluationResult<'a> { let mut ctx = EvalCtx::new(context); - match datadog_live_debugger::eval_value(&mut ctx, value) { + match libdd_live_debugger::eval_value(&mut ctx, value) { Ok(value) => ValueEvaluationResult::Success(Box::new(InternalIntermediateValue(value))), Err(error) => ValueEvaluationResult::Error(Box::new(vec![error])), } @@ -316,7 +316,7 @@ pub fn ddog_evaluated_value_into_string<'a>( context: &'a mut c_void, ) -> Cow<'a, str> { let mut ctx = EvalCtx::new(context); - datadog_live_debugger::eval_intermediate_to_string(&mut ctx, value.0) + libdd_live_debugger::eval_intermediate_to_string(&mut ctx, value.0) } #[no_mangle] diff --git a/datadog-live-debugger-ffi/src/lib.rs b/libdd-live-debugger-ffi/src/lib.rs similarity index 100% rename from datadog-live-debugger-ffi/src/lib.rs rename to libdd-live-debugger-ffi/src/lib.rs diff --git a/datadog-live-debugger-ffi/src/parse.rs b/libdd-live-debugger-ffi/src/parse.rs similarity index 77% rename from datadog-live-debugger-ffi/src/parse.rs rename to libdd-live-debugger-ffi/src/parse.rs index fb1e46dc60..738a5ff4f8 100644 --- a/datadog-live-debugger-ffi/src/parse.rs +++ b/libdd-live-debugger-ffi/src/parse.rs @@ -8,7 +8,7 @@ use libdd_common_ffi::CharSlice; #[repr(C)] pub struct LiveDebuggingParseResult { pub data: LiveDebuggingData<'static>, - opaque_data: Option>, + opaque_data: Option>, } /// # Safety @@ -17,15 +17,13 @@ pub struct LiveDebuggingParseResult { pub unsafe extern "C" fn ddog_parse_live_debugger_json( json: CharSlice, ) -> LiveDebuggingParseResult { - if let Ok(parsed) = datadog_live_debugger::parse_json(unsafe { json.assume_utf8() }) { + if let Ok(parsed) = libdd_live_debugger::parse_json(unsafe { json.assume_utf8() }) { let parsed = Box::new(parsed); LiveDebuggingParseResult { // we have the box. Rust doesn't allow us to specify a self-referential struct, so // pretend it's 'static data: unsafe { - std::mem::transmute::<&_, &'static datadog_live_debugger::LiveDebuggingData>( - &*parsed, - ) + std::mem::transmute::<&_, &'static libdd_live_debugger::LiveDebuggingData>(&*parsed) } .into(), opaque_data: Some(parsed), diff --git a/datadog-live-debugger-ffi/src/send_data.rs b/libdd-live-debugger-ffi/src/send_data.rs similarity index 99% rename from datadog-live-debugger-ffi/src/send_data.rs rename to libdd-live-debugger-ffi/src/send_data.rs index 35e13fe09e..2e76cfff72 100644 --- a/datadog-live-debugger-ffi/src/send_data.rs +++ b/libdd-live-debugger-ffi/src/send_data.rs @@ -7,16 +7,16 @@ use std::collections::hash_map; use std::mem::transmute; // Alias to prevent cbindgen panic use crate::data::Probe; -use datadog_live_debugger::debugger_defs::{ +use libdd_common_ffi::slice::AsBytes; +use libdd_live_debugger::debugger_defs::{ Capture as DebuggerCaptureAlias, Capture, Captures, DebuggerData, DebuggerPayload, Diagnostics, DiagnosticsError, Entry, Fields, ProbeMetadata, ProbeMetadataLocation, ProbeStatus, Snapshot, SnapshotEvaluationError, SnapshotStackFrame, Value as DebuggerValueAlias, }; -use datadog_live_debugger::sender::generate_new_id; -use datadog_live_debugger::{ +use libdd_live_debugger::sender::generate_new_id; +use libdd_live_debugger::{ add_redacted_name, add_redacted_type, is_redacted_name, is_redacted_type, }; -use libdd_common_ffi::slice::AsBytes; #[repr(C)] pub enum FieldType { diff --git a/datadog-live-debugger-ffi/src/sender.rs b/libdd-live-debugger-ffi/src/sender.rs similarity index 96% rename from datadog-live-debugger-ffi/src/sender.rs rename to libdd-live-debugger-ffi/src/sender.rs index bac5bf11e4..986a5f1d52 100644 --- a/datadog-live-debugger-ffi/src/sender.rs +++ b/libdd-live-debugger-ffi/src/sender.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::send_data::serialize_debugger_payload; -use datadog_live_debugger::debugger_defs::DebuggerPayload; -use datadog_live_debugger::sender; -use datadog_live_debugger::sender::{generate_tags, Config, DebuggerType}; use libdd_common::tag::Tag; use libdd_common::Endpoint; use libdd_common_ffi::slice::AsBytes; use libdd_common_ffi::{CharSlice, MaybeError}; +use libdd_live_debugger::debugger_defs::DebuggerPayload; +use libdd_live_debugger::sender; +use libdd_live_debugger::sender::{generate_tags, Config, DebuggerType}; use log::{debug, warn}; use percent_encoding::{percent_encode, CONTROLS}; use std::sync::Arc; diff --git a/datadog-live-debugger/Cargo.toml b/libdd-live-debugger/Cargo.toml similarity index 55% rename from datadog-live-debugger/Cargo.toml rename to libdd-live-debugger/Cargo.toml index 96869221ec..32060caa80 100644 --- a/datadog-live-debugger/Cargo.toml +++ b/libdd-live-debugger/Cargo.toml @@ -1,9 +1,12 @@ [package] -edition = "2021" -license = "Apache 2.0" -name = "datadog-live-debugger" -version = "0.0.1" -publish = false +name = "libdd-live-debugger" +version = "1.0.0" +description = "A Rust library for dynamic runtime instrumentation that captures snapshots, metrics, and trace data via remotely-configured probes." +repository = "https://github.com/DataDog/libdatadog/tree/main/libdd-live-debugger" +edition.workspace = true +rust-version.workspace = true +license.workspace = true +authors.workspace = true [dependencies] anyhow = "1.0" diff --git a/datadog-live-debugger/src/debugger_defs.rs b/libdd-live-debugger/src/debugger_defs.rs similarity index 100% rename from datadog-live-debugger/src/debugger_defs.rs rename to libdd-live-debugger/src/debugger_defs.rs diff --git a/datadog-live-debugger/src/expr_defs.rs b/libdd-live-debugger/src/expr_defs.rs similarity index 100% rename from datadog-live-debugger/src/expr_defs.rs rename to libdd-live-debugger/src/expr_defs.rs diff --git a/datadog-live-debugger/src/expr_eval.rs b/libdd-live-debugger/src/expr_eval.rs similarity index 100% rename from datadog-live-debugger/src/expr_eval.rs rename to libdd-live-debugger/src/expr_eval.rs diff --git a/datadog-live-debugger/src/lib.rs b/libdd-live-debugger/src/lib.rs similarity index 100% rename from datadog-live-debugger/src/lib.rs rename to libdd-live-debugger/src/lib.rs diff --git a/datadog-live-debugger/src/parse_json.rs b/libdd-live-debugger/src/parse_json.rs similarity index 100% rename from datadog-live-debugger/src/parse_json.rs rename to libdd-live-debugger/src/parse_json.rs diff --git a/datadog-live-debugger/src/probe_defs.rs b/libdd-live-debugger/src/probe_defs.rs similarity index 100% rename from datadog-live-debugger/src/probe_defs.rs rename to libdd-live-debugger/src/probe_defs.rs diff --git a/datadog-live-debugger/src/redacted_names.rs b/libdd-live-debugger/src/redacted_names.rs similarity index 100% rename from datadog-live-debugger/src/redacted_names.rs rename to libdd-live-debugger/src/redacted_names.rs diff --git a/datadog-live-debugger/src/sender.rs b/libdd-live-debugger/src/sender.rs similarity index 100% rename from datadog-live-debugger/src/sender.rs rename to libdd-live-debugger/src/sender.rs diff --git a/tools/docker/Dockerfile.build b/tools/docker/Dockerfile.build index e0246a59c5..5ed646dc29 100644 --- a/tools/docker/Dockerfile.build +++ b/tools/docker/Dockerfile.build @@ -83,8 +83,8 @@ COPY "libdd-log-ffi/Cargo.toml" "libdd-log-ffi/" COPY "libdd-dogstatsd-client/Cargo.toml" "libdd-dogstatsd-client/" COPY "libdd-library-config-ffi/Cargo.toml" "libdd-library-config-ffi/" COPY "libdd-library-config/Cargo.toml" "libdd-library-config/" -COPY "datadog-live-debugger/Cargo.toml" "datadog-live-debugger/" -COPY "datadog-live-debugger-ffi/Cargo.toml" "datadog-live-debugger-ffi/" +COPY "libdd-live-debugger/Cargo.toml" "libdd-live-debugger/" +COPY "libdd-live-debugger-ffi/Cargo.toml" "libdd-live-debugger-ffi/" COPY "libdd-profiling/Cargo.toml" "libdd-profiling/" COPY "libdd-profiling-ffi/Cargo.toml" "libdd-profiling-ffi/" COPY "libdd-profiling-protobuf/Cargo.toml" "libdd-profiling-protobuf/"