Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/chainguard/self.github.release.push-tags.sts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
issuer: https://token.actions.githubusercontent.com

subject: repo:DataDog/libdatadog-nodejs:environment:npm

claim_pattern:
event_name: push
job_workflow_ref: DataDog/libdatadog-nodejs/\.github/workflows/release\.yml@refs/heads/v[0-9]+\.x
ref: refs/heads/v[0-9]+\.x
repository: DataDog/libdatadog-nodejs

permissions:
contents: write
File renamed without changes.
11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,18 @@ jobs:
environment: npm
permissions:
id-token: write # Required for OIDC
contents: write
contents: read
outputs:
pkgjson: ${{ steps.pkg.outputs.json }}
steps:
- uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3
id: octo-sts
with:
scope: DataDog/libdatadog-nodejs
policy: self.github.release.push-tags
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false # drop GITHUB_TOKEN so the dd-octo-sts token is used for the tag push
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: prebuilds
Expand All @@ -57,4 +64,4 @@ jobs:
echo "json=$content" >> $GITHUB_OUTPUT
- run: |
git tag v${{ fromJson(steps.pkg.outputs.json).version }}
git push origin v${{ fromJson(steps.pkg.outputs.json).version }}
git push https://x-access-token:${{ steps.octo-sts.outputs.token }}@github.com/${{ github.repository }}.git v${{ fromJson(steps.pkg.outputs.json).version }}
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/process_discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
anyhow = "1"
libdd-library-config = { git = "https://github.com/DataDog/libdatadog.git", tag = "v29.0.0" }
libdd-library-config = { git = "https://github.com/DataDog/libdatadog.git", tag = "v35.0.0", features = ["otel-thread-ctx"] }

napi = { version = "2" }
napi-derive = { version = "2", default-features = false }
11 changes: 11 additions & 0 deletions crates/process_discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ pub struct TracerMetadata {
pub service_version: Option<String>,
pub process_tags: Option<String>,
pub container_id: Option<String>,
/// Ordered list of attribute key names for thread-level OTEP-4947
/// context records. Key indices on the wire index into this list.
/// libdatadog's OTel process-context conversion prepends the
/// implicit `datadog.local_root_span_id` entry at wire index 0, so
/// callers should only set their additional keys here — entry 0 in
/// this list corresponds to wire key index 1.
///
/// `null`/omitted (the default) disables the thread-context-related
/// attributes in the OTel process context entirely.
pub threadlocal_attribute_keys: Option<Vec<String>>,
}

#[napi]
Expand All @@ -36,6 +46,7 @@ pub fn store_metadata(data: &TracerMetadata) -> napi::Result<NapiAnonymousFileHa
service_version: data.service_version.clone(),
process_tags: data.process_tags.clone(),
container_id: data.container_id.clone(),
threadlocal_attribute_keys: data.threadlocal_attribute_keys.clone(),
});

match res {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@datadog/libdatadog",
"version": "0.9.4",
"version": "0.10.0",
"description": "Node.js binding for libdatadog",
"main": "index.js",
"scripts": {
Expand Down
21 changes: 21 additions & 0 deletions test/process-discovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ const metadata = new process_discovery.TracerMetadata(
const cfg_handle = process_discovery.storeMetadata(metadata)
assert(cfg_handle !== undefined)

// Same shape, plus a thread-local attribute key map (OTEP-4947). libdatadog
// implicitly prepends `datadog.local_root_span_id` at wire index 0; entries
// here start at wire index 1.
const metadata_with_threadlocal = new process_discovery.TracerMetadata(
'7938685c-19dd-490f-b9b3-8aae4c22f898',
'1.0.0',
'my_hostname',
'my_svc',
'my_env',
'my_version',
undefined,
undefined,
['endpoint', 'http.status'],
)
assert.deepStrictEqual(
metadata_with_threadlocal.threadlocalAttributeKeys,
['endpoint', 'http.status'],
)
const cfg_handle_threadlocal = process_discovery.storeMetadata(metadata_with_threadlocal)
assert(cfg_handle_threadlocal !== undefined)

if (process.platform === 'linux') {
const contains_datadog_memfd = (fds) => {
for (const fd in fds) {
Expand Down
Loading