Open jtbruch-fixdrepair opened 5 years ago
I was able to get logs from an AWS Lambda. I ended up creating a version of flush()
that returns a promise like this:
appInsights
.setup(appInsightsKey)
.setUseDiskRetryCaching(false)
.start();
const flushAsync = appInsights.defaultClient.flush.bind(appInsights.defaultClient);
const client = appInsights.defaultClient;
client.flush = function(): Promise<string> {
return new Promise(resolve =>
flushAsync({
callback: () => resolve('Sent'),
}),
);
};
Then in the handler function:
// handle the event
await client.flush()
return
This way the lambda won't shut down until after the AppInishgts client flushes the telemetry.
@carlo-quinonez thanks for your template, I created a variation based on your snippet.
const status = await new Promise((resolve) => {
client.flush({ callback: () => resolve("appInsights flushed") });
});
console.log(status);
Attempt:
I want to pipe Application Insights from an AWS Lambda into Azure so that I can see the metrics of my application.
I followed the normal steps to get it setup, and used this Stack Overflow to try and get it setup. However, it seems no matter the permutation, I can't get the data to show up in Azure.
Code:
Reference Functions:
Cloudwatch Logs: