add id and now helpers in platform + cleanup#4
Merged
Conversation
palazzem
approved these changes
Jan 30, 2018
alrosot
pushed a commit
to alrosot/dd-trace-js
that referenced
this pull request
May 20, 2021
* remove tagging in version script (DataDog#746) * fix runtime metrics in node 8 for windows and mac (DataDog#745) * add environment variables to configure the priority sampler (DataDog#749) * fix grpc parsing error causing an exception from the plugin (DataDog#750) * add tracer metrics for the agent exporter (DataDog#748) * add rum context as tags to browser traces (DataDog#751) * update priority sampling environment variables to be more explicit (DataDog#752) * add more tracer metrics and fix counters (DataDog#753) * fix release script with new endpoint and add retries (DataDog#754) * fix wrong artifact used for node 8 on linux when releasing (DataDog#755) * update prepublish script to use last workflow run instead of first (DataDog#756) * update prepublish script to use last workflow run instead of first * sort workflows and add check for unfinished workflows * update prepublish script to use new workflow api (DataDog#757) * fix fetch plugin dropping headers when calling non-peers (DataDog#758) * fix tracer exception because of missing metrics api method (DataDog#761) * fix xhr errors throwing in sync mode (DataDog#762) * add tests and checksum validation for prebuilt native addons (DataDog#763) * update xhr and fetch to not generate traces for rum intake (DataDog#769) * fix url reference in xhr intake filter (DataDog#770) * fix error in graphql plugin with unpatched context values (DataDog#765) * update build scripts to use a single prebuilds artifact (DataDog#767) * fix log injection removing inherited properties on log records (DataDog#771) * fix async scope tracking not resolving awaited promises (DataDog#772) * update async scope tracking to not track itself (DataDog#773) * fix missing/wrong native extensions in scripts (DataDog#774) * add safety nets for type errors in amqplib plugin (DataDog#777) * add safety nets for type errors in cassandra-driver plugin (DataDog#778) * add safety nets for type errors in connect plugin (DataDog#779) * add safety nets for type errors in couchbase plugin (DataDog#782) * add safety nets for type errors in dns plugin (DataDog#783) * add safety nets for type errors in elasticsearch plugin (DataDog#784) * add safety nets for type errors in generic-pool plugin (DataDog#786) * add safety nets for type errors in fastify plugin (DataDog#785) * add safety nets for type errors in amqp10 plugin (DataDog#776) * fix log injection not working when logger is required before dd-trace (DataDog#781) * Add support for disabling plugins by environment variable (DataDog#733) * add check for integrations disabled config option on tracer init plug loop * [in prog] add specs to test that enable skipped disabled integrations * fix tests and linting, improve naming convention * add api docs markdown and typescript definition formatting * improve debug log language * add ternary operator in configuration to handle converting string environment variable input to array * [wip] refactor to use plugins object in private _set method, add disabledPlugins to instrumentor constructor * account for edge case where .use adds a plugin before disabledPlugins list could be set * handle plugins option config via multiple formats * add specs and lint cleanup * fix specs * fix .enable edgecase where .use is called beforehand by matching w/correct Map key * use correct env var and update api docs * remember to reset disabled plugins on .disable * adjust plugins config to only take boolean or array of disabled plugins and only csv string by env var and update specs accordingly * typo fix in instrumenter * refactor configuration to have disabledPlugins as seperate env var, update specs and docs accordingly, account for white space in csv formatting * refactor to only use env var and update specs and docs accoordingly * typo fix * remove added whitespace * make tests more explicit for env var, cleanup language clarity * delete env var instead of setting to undefined * add safety nets for type errors in graphql plugin (DataDog#787) * add safety nets for type errors in grpc plugin (DataDog#788) * add safety nets for type errors in hapi plugin (DataDog#789) * fix base scope missing the _activate protected method (DataDog#791) * update browser http request resource name to browser.request (DataDog#795) * remove default rate limit in priority sampler (DataDog#796) * add regex support for peer configuration (DataDog#798) * remove dependencies on zone.js and core-js (DataDog#799) * add safety net for uri errors in http plugin (DataDog#800) * add safety nets for type errors in http2 plugin (DataDog#802) * add benchmarks for node platform metrics (DataDog#805) * add safety nets for type errors in ioredis plugin (DataDog#808) * add safety nets for type errors in koa plugin (DataDog#809) * add safety nets for type errors in limitd-client plugin (DataDog#810) * add support for rhea (DataDog#801) * add support for `only` and `skip` in tests * add support for rhea * Revert "remove default rate limit in priority sampler (DataDog#796)" This reverts commit 7ab6af0. * update tracer to support numeric tags (DataDog#804) * add experimental global runtime id tag (DataDog#816) * add span hook for elasticsearch query (DataDog#818) * Add hook for elasticsearch query and option to remove query body * Add typescript tests * Remove includeBody option and add params to hook * Add TransportRequestParams type and test params * Add elasticsearch license * Update license to be consistent * Fix unit tests * Remove dependency on elasticsearch package * fix possible stack overflow with mysql2 command executions (DataDog#821) * fix main-finding in nodejs loader (DataDog#822) Some Node.js packages use a leading `./` to indicate their "main" file. This broke the Node.js loader, which was comparing require paths against this. This is now fixed by using `path.posix.normalize` on the "main" file. * fix rhea integration for numeric tags (DataDog#823) * update sinon chai and sinon-chai (DataDog#824) * fix cassandra-driver plugin not working for >=4.4 (DataDog#825) * fix log injection removing symbols from log records (DataDog#819) * account for Symbol keys for winston splat handling * use for of loop and check for undefined or null records * remove local changes * remove typos on testing local changes * use correct syntax for for of loop * linting fix * simplify for loop * add specs to verify splat formatting is handled correctly * remove duplicated test * update bluebird instrumentation to account for getNewLibraryCopy (DataDog#813) * handle usage of getNewLibraryCopy by sequelize * [wip] add promise spec for getNewLibraryCopy need to determine min version still * fix unwrap typo, add temp fix and todos for version requirements for getNetLibraryCopy for 2.11.0 and 3.4.1 * add getNewLibraryCopy patching only for versions where it exists * handle unwrapping copies _then by maintaining reference to copies on original promise library * make hidden property non enumerable * [wip] add specs for patching and unpatching behavior , clean up hiddenproperty settings, use promise constructor instead of prototype * add specs for mechanics of tracking wrapped bluebird library copies for unpatching * remove duplicate patching specs * add version filter for bluebird version specific instrumentation * generalize unpatching test for all promise libraries * handle edge case when non native promise libraries default to native promises * only instrument promisejs when it doesnt export global promise, move semver check to promise util specs, clean up bluebird spec syntax * only instrument promise-js on versions it isnt used native promises, add promise-js version range filtering in specs * simplify version checking and test pre / post patching and unpatching behavior * es6 syntax improvement * fix beforeEach handling of promises * add test for copy of copy being unwrapped * Dual License (DataDog#832) * add support for WHATWG URL in http client (DataDog#833) * add support for WHATWG by removing Object assign usage * linting and move spec to >10 bc it was breaking on ode8 image * use async format for unit test * add await to spec and make url normalization cleaner * initial fs support (DataDog#814) * initial fs support * allow `yarn lint --fix` * support large payloads in test agent * don't trace fs operations unless there's a parent span * fix tsconfig for current versions of @types/node (DataDog#836) * fix fs readFile when options is string (DataDog#835) * remove support for koa-router 8.x until properly supported * update http status code temporarily to always be a string (DataDog#838) * v0.17.0 (DataDog#839) * remove several unnecessary dependencies in the browser (DataDog#797) * fix runtime metrics having prefix in double (DataDog#843) * Add @google-cloud/pubsub integration (DataDog#834) * add defaults test helper, and optional span logging * add support for @goolge-cloud/pubsub Co-authored-by: Roch Devost <[email protected]> Co-authored-by: Eric Mustin <[email protected]> Co-authored-by: Bryan English <[email protected]> Co-authored-by: Brett Langdon <[email protected]> Co-authored-by: Joey Lappin <[email protected]> Co-authored-by: Jeremy <[email protected]>
crysmags
added a commit
that referenced
this pull request
May 14, 2026
After merging master, #8309's perf wins target functions that either no longer exist (wrapExecute / wrapFields / pathToArray / finishResolvers moved out of instrumentations/graphql.js) or live in a deleted file (resolve.js was folded into execute.js). Port the still-applicable changes onto the migrated execute plugin: #1 _startResolveSpan uses info.fieldNodes[0] instead of .find(fn => fn.kind === 'Field'). The executor only hands FieldNode siblings. #2 pathToArray switches to count-then-fill (drops the trailing .reverse() and the push-grow). #3 getResolverInfo lazy-allocates resolverVars: skips both the up-front {} and the directive-loop assignment when args is empty and no directives have arguments. #4 shouldInstrument early-returns on config.depth < 0 (no-limit, the default-enabled case) before walking the path. #5 buildCollapsedPathString builds the collapsed key in one walk; drops the intermediate collapsedPath array. iastResolveCh.publish now passes raw path / pathString, matching the contract the old resolve.js had with the IAST subscriber. drive-by wrapFields iterates Object.values(type._fields) directly. #7 (addVariableTags early-return) already auto-merged during the master merge. #6 (single documentSources.get in wrapExecute) is already the shape of bindStart in the migrated plugin. The reverted depth=0 bindStart short-circuit (156a557 / ca2d041) sat at a different position — inside bindStart, gated on _depthDisabled (config.depth === 0). It was rolled back because piling it on top of the resolveAsync depth-flag fix didn't move plugin-graphql-long-with- depth-off any further. This port stays inside shouldInstrument, fires on config.depth < 0 (the *enabled* default), and targets the hot path on plugin-graphql-long. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
crysmags
added a commit
that referenced
this pull request
May 19, 2026
After merging master, #8309's perf wins target functions that either no longer exist (wrapExecute / wrapFields / pathToArray / finishResolvers moved out of instrumentations/graphql.js) or live in a deleted file (resolve.js was folded into execute.js). Port the still-applicable changes onto the migrated execute plugin: #1 _startResolveSpan uses info.fieldNodes[0] instead of .find(fn => fn.kind === 'Field'). The executor only hands FieldNode siblings. #2 pathToArray switches to count-then-fill (drops the trailing .reverse() and the push-grow). #3 getResolverInfo lazy-allocates resolverVars: skips both the up-front {} and the directive-loop assignment when args is empty and no directives have arguments. #4 shouldInstrument early-returns on config.depth < 0 (no-limit, the default-enabled case) before walking the path. #5 buildCollapsedPathString builds the collapsed key in one walk; drops the intermediate collapsedPath array. iastResolveCh.publish now passes raw path / pathString, matching the contract the old resolve.js had with the IAST subscriber. drive-by wrapFields iterates Object.values(type._fields) directly. #7 (addVariableTags early-return) already auto-merged during the master merge. #6 (single documentSources.get in wrapExecute) is already the shape of bindStart in the migrated plugin. The reverted depth=0 bindStart short-circuit (156a557 / ca2d041) sat at a different position — inside bindStart, gated on _depthDisabled (config.depth === 0). It was rolled back because piling it on top of the resolveAsync depth-flag fix didn't move plugin-graphql-long-with- depth-off any further. This port stays inside shouldInstrument, fires on config.depth < 0 (the *enabled* default), and targets the hot path on plugin-graphql-long. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
christophe-papazian
added a commit
that referenced
this pull request
Jun 16, 2026
- #3 (regression from round 5): constraintMatchesSlash no longer treats a '/' that appears only inside a character class as slash-spanning. `[^/]+` denies slashes, so /:id([^/]+)/users (Express 4) normalizes to /{id}/users again instead of null. - #2: a non-terminal catch-all (a wildcard with a non-empty segment after it, incl. an optional {/*rest}/tail) is rejected at compile (→ null) rather than silently dropped. - #1: a segment containing two independent optional groups (e.g. :a{.:b}{-:c}) is rejected (→ null); our single per-segment regex can't replicate path-to-regexp's ordered-alternative assignment, so the combined name could be wrong. Single intra-segment optionals (:id{.:format}) are unaffected. - #4: structural-only optional groups — a {...} wrapping only nested group(s) with no segment/token of its own (e.g. the outer braces in /a{{/b}}) — are collapsed by reparenting represented groups to their nearest represented ancestor, so /a{{/b}} resolves to /a/b | /a instead of always /a. Adds a regression test per finding (verified against live Express 5). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
szegedi
added a commit
that referenced
this pull request
Jul 8, 2026
…n unsupported runtimes Addresses two P2 review points on the OTEP-4947 branch. Endpoint refresh (#2). HTTP server plugins set 'span.type=web' and 'http.method' when a request arrives and only add 'http.route' / 'resource.name' later, once framework routing has resolved the URL. The writer used to treat any non-undefined webTags result as a fully formed answer at build time — 'needsEndpoint' would flip to false immediately — so the OTEP-4947 record's endpoint attribute got frozen as e.g. 'GET' with no route, and later route arrival was silently ignored. Defer writing the endpoint until 'isEndpointFinal(tags)' is true (either 'resource.name' is set, or both 'http.method' and 'http.route' are), and subscribe onTagsUpdated to the raw 'dd-trace:span:tags:update' channel (not webTagsCache.resolvedCh) so we also see content changes on already-cached web-server spans. The shared cache still runs first (module-load subscribe), so its cached webTags is up to date by the time our handler queries it. Once the endpoint has been appended, further tags-update fires are no-ops (we can't overwrite a written entry — OTEP readers honor the first occurrence). Process-context metadata gate (#4). On non-Linux or non-ACF runtimes, otel-thread-ctx.start() returns false but tracer_metadata.js was still publishing the threadlocal_metadata block in the OTel process context — advertising a decodable OTEP-4947 stream that no writer was producing records for. Add the same 'process.platform === linux' and 'isACFActive' gates to getThreadLocalMetadata that start() applies, so the block is only advertised when the writer can actually run. Tests: three new cases for the defer-and-append endpoint path and two new cases for the platform/ACF gates on getThreadLocalMetadata. 24/24 passing.
szegedi
added a commit
that referenced
this pull request
Jul 8, 2026
…times Addresses Codex review point #4 on #9210: getThreadLocalMetadata would happily return a payload on macOS/Windows or on Node without an active AsyncContextFrame, which would cause libdatadog to advertise a threadlocal block that no writer is actually producing. Gate the function on the same platform + ACF conditions start() already checks, so callers see 'no threadlocal block'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is add an
idandnowhelpers to platform. It also refactors platform into multiple files and adds benchmarks which were not yet done for platform.