You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Favor fewer `assert.deepStrictEqual`/`assertObjectContains` calls over many `assert.strictEqual` calls. Combine with existing `assert.strictEqual` calls, if possible.
123
+
124
+
Never use the `doesNotThrow()` assertion. Instead, execute the method directly.
125
+
101
126
### Time-Based Testing
102
127
103
128
**Never rely on actual time passing in unit tests.** Use sinon's fake timers to mock time and make tests deterministic and fast.
104
129
105
130
## Code Style & Linting
106
131
107
132
### Linting & Naming
108
-
- Lint: `yarn lint` / `yarn lint:fix`
133
+
134
+
- Lint: `npm run lint` / `npm run lint:fix`
109
135
- Files: kebab-case
110
136
111
137
### JSDoc
138
+
112
139
- Use TypeScript-compatible syntax (`@param {string}`, `@returns {Promise<void>}`, `@typedef`)
113
140
- Never use `any` (be specific or use `unknown` if type is truly unknown)
141
+
- Write the most specific types possible by reading the overall context
142
+
- Always define types for method arguments as method params
143
+
- Never define argument types inside of a method
144
+
- Only define types inside of a method, if it can not be inferred otherwise
145
+
- Only rewrite code for better types in case it was explicitly requested by the user
114
146
115
147
### Import Ordering
116
148
117
149
Separate groups with empty line, sort alphabetically within each:
150
+
118
151
1. Node.js core modules (with `node:` prefix)
119
152
2. Third-party modules
120
153
3. Internal imports (by path proximity, then alpha)
-**`Plugin`** - Base class with diagnostic channel subscription, storage binding, enable/disable lifecycle. Use for non-tracing functionality.
257
313
-**`TracingPlugin`** - Extends `Plugin` with APM tracing helpers (`startSpan()`, automatic trace events, `activeSpan` getter). Use for plugins creating trace spans.
258
314
-**`CompositePlugin`** - Extends `Plugin` to compose multiple sub-plugins. Use when one integration needs multiple feature plugins (e.g., `express` combines tracing and code origin plugins).
259
315
260
316
**Plugin Loading:**
317
+
261
318
- Plugins load lazily when application `require()`s the corresponding library
262
319
- Disable with `DD_TRACE_DISABLED_PLUGINS` or `DD_TRACE_<PLUGIN>_ENABLED=false`
263
320
- Test framework plugins only load when Test Optimization mode (`isCiVisibility`) is enabled
264
321
265
322
**When to Create a New Plugin:**
323
+
266
324
1. Adding support for a new third-party library/framework
267
325
2. Adding a new product feature that integrates with existing libraries (use `CompositePlugin`)
0 commit comments