【问题标题】:AWS xray put trace segment command return errorAWS xray put trace segment 命令返回错误
【发布时间】:2020-02-13 14:05:35
【问题描述】:

我正在尝试使用 CLI 手动发送分段文档,并在此页面上提供示例:https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-segments

我创建了自己的 Trace ID 以及开始和结束时间。

我使用的命令是:

> DOC='{"trace_id": "'$TRACE_ID'", "id": "6226467e3f841234", "start_time": 1581596193, "end_time": 1581596198, "name": "test.com"}'

>echo $DOC
{"trace_id": "1-5e453c54-3dc3e03a3c86f97231d06c88", "id": "6226467e3f845502", "start_time": 1581596193, "end_time": 1581596198, "name": "test.com"}

> aws xray put-trace-segments --trace-segment-documents $DOC
{
"UnprocessedTraceSegments": [
{
"ErrorCode": "ParseError",
"Message": "Invalid segment. ErrorCode: ParseError"
},
{
"ErrorCode": "MissingId",
"Message": "Invalid segment. ErrorCode: MissingId"
},
{
"ErrorCode": "MissingId",
"Message": "Invalid segment. ErrorCode: MissingId"
},
.................

put-trace-segment 不断给我错误。段文档也符合 JSON 模式。我还缺少其他东西吗?

谢谢。

【问题讨论】:

    标签: aws-xray


    【解决方案1】:

    我需要用“..”将 JSON 括起来。对我有用的命令是:aws xray put-trace-segments --trace-segment-documents "$DOC"

    这可能是由于文档中的错误或 X 射线团队使用了另一种外壳。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-29
      • 1970-01-01
      • 2019-03-30
      • 1970-01-01
      • 1970-01-01
      • 2017-01-13
      相关资源
      最近更新 更多