Elasticsearch和APM搜索阶段执行异常:[Script_Exception]原因:链接错误

发布于 2025-01-24 05:55:57 字数 3315 浏览 0 评论 0原文

在此之后,我在Windows Server 2019和2022上添加了ElasticsRarch和Kibana(现在Active Now and All Stack版本均为8.1.2)。对于客户,我使用aspnetcore样品表格 opentelemetry github github reposeritory 。当我将APM发送到Windows Server 2022时,我没有任何问题,但是当我发送到2019年并尝试从可观察性尝试访问APM服务时,我会在以下错误。

并且记录了此错误:

[2022-04-18T14:34:22.619+04:30][ERROR][plugins.apm] Error: search_phase_execution_exception: [script_exception] Reason: link error
    at D:\ElasticStack\kibana\x-pack\plugins\observability\common\utils\unwrap_es_response.js:60:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at getServiceInstancesSystemMetricStatistics (D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\get_service_instances\get_service_instances_system_metric_statistics.js:126:20)
    at async Promise.all (index 1)
    at D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\get_service_instances\main_statistics.js:28:51
    at async Promise.all (index 0)
    at handler (D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\route.js:622:45)
    at D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\apm_routes\register_apm_server_routes.js:143:13
    at Router.handle (D:\ElasticStack\kibana\src\core\server\http\router\router.js:163:30)
    at handler (D:\ElasticStack\kibana\src\core\server\http\router\router.js:124:50)
    at exports.Manager.execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\toolkit.js:60:28)
    at Object.internals.handler (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\handler.js:46:20)
    at exports.execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\handler.js:31:20)
    at Request._lifecycle (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\request.js:371:32)
    at Request._execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\request.js:281:9)
Response: {
  error: {
    root_cause: [
      {
        type: 'script_exception',
        reason: 'link error',
        script_stack: [ "doc['system.memory.actual.free']", '     ^---- HERE' ],
        script: "1 - doc['system.memory.actual.free'] / doc['system.memory.total']",
        lang: 'expression'
      }
    ],
    type: 'search_phase_execution_exception',
    reason: 'all shards failed',
    phase: 'query',
    grouped: true,
    failed_shards: [
      {
        shard: 0,
        index: '.ds-metrics-apm.internal-default-2022.04.17-000001',
        node: 'KsqpLySITbOWAlCPlvsdSg',
        reason: {
          type: 'script_exception',
          reason: 'link error',
          script_stack: [ "doc['system.memory.actual.free']", '     ^---- HERE' ],
          script: "1 - doc['system.memory.actual.free'] / doc['system.memory.total']",
          lang: 'expression',
          caused_by: {
            type: 'parse_exception',
            reason: 'Field [system.memory.actual.free] does not exist in mappings'
          }
        }
      }
    ]
  },
  status: 400
}

我比较服务器和代理配置,但找不到任何区别。为什么会出现此消息和错误以及如何解决?

I installed ElasticSrarch and Kibana after that added integrated fleet and Apm on windows server 2019 and 2022 (both active now and all stack version is 8.1.2). for client I use AspNetCore sample form OpenTelemetry Github repository. I haven't any problem When I send Apm to windows server 2022 but when I send to 2019 and try access apm services from observability I get below error.
enter image description here

And this error logged:

[2022-04-18T14:34:22.619+04:30][ERROR][plugins.apm] Error: search_phase_execution_exception: [script_exception] Reason: link error
    at D:\ElasticStack\kibana\x-pack\plugins\observability\common\utils\unwrap_es_response.js:60:11
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at getServiceInstancesSystemMetricStatistics (D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\get_service_instances\get_service_instances_system_metric_statistics.js:126:20)
    at async Promise.all (index 1)
    at D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\get_service_instances\main_statistics.js:28:51
    at async Promise.all (index 0)
    at handler (D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\services\route.js:622:45)
    at D:\ElasticStack\kibana\x-pack\plugins\apm\server\routes\apm_routes\register_apm_server_routes.js:143:13
    at Router.handle (D:\ElasticStack\kibana\src\core\server\http\router\router.js:163:30)
    at handler (D:\ElasticStack\kibana\src\core\server\http\router\router.js:124:50)
    at exports.Manager.execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\toolkit.js:60:28)
    at Object.internals.handler (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\handler.js:46:20)
    at exports.execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\handler.js:31:20)
    at Request._lifecycle (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\request.js:371:32)
    at Request._execute (D:\ElasticStack\kibana\node_modules\@hapi\hapi\lib\request.js:281:9)
Response: {
  error: {
    root_cause: [
      {
        type: 'script_exception',
        reason: 'link error',
        script_stack: [ "doc['system.memory.actual.free']", '     ^---- HERE' ],
        script: "1 - doc['system.memory.actual.free'] / doc['system.memory.total']",
        lang: 'expression'
      }
    ],
    type: 'search_phase_execution_exception',
    reason: 'all shards failed',
    phase: 'query',
    grouped: true,
    failed_shards: [
      {
        shard: 0,
        index: '.ds-metrics-apm.internal-default-2022.04.17-000001',
        node: 'KsqpLySITbOWAlCPlvsdSg',
        reason: {
          type: 'script_exception',
          reason: 'link error',
          script_stack: [ "doc['system.memory.actual.free']", '     ^---- HERE' ],
          script: "1 - doc['system.memory.actual.free'] / doc['system.memory.total']",
          lang: 'expression',
          caused_by: {
            type: 'parse_exception',
            reason: 'Field [system.memory.actual.free] does not exist in mappings'
          }
        }
      }
    ]
  },
  status: 400
}

I compare both servers and agents configs but I can't find any differences. Why this message and error appears and how can I solve it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感情旳空白 2025-01-31 05:55:57

我两个星期前发现了这个问题,经过一些忙碌的日子,我将把它发送到这里。另外,我认为这是一个错误。
在一般且快速的答案中,您应该添加包含CPU和内存基准的APM指标。在下面的几行中,我详细描述了我的情况。
Windows Server 2022 VPS是一个开发测试环境,我使用Elastic APM库开始了项目。该库收集CPU和内存指标,并通过默认配置将其发送为APM指标。之后,我更改了库,并使用了opentTelemetry。新的不会发送CPU和内存基准,我在测试中忽略了它,因为它的用法并不明显。当我通过清洁的弹性安装从开发环境转移到阶段环境时,出现了错误。经过一些调试后,我发现如果添加CPU和内存指标,问题可以解决。我通过将它们发送给我的第一个弹性APM库来添加指标,但其他指标可以使用Kibana并添加一些假指标。对于第二种方法,您可以看到ovidiu 注释

I found the problem two weeks ago, and After some busy days, I will send it here. Also, I think It's a bug.
In a general and fast answer, you should add APM metrics that contain CPU and memory benchmarks. In the below lines, I describe my case in detail.
Windows Server 2022 VPS is a development test environment, and I started my project with the Elastic APM library. This library collects CPU and memory metrics and sends them as APM Metrics by default configurations. After that, I changed my library and used OpentTelemetry. The new one does not send CPU and memory benchmarks, and I ignore it on tests because it's not noticeable for my usage. When I moved from the development to the staging environment with a clean installation of Elastic, an error appeared. After some debugging, I find that the problem solves if I add CPU and Memory metrics. I added metrics by sending them with my first Elastic APM Library, but others can use Kibana and add some fake metrics. For the second approach, you can see the Ovidiu comment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文