Skip to content

Commit

Permalink
Update comments in faas example
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Beutell committed Jul 20, 2023
1 parent d84f95f commit 86368c6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/faas-experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@
*
*/

// NOTE - for now we need a fetch polyfill
// this will already exist in the browser and in Deno, for what it's worth
// NOTE - For now we need a fetch polyfill in node.
// (Fetch will already be defined in the browser and in Deno.)
import "./fetch-polyfill";
import { init as initAutometrics, autometrics } from "@autometrics/autometrics";

initAutometrics({
// NOTE - The current default exporter does not play nicely with Prometheus Push Gateway,
// You'll end up with the error: "pushed metrics are invalid or inconsistent with existing metrics: pushed metrics must not have timestamps"
// However, it does work with aggregation gateways
// You'll end up with the error:
// "pushed metrics are invalid or inconsistent with existing metrics: pushed metrics must not have timestamps"
//
// However, everything works fine with aggregation gateways
//
pushGateway: "http://localhost:9092/metrics",
pushInterval: 0,
});

// Create a getCheese function that returns "gouda"
const getGouda = autometrics(async function getGouda() {
const getCheese = autometrics(async function getCheese() {
await new Promise((resolve) => setTimeout(resolve, 120));
return "gouda";
});

getGouda();
// This should produce proper metrics
getCheese();

0 comments on commit 86368c6

Please sign in to comment.