Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RD 12474 - support logging via Winston and Bunyan #339

Merged
merged 26 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7764fe1
Refactor exporters [skip ci]
harelmo-lumigo Apr 7, 2024
573d7ed
Formatting
harelmo-lumigo Apr 8, 2024
4943185
Fix comments
harelmo-lumigo Apr 16, 2024
e578bfe
Partial implementation - logs not dumped to file
harelmo-lumigo Apr 16, 2024
a1efee2
Passing test
harelmo-lumigo Apr 17, 2024
229aca6
Support bunyan
harelmo-lumigo Apr 17, 2024
d155f50
Minor fixes to Winston tests
harelmo-lumigo Apr 17, 2024
31ea85c
Leftovers
harelmo-lumigo Apr 17, 2024
6f87f54
Test span context injection
harelmo-lumigo Apr 17, 2024
38c5b36
Naive secret scrubbing implementation
harelmo-lumigo Apr 18, 2024
a990277
Test using fake-edge with batch-exporter
harelmo-lumigo Apr 21, 2024
c3bea42
Rename env-var
harelmo-lumigo Apr 21, 2024
510b2ee
Add docs
harelmo-lumigo Apr 21, 2024
5094a6f
Revert package.json changes
harelmo-lumigo Apr 21, 2024
ff28c3c
Test logging disabled
harelmo-lumigo Apr 21, 2024
3b01923
Align scrubbing logic with traces
harelmo-lumigo Apr 21, 2024
cf793fc
Fix framework assertion
harelmo-lumigo Apr 21, 2024
b7dea9d
Align dependencies
harelmo-lumigo Apr 30, 2024
d0bd8f9
Fix after deps upgrade
harelmo-lumigo Apr 30, 2024
fd43b0e
Fix lint
harelmo-lumigo Apr 30, 2024
3e32957
Undo commented-out test code
harelmo-lumigo Apr 30, 2024
7d7a77e
Remove usage of walle as dummy address
harelmo-lumigo Apr 30, 2024
a6081f2
Fix test
harelmo-lumigo Apr 30, 2024
c0f4392
Merge branch 'main' into RD-12474-support-logging-in-js-distro
harelmo-lumigo May 1, 2024
33d2fa9
Update readme [skip-ci]
harelmo-lumigo May 1, 2024
ed03064
Fix more tests
harelmo-lumigo May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ test/component/node/spans-test*.json
.vscode

test-spans*.json
test-logs*.json

# ignore typescript build files
test/helpers/*.d.ts
Expand Down
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The Lumigo OpenTelemetry Distribution for Node.js is made of several upstream Op

**Note:** If you are looking for the Lumigo Node.js tracer for AWS Lambda functions, [`@lumigo/tracer`](https://npm.io/package/@lumigo/tracer) is the package you should use instead.

## Logging support
harelmo-lumigo marked this conversation as resolved.
Show resolved Hide resolved
The Lumigo OpenTelemetry Distribution also allows logging span-correlated records. See the [configuration](#logging-instrumentation) section for details on how to enable this feature.
When using the logging feature, the same set of rules for [secret masking](#lumigo-specific-configurations) applies on the content of the log message, with only `LUMIGO_SECRET_MASKING_REGEX` being considered.

## Setup

### Add @lumigo/opentelemetry as dependency
Expand Down Expand Up @@ -113,9 +117,27 @@ This setting is independent from `LUMIGO_DEBUG`, that is, `LUMIGO_DEBUG` does no
* `LUMIGO_FILTER_HTTP_ENDPOINTS_REGEX='["regex1", "regex2"]'`: This option enables the filtering of client and server endpoints through regular expression searches. Fine-tune your settings via the following environment variables, which work in conjunction with `LUMIGO_FILTER_HTTP_ENDPOINTS_REGEX` for a specific span type:
* `LUMIGO_FILTER_HTTP_ENDPOINTS_REGEX_SERVER` applies the regular expression search exclusively to server spans. Searching is performed against the following attributes on a span: `url.path` and `http.target`.
* `LUMIGO_FILTER_HTTP_ENDPOINTS_REGEX_CLIENT` applies the regular expression search exclusively to client spans. Searching is performed against the following attributes on a span: `url.full` and `http.url`.

For more information check out [Filtering http endpoints](#filtering-http-endpoints).

#### Logging instrumentation

* `LUMIGO_ENABLE_LOGS` - Default: `false`. When set to `true`, turns on the logging instrumentations (currently for the [Winston](https://github.com/winstonjs/winston) and [Bunyan](https://github.com/trentm/node-bunyan) loggers) to capture log-records and send them to Lumigo. Emitted logs will also get injected with the active span context, e.g.:
harelmo-lumigo marked this conversation as resolved.
Show resolved Hide resolved
```js
// ...
"body": "Hello Winston!",
"attributes": {
"trace_id": "1fce43bfd3fdde3f1a9ea1adc78b521d",
"span_id": "13c05292d3b5f5e8",
"trace_flags": "01"
}
"severityText": "info",
// ...
```
Note that logging support is applicable only when using versions of the logging libraries listed [here](##supported-packages).

* `LUMIGO_DEBUG_LOGDUMP` - similar to `LUMIGO_DEBUG_SPANDUMP`, only for logs instead of spans. Effective only when `LUMIGO_ENABLE_LOGS` is set to `true`.

### Execution Tags

[Execution Tags](https://docs.lumigo.io/docs/execution-tags) allow you to dynamically add dimensions to your invocations so that they can be identified, searched for, and filtered in Lumigo.
Expand Down Expand Up @@ -491,7 +513,7 @@ For exclusive server (inbound) or client (outbound) span filtering, use the envi

Notes:
* the environment variable must be a valid JSON array of strings, so if you want to match endpoint with the hostname `google.com` the environment variable value should be `["google\\.com"]`.
* If we are filtering out an HTTP call to an opentelemetry traced component, every subsequent invocation made by that
* If we are filtering out an HTTP call to an opentelemetry traced component, every subsequent invocation made by that
component won't be traced either.

Examples:
Expand Down
Loading
Loading