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 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南