Skip to content

Commit

Permalink
Fix issues detected by TS type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed Feb 24, 2025
1 parent 96bb84a commit f43bf08
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
7 changes: 4 additions & 3 deletions packages/datadog-core/src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ class DatadogStorage extends AsyncLocalStorage {
* key. This is useful if you've stashed a handle somewhere and want to
* retrieve the store with it.
*
* @param handle {{}}
* @param [handle] {{}}
* @returns {T | undefined}
*/
getStore (handle) {
if (!handle) {
handle = super.getStore()
}

return stores.get(handle)
if (handle) {
return stores.get(handle)
}
}

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/dd-trace/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ function validateNamingVersion (versionString) {
* If a blank path is provided a null is returned to signal that the feature is disabled.
* An empty array means the feature is enabled but that no rules need to be applied.
*
* @param {string} input
* @returns {[string]|null}
* @param {string | string[]} input
*/
function splitJSONPathRules (input) {
if (!input) return null
Expand Down Expand Up @@ -270,8 +269,7 @@ class Config {
}
const PROPAGATION_STYLE_INJECT = propagationStyle(
'inject',
options.tracePropagationStyle,
this._getDefaultPropagationStyle(options)
options.tracePropagationStyle
)

validateOtelPropagators(PROPAGATION_STYLE_INJECT)
Expand Down
8 changes: 3 additions & 5 deletions packages/dd-trace/src/datastreams/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ const log = require('../log')

const ENTRY_PARENT_HASH = Buffer.from('0000000000000000', 'hex')

const HIGH_ACCURACY_DISTRIBUTION = 0.0075

class StatsPoint {
constructor (hash, parentHash, edgeTags) {
this.hash = hash.readBigUInt64BE()
this.parentHash = parentHash.readBigUInt64BE()
this.edgeTags = edgeTags
this.edgeLatency = new LogCollapsingLowestDenseDDSketch(HIGH_ACCURACY_DISTRIBUTION)
this.pathwayLatency = new LogCollapsingLowestDenseDDSketch(HIGH_ACCURACY_DISTRIBUTION)
this.payloadSize = new LogCollapsingLowestDenseDDSketch(HIGH_ACCURACY_DISTRIBUTION)
this.edgeLatency = new LogCollapsingLowestDenseDDSketch()
this.pathwayLatency = new LogCollapsingLowestDenseDDSketch()
this.payloadSize = new LogCollapsingLowestDenseDDSketch()
}

addLatencies (checkpoint) {
Expand Down
2 changes: 1 addition & 1 deletion packages/dd-trace/src/payload-tagging/jsonpath-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@ JSONPath.prototype._handleCallback = function (fullRetObj, callback, type) {
* @param {string} parentPropName
* @param {JSONPathCallback} callback
* @param {boolean} hasArrExpr
* @param {boolean} literalPriority
* @param {boolean} [literalPriority]
* @returns {ReturnObject|ReturnObject[]}
*/
JSONPath.prototype._trace = function (expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {
Expand Down
4 changes: 2 additions & 2 deletions packages/dd-trace/src/span_stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class SpanAggStats {
this.topLevelHits = 0
this.errors = 0
this.duration = 0
this.okDistribution = new LogCollapsingLowestDenseDDSketch(0.00775)
this.errorDistribution = new LogCollapsingLowestDenseDDSketch(0.00775)
this.okDistribution = new LogCollapsingLowestDenseDDSketch()
this.errorDistribution = new LogCollapsingLowestDenseDDSketch()
}

record (span) {
Expand Down

0 comments on commit f43bf08

Please sign in to comment.