Middleware Utils module.
Exposes various configuration and helper methods to be used by the middleware.
- Source:
Methods
(static) enableDynamicNaming(hostPatternopt)
Enables dynamic naming for segments via the middleware. Use 'AWSXRay.middleware.enableDynamicNaming()'.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
hostPattern |
string |
<optional> |
The pattern to match the host header. See the README on dynamic and fixed naming modes. |
- Source:
(static) processHeaders(req) → {object}
Splits out the 'x-amzn-trace-id' header params from the incoming request. Used by the middleware.
Parameters:
Name | Type | Description |
---|---|---|
req |
http.IncomingMessage | https.IncomingMessage | The request object from the incoming call. |
- Source:
Returns:
- Type
- object
(static) processTraceData(traceData) → {object}
Splits out the data from the trace id format. Used by the middleware.
Parameters:
Name | Type | Description |
---|---|---|
traceData |
String | The additional trace data (typically in req.headers.x-amzn-trace-id). |
Returns:
- Type
- object
(static) resolveName(hostHeader) → {string}
Resolves the name of the segment as determined by fixed or dynamic mode options. Used by the middleware.
Parameters:
Name | Type | Description |
---|---|---|
hostHeader |
string | The string from the request.headers.host property. |
- Source:
Returns:
- Type
- string
(static) resolveSampling(amznTraceHeader, segment, res) → {boolean}
Resolves the sampling decision as determined by the values given and options set. Used by the middleware.
Parameters:
Name | Type | Description |
---|---|---|
amznTraceHeader |
object | The object as returned by the processHeaders function. |
segment |
Segment | The string from the request.headers.host property. |
res |
http.ServerResponse | https.ServerResponse | The response object from the incoming call. |
- Source:
Returns:
- Type
- boolean
(static) setDefaultName(name)
Sets the default name of created segments. Used with the middleware.
Can be overridden by the AWS_XRAY_TRACING_NAME environment variable.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The default name for segments created in the middleware. |
- Source: