How do I capture the opensearch client to get additional X-Ray traces?

0

I AM USING THIS CODE IN A LAMBDA WITH X-RAY ENABLED.

I want to use captureAWSv3Client, to get additional opensearch information on X-Ray, the same way you can do it with DynamoDB, but i have been unable to do it.

I receive an error when using the client from @opensearch-project/opensearch.

import { captureAWSv3Client } from "aws-xray-sdk";
import { Client } from "@opensearch-project/opensearch";

const openProjectClient = new Client({});

captureAWSv3Client(openProjectClient); // Error: Argument of type 'Client' is not assignable to parameter of type middlewareStack

openProjectClient.search({});

Is it possible to capture the javascript opensearch client?


In a side note i just realized that i can do this:

import { OpenSearchClient } from "@aws-sdk/client-opensearch";
const awsOPServiceClient = new ElasticsearchServiceClient();
captureAWSv3Client(awsOPServiceClient);
awsOPServiceClient.search(); // Does to exist
awsOPServiceClient .send(new Search()); // Does not exist

But i cannot do any service action with OpenSearchClient

luis
已提问 5 个月前179 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则