title: AWS X-Ray trace segments are missing or not connected
body: <p>I have code that creates a segment when a queue is being read. In the first function (within the same lambda) I have this:</p>
  
  <pre><code>import * as AWSXRay from 'aws-xray-sdk'; // (using TypeScrpt)
  AWSXRay.enableManualMode();
  var segment1 = new AWSXRay.Segment("A");
  </code></pre>
  
  <p>In the second function (within the same lambda), called from the first, I have something like this:</p>
  
  <pre><code>var segment2 = new AWSXRay.Segment("B", segment1.trace_id, segment1.id);
  </code></pre>
  
  <p>Instead of seeing </p>
  
  <pre><code>*-&gt;A-&gt;B
  </code></pre>
  
  <p>On the AWS graph (on the website), I see:</p>
  
  <pre><code>*-&gt;A
  *-&gt;B
  </code></pre>
  
  <p>...where they are not even associated, even though they have the same tracing ID, and the parent IDs are properly set. I seem to be missing something but not sure what...?</p>
  
  <p>I even tried to pull <code>X-Amzn-Trace-Id</code> from the API request to use that as the root tracking ID for everything but that didn't work either.</p>
  
  <p>This is the JSON for the first segment (A):</p>
  
  <pre><code>{
    "Duration": 0.808,
    "Id": "1-5d781a08-d41b49e35c3c0f38cdbd4912",
    "Segments": [
      {
        "Document": {
          "id": "74c99567f73185ce",
          "name": "router",
          "start_time": 1568152071.979,
          "end_time": 1568152072.787,
          "parent_id": "ef34fc0bcf23bbbe",
          "aws": {
            "xray": {
              "sdk": "X-Ray for Node.js",
              "sdk_version": "2.3.6",
              "package": "aws-xray-sdk"
            }
          },
          "service": {
            "version": "unknown",
            "runtime": "node",
            "runtime_version": "v10.16.3",
            "name": "unknown"
          },
          "trace_id": "1-5d781a08-d41b49e35c3c0f38cdbd4912"
        },
        "Id": "74c99567f73185ce"
      }
    ]
  }
  </code></pre>
  
  <p>This is the JSON for the second segment (B):</p>
  
  <pre><code>{
      "Duration": 0.801,
      "Id": "1-5d781a08-d9626abbab1cfbbfe4ff0dff",
      "Segments": [
          {
              "Document": {
                  "id": "e2b4faaa6538bbb2",
                  "name": "handleCreateLoad",
                  "start_time": 1568152071.98,
                  "end_time": 1568152072.781,
                  "parent_id": "74c99567f73185ce",
                  "aws": {
                      "xray": {
                          "sdk": "X-Ray for Node.js",
                          "sdk_version": "2.3.6",
                          "package": "aws-xray-sdk"
                      }
                  },
                  "service": {
                      "version": "unknown",
                      "runtime": "node",
                      "runtime_version": "v10.16.3",
                      "name": "unknown"
                  },
                  "trace_id": "1-5d781a08-d9626abbab1cfbbfe4ff0dff",
                  "subsegments": [
                    {
                      "id": "08ccf2f374364066",
                      "name": "...-CreateLoad",
                      "start_time": 1568152071.981,
                      "end_time": 1568152072.781
                    }
                  ]
              },
              "Id": "e2b4faaa6538bbb2"
          }
      ]
  }
  </code></pre>
  
  <p>It's quite clear the the parent ID for 'B' (74c99567f73185ce) points to "A"'s ID, but the graph does not connect them.</p>
  
  <p><a href="https://i.stack.imgur.com/sLjxC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sLjxC.png" alt="enter image description here"></a></p>
  
  <p>Also, I think <code>_x_amzn_trace_id</code> should be set when the lambda executes, but it is not. That may be root of my issues.</p>