Commit 055ef41
feat(instrumentation-pino): add log sending to Logs Bridge API (#2249)
* feat(instrumentation-pino): add log sending to Logs Bridge API
* refactor tests (mostly from separate #2247 PR); lint:fix; some in-progress changes
* remove some old dev/debug code
* feat!: make it so re-enabled instr after creating a logger will NOT change behaviour for that logger
This removes functionality that was there before, so technically could be breaking.
The motivation is to have the contract of pino instrumentation be cleaner.
With this change a pino Logger instance will not be touched if
the PinoInstrumentation is disabled. I.e. we are hands-off as much as
possible when disabled.
Before this change, even when disabled, the instrumentation would tweak
the pino Logger config to have a no-op mixin. If the instrumentation was
later enabled, then the mixin would become active (adding trace_id et al
fields in a span context).
The coming "log sending" to the Logs Bridge API will *not* support
this "work if instrumentation is re-enabled later", so I think it is
clearer if neither "log sending" nor "log correlation" support this.
We can back this out if we think it is important to support a possible
future feature of the SDK doing live enabling/disabling of
individual instrumentations.
* impl disableLogCorrelation config; undo the previous commit so that log-correlation *will* follow the live instr enable/disable state
* log sending: first tests; change impl to use pino.multistream
* edge case tests; almost complete
* more tests and a fix for 'useOnlyCustomLevels: true' usage
* lint:fix
* refactor some code out to utils file
* add some internal docs
* update readme
* fix lint
* avoid a possible flaky error if using pino 'unixTime' and logging in the first half-second since process start
Effectively the issue is that this sometimes returns true:
node -e 'console.log(Math.round(Date.now() / 1e3) * 1e3 < performance.timeOrigin)'
* limit log-sending to pino@7 and later because that's when pino.multistream was added
* lint:fix
* discuss pino-opentelemetry-transport alternative
* fix a mis-merge
* update changed deps to their new latest
* typo in README
Co-authored-by: Hector Hernandez <[email protected]>
---------
Co-authored-by: Hector Hernandez <[email protected]>
Co-authored-by: Marc Pichler <[email protected]>1 parent d9d558f commit 055ef41
File tree
7 files changed
+784
-72
lines changed- plugins/node/opentelemetry-instrumentation-pino
- src
- test
7 files changed
+784
-72
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 73 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 33 | + | |
47 | 34 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
51 | 38 | | |
52 | 39 | | |
53 | 40 | | |
54 | | - | |
55 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
56 | 53 | | |
57 | 54 | | |
58 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
66 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
67 | 102 | | |
68 | 103 | | |
69 | 104 | | |
70 | 105 | | |
71 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
72 | 117 | | |
73 | 118 | | |
74 | 119 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
Lines changed: 68 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
56 | 75 | | |
57 | 76 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
71 | 104 | | |
72 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
73 | 117 | | |
74 | | - | |
| 118 | + | |
75 | 119 | | |
76 | 120 | | |
77 | 121 | | |
| |||
80 | 124 | | |
81 | 125 | | |
82 | 126 | | |
| 127 | + | |
83 | 128 | | |
84 | 129 | | |
85 | 130 | | |
| |||
122 | 167 | | |
123 | 168 | | |
124 | 169 | | |
125 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
126 | 174 | | |
127 | 175 | | |
128 | 176 | | |
| |||
151 | 199 | | |
152 | 200 | | |
153 | 201 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 202 | | |
0 commit comments