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: add log correlation/injection #121

Merged
merged 14 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Add support for injecting trace context into logs.
([#121](https://github.com/signalfx/splunk-otel-js/pull/121))

## 0.8.0 (04-15-2021)

- Added support for `aws-sdk`, `mongoose`, `sequelize`, `typeorm` and `kafkajs`.
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ You can also instrument your app with code as described [here](#instrument-with-
| SPLUNK_ACCESS_TOKEN | acceessToken | | | The optional organization access token for trace submission requests. |
| SPLUNK_MAX_ATTR_LENGTH | maxAttrLength | 1200 | Maximum length of string attribute value in characters. Longer values are truncated. |
| SPLUNK_CONTEXT_SERVER_TIMING_ENABLED | serverTimingEnabled | true | Enable injection of `Server-Timing` header to HTTP responses. |
| SPLUNK_LOGS_INJECTION | logInjectionEnabled | false | Enable injecting of trace ID, span ID and service name to log records. Please note that the corresponding logging library instrumentation needs to be installed. |
| OTEL_RESOURCE_ATTRIBUTES | | unset | Comma-separated list of resource attributes added to every reported span. <details><summary>Example</summary>`key1=val1,key2=val2`</details>
| OTEL_TRACE_ENABLED | | `true` | Globally enables tracer creation and auto-instrumentation. |

Expand Down Expand Up @@ -158,6 +159,8 @@ startTracing({

- `serverTimingEnabled`: corresponds to the `SPLUNK_SERVER_TIMING_ENABLED` environment variable. Defaults to false. Enables injection of `Server-Timing` header to responses.

- `logInjectionEnabled`: corresponds to the `SPLUNK_LOGS_INJECTION` environment variable. Defaults to false. Injects trace ID, span ID and service name to the log records. Service version or deployment environment will be injected if available in the [configured resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md). Supported logging libraries: bunyan, pino, winston.

- `tracerConfig`: a JS object that is merged into the default tracer config replacing any existing keys and is passed on to the tracer provider during initialization. This can be used to customize the tracer provider or tracer. Must satisfy [`TracerConfig` interface](https://github.com/open-telemetry/opentelemetry-js/blob/71ba83a0dc51118e08e3148c788b81fe711003e7/packages/opentelemetry-tracing/src/types.ts#L26)

- `spanExporterFactory`: A function that accepts the options passed to startTracing function and returns a new instance of SpanExporter. When set, this function will be used to create a new exporter and the returned exporter will be used in the pipeline.
Expand Down Expand Up @@ -221,6 +224,14 @@ opentelemetry-instrumentation-amqplib
opentelemetry-instrumentation-elasticsearch
```

If log injection is enabled, the corresponding logging library package will need to be installed beforehand. Supported logging library instrumentations:

```
@opentelemetry/instrumentation-bunyan
@opentelemetry/instrumentation-pino
@opentelemetry/instrumentation-winston
```

You can find more instrumentation packages over at the [OpenTelemetry Registry](https://opentelemetry.io/registry/?language=js) and enable them manually
as described above.

Expand Down
Loading