WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit eed3401

Browse files
committed
add comment explaining the purpose of the js rewriter
1 parent 7a516d9 commit eed3401

File tree

1 file changed

+24
-3
lines changed
  • packages/datadog-instrumentations/src/helpers/rewriter

1 file changed

+24
-3
lines changed

packages/datadog-instrumentations/src/helpers/rewriter/index.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
'use strict'
22

3-
// The rewriter works effectively the same as Orchestrion with some additions:
4-
// - Supports an `astQuery` field to filter AST nodes with an esquery query.
5-
// - Supports replacing methods of child class instance in the base constructor.
3+
/*
4+
This rewriter is basically a JavaScript version of Orchestrion. The goal is not
5+
to replace Orchestrion, but rather to make it easier and faster to write new
6+
integrations in the short-term, especially as many changes to the rewriter will
7+
be needed as all the patterns we need have not been identified yet. This will
8+
avoid the back and forth of having to make Rust changes to an external library
9+
for basically every integration change or addition.
10+
11+
The long term goal is to backport any additional feature we add to the JS
12+
rewriter to Orchestrion once we're confident that the implementation is fairly
13+
complete and has all features we need. This should ideally happen by summer
14+
2026, but it will depend on how quickly we start using the rewriter more.
15+
16+
Here is a list of the additions and changes in this rewriter compared to
17+
Orchestrion that will need to be backported:
18+
19+
(NOTE: Please keep this list up-to-date whenever new features are added)
20+
21+
- Supports an `astQuery` field to filter AST nodes with an esquery query. This
22+
is mostly meant to be used when experimenting or if what needs to be queried
23+
is not a function. We'll see over time if something like this is needed to be
24+
backported or if it can be replaced by simpler queries.
25+
- Supports replacing methods of child class instances in the base constructor.
26+
*/
627

728
const { readFileSync } = require('fs')
829
const { join } = require('path')

0 commit comments

Comments
 (0)