Skip to content

Commit

Permalink
feat(opentelemetry-sampler-aws-xray): add lambda support note to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
carolabadeer committed May 5, 2023
1 parent 3105a6c commit e1ff849
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
31 changes: 18 additions & 13 deletions packages/opentelemetry-sampler-aws-xray/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# AWS X-Ray Remote Sampler

> This component is still in development and has not been released as an npm package.
> This component is still in development and has not been released as an npm package.
component owner: @carolabadeer
component owner: @carolabadeer

This module provides the remote/centralized sampler for AWS X-Ray.
This module provides the remote/centralized sampler for AWS X-Ray.

## Usage

```js

## Usage
```js
const { AWSXRayRemoteSampler } = require('@opentelemetry/sampler-aws-xray');
const opentelemetry = require("@opentelemetry/sdk-node");
const { Resource } = require("@opentelemetry/resources");
Expand All @@ -25,6 +26,8 @@ const _resource = Resource.default().merge(new Resource({
const _traceExporter = new OTLPTraceExporter();
const _spanProcessor = new BatchSpanProcessor(_traceExporter);
const _tracerConfig = {
// add remote sampler
sampler: new AWSXRayRemoteSampler(),
idGenerator: new AWSXRayIdGenerator(),
}

Expand All @@ -39,20 +42,22 @@ const sdk = new opentelemetry.NodeSDK({
resource: _resource,
spanProcessor: _spanProcessor,
traceExporter: _traceExporter,
// add remote sampler
sampler: new AWSXRayRemoteSampler(),
});

sdk.configureTracerProvider(_tracerConfig, _spanProcessor);

```

For more details on setting up the global tracer provider to send traces to AWS X-Ray, refer to [this documentation](https://aws-otel.github.io/docs/getting-started/js-sdk/trace-manual-instr#setting-up-the-global-tracer).

Please note that AWS Lambda does not support X-Ray remote sampling.

## Useful links

- [More information on OpenTelemetry](https://opentelemetry.io/)
- [More about OpenTelemetry JavaScript](https://github.com/open-telemetry/opentelemetry-js)
- [More in-depth documentation on setting up OpenTelemetry to send traces to AWS X-Ray](https://aws-otel.github.io/docs/getting-started/javascript-sdk)

## Useful links
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- For more in-depth documentation on setting up OpenTelemetry to send traces to AWS X-Ray: https://aws-otel.github.io/docs/getting-started/javascript-sdk
## License

## License
Apache 2.0 - See [LICENSE](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE) for more information.
Apache 2.0 - See [LICENSE](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/LICENSE) for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AWSXRayRemoteSampler implements Sampler {
this._awsProxyEndpoint + SAMPLING_RULES_PATH;
const response = await axios.post(
samplingRulesEndpoint,
null,
{},
requestConfig
);
const responseJson = response.data;
Expand Down

0 comments on commit e1ff849

Please sign in to comment.