Skip to content

Commit dba7a20

Browse files
committed
feat(logging): logging in libdatadog
1 parent 937a26b commit dba7a20

File tree

32 files changed

+1444
-53
lines changed

32 files changed

+1444
-53
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ jobs:
138138
env:
139139
RUSTFLAGS: "${{ matrix.flags }}"
140140
run: |
141-
cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker,library-config --release -- --out $LIBDD_OUTPUT_FOLDER
141+
cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker,library-config,log --release -- --out $LIBDD_OUTPUT_FOLDER
142142
143143
- name: 'Publish libdatadog'
144144
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6.1

Cargo.lock

Lines changed: 56 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ members = [
4141
"ddsketch",
4242
"tinybytes",
4343
"dogstatsd-client",
44+
"datadog-log",
45+
"datadog-log-ffi"
4446
]
4547

4648
# https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2

LICENSE-3rdparty.yml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
root_name: builder, build_common, tools, datadog-alloc, datadog-crashtracker, ddcommon, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, tinybytes, spawn_worker, cc_utils, datadog-library-config, datadog-library-config-ffi, datadog-live-debugger, datadog-live-debugger-ffi, datadog-profiling, datadog-profiling-protobuf, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-protobuf, datadog-trace-utils, datadog-trace-normalization, dogstatsd-client, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, datadog-remote-config, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, datadog-trace-obfuscation, datadog-tracer-flare, sidecar_mockgen, test_spawn_from_lib
1+
root_name: builder, build_common, tools, datadog-alloc, datadog-crashtracker, ddcommon, ddtelemetry, datadog-ddsketch, datadog-crashtracker-ffi, ddcommon-ffi, datadog-ipc, datadog-ipc-macros, tarpc, tarpc-plugins, tinybytes, spawn_worker, cc_utils, datadog-library-config, datadog-library-config-ffi, datadog-live-debugger, datadog-live-debugger-ffi, datadog-profiling, datadog-profiling-protobuf, datadog-profiling-ffi, data-pipeline-ffi, data-pipeline, datadog-trace-protobuf, datadog-trace-utils, datadog-trace-normalization, dogstatsd-client, datadog-log-ffi, datadog-log, ddtelemetry-ffi, symbolizer-ffi, datadog-profiling-replayer, datadog-remote-config, datadog-sidecar, datadog-sidecar-macros, datadog-sidecar-ffi, datadog-trace-obfuscation, datadog-tracer-flare, sidecar_mockgen, test_spawn_from_lib
22
third_party_libraries:
33
- package_name: addr2line
44
package_version: 0.24.2
@@ -32012,7 +32012,39 @@ third_party_libraries:
3201232012
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3201332013
DEALINGS IN THE SOFTWARE.
3201432014
- package_name: tracing
32015-
package_version: 0.1.40
32015+
package_version: 0.1.41
32016+
repository: https://github.com/tokio-rs/tracing
32017+
license: MIT
32018+
licenses:
32019+
- license: MIT
32020+
text: |
32021+
Copyright (c) 2019 Tokio Contributors
32022+
32023+
Permission is hereby granted, free of charge, to any
32024+
person obtaining a copy of this software and associated
32025+
documentation files (the "Software"), to deal in the
32026+
Software without restriction, including without
32027+
limitation the rights to use, copy, modify, merge,
32028+
publish, distribute, sublicense, and/or sell copies of
32029+
the Software, and to permit persons to whom the Software
32030+
is furnished to do so, subject to the following
32031+
conditions:
32032+
32033+
The above copyright notice and this permission notice
32034+
shall be included in all copies or substantial portions
32035+
of the Software.
32036+
32037+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
32038+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32039+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32040+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
32041+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
32042+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32043+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
32044+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32045+
DEALINGS IN THE SOFTWARE.
32046+
- package_name: tracing-appender
32047+
package_version: 0.2.3
3201632048
repository: https://github.com/tokio-rs/tracing
3201732049
license: MIT
3201832050
licenses:
@@ -32044,7 +32076,7 @@ third_party_libraries:
3204432076
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3204532077
DEALINGS IN THE SOFTWARE.
3204632078
- package_name: tracing-attributes
32047-
package_version: 0.1.27
32079+
package_version: 0.1.28
3204832080
repository: https://github.com/tokio-rs/tracing
3204932081
license: MIT
3205032082
licenses:
@@ -32076,7 +32108,7 @@ third_party_libraries:
3207632108
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3207732109
DEALINGS IN THE SOFTWARE.
3207832110
- package_name: tracing-core
32079-
package_version: 0.1.32
32111+
package_version: 0.1.33
3208032112
repository: https://github.com/tokio-rs/tracing
3208132113
license: MIT
3208232114
licenses:
@@ -32139,8 +32171,40 @@ third_party_libraries:
3213932171
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
3214032172
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
3214132173
DEALINGS IN THE SOFTWARE.
32174+
- package_name: tracing-serde
32175+
package_version: 0.2.0
32176+
repository: https://github.com/tokio-rs/tracing
32177+
license: MIT
32178+
licenses:
32179+
- license: MIT
32180+
text: |
32181+
Copyright (c) 2019 Tokio Contributors
32182+
32183+
Permission is hereby granted, free of charge, to any
32184+
person obtaining a copy of this software and associated
32185+
documentation files (the "Software"), to deal in the
32186+
Software without restriction, including without
32187+
limitation the rights to use, copy, modify, merge,
32188+
publish, distribute, sublicense, and/or sell copies of
32189+
the Software, and to permit persons to whom the Software
32190+
is furnished to do so, subject to the following
32191+
conditions:
32192+
32193+
The above copyright notice and this permission notice
32194+
shall be included in all copies or substantial portions
32195+
of the Software.
32196+
32197+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
32198+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32199+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
32200+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
32201+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
32202+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32203+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
32204+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32205+
DEALINGS IN THE SOFTWARE.
3214232206
- package_name: tracing-subscriber
32143-
package_version: 0.3.18
32207+
package_version: 0.3.19
3214432208
repository: https://github.com/tokio-rs/tracing
3214532209
license: MIT
3214632210
licenses:

build-profiling-ffi.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ FEATURES=(
152152
"datadog-profiling-ffi/ddtelemetry-ffi"
153153
"datadog-profiling-ffi/demangler"
154154
"datadog-library-config-ffi"
155+
"datadog-log-ffi"
155156
)
156157
if [[ "$symbolizer" -eq 1 ]]; then
157158
FEATURES+=("symbolizer")
@@ -236,7 +237,7 @@ echo "Generating $destdir/include/libdatadog headers..."
236237
rm -r $destdir/include/datadog/
237238
mkdir $destdir/include/datadog/
238239

239-
CBINDGEN_HEADERS="common.h profiling.h telemetry.h crashtracker.h data-pipeline.h library-config.h"
240+
CBINDGEN_HEADERS="common.h profiling.h telemetry.h crashtracker.h data-pipeline.h library-config.h log.h"
240241
# When optional features are added, don't forget to also include the headers here
241242
case $ARG_FEATURES in
242243
esac

builder/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ telemetry = []
1414
data-pipeline = []
1515
symbolizer = []
1616
library-config = []
17+
log = []
1718

1819
[lib]
1920
bench = false

builder/src/bin/release.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ pub fn main() {
6868
f.push("symbolizer".to_string());
6969
#[cfg(feature = "library-config")]
7070
f.push("datadog-library-config-ffi".to_string());
71+
#[cfg(feature = "log")]
72+
f.push("datadog-log-ffi".to_string());
7173
f
7274
};
7375

builder/src/profiling.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ impl Profiling {
5353
headers.push("blazesym.h");
5454
#[cfg(feature = "library-config")]
5555
headers.push("library-config.h");
56+
#[cfg(feature = "log")]
57+
headers.push("log.h");
5658

5759
let mut origin_path: PathBuf = [&self.source_include, "dummy.h"].iter().collect();
5860
let mut target_path: PathBuf = [&self.target_include, "dummy.h"].iter().collect();

data-pipeline/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ hyper = { version = "1.6", features = ["http1", "client"] }
1616
hyper-util = { version = "0.1", features = ["client", "client-legacy"] }
1717
http = "1.0"
1818
http-body-util = "0.1"
19-
log = "0.4"
19+
tracing = { version = "0.1", default-features = false }
2020
rmp-serde = "1.1.1"
2121
serde = "1.0.209"
2222
serde_json = "1.0.127"

data-pipeline/src/agent_info/fetcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use ddcommon::hyper_migration;
1010
use ddcommon::Endpoint;
1111
use http_body_util::BodyExt;
1212
use hyper::{self, body::Buf, header::HeaderName};
13-
use log::{error, info};
1413
use std::sync::Arc;
1514
use std::time::Duration;
1615
use tokio::time::sleep;
16+
use tracing::{error, info};
1717

1818
#[allow(clippy::declare_interior_mutable_const)]
1919
const DATADOG_AGENT_STATE: HeaderName = HeaderName::from_static("datadog-agent-state");
@@ -157,7 +157,7 @@ impl AgentInfoFetcher {
157157
info!("Agent info is up-to-date")
158158
}
159159
Err(err) => {
160-
error!("Error while fetching /info: {}", err);
160+
error!(?err, "Error while fetching /info");
161161
}
162162
}
163163
sleep(self.refresh_interval).await;

0 commit comments

Comments
 (0)