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
asked 5 months ago171 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions