Skip to content

Commit

Permalink
update example to show all histogram metrics by default
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames committed Sep 19, 2024
1 parent f93217f commit 20439b7
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions example/opentelemetry/opentelemetry.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "dotenv/config";
import { CredentialsMethod, FgaApiValidationError, OpenFgaClient, TelemetryAttribute, TelemetryMetricConfiguration, TelemetryMetricsConfiguration } from "@openfga/sdk";
// import { TelemetryConfiguration } from "../../telemetry/configuration";
import { CredentialsMethod, FgaApiValidationError, OpenFgaClient, TelemetryAttribute, TelemetryConfiguration } from "@openfga/sdk";

let credentials;
if (process.env.FGA_CLIENT_ID) {
Expand All @@ -23,25 +22,8 @@ const counterCredentialsRequestAttributes = new Set([
TelemetryAttribute.FgaClientRequestClientId
]);

const histogramRequestDurationAttributes = new Set([
TelemetryAttribute.HttpResponseStatusCode,
TelemetryAttribute.UserAgentOriginal,
TelemetryAttribute.HttpRequestMethod,
TelemetryAttribute.FgaClientRequestClientId,
TelemetryAttribute.FgaClientRequestStoreId,
TelemetryAttribute.FgaClientResponseModelId,
TelemetryAttribute.HttpRequestResendCount,
]);

const histogramQueryDurationAttributes = new Set([
TelemetryAttribute.HttpResponseStatusCode,
TelemetryAttribute.UserAgentOriginal,
TelemetryAttribute.HttpRequestMethod,
TelemetryAttribute.FgaClientRequestClientId,
TelemetryAttribute.FgaClientRequestStoreId,
TelemetryAttribute.FgaClientResponseModelId,
TelemetryAttribute.HttpRequestResendCount,
]);
const histogramRequestDurationAttributes = TelemetryConfiguration.validAttriburtes;
const histogramQueryDurationAttributes = TelemetryConfiguration.validAttriburtes;

const telemetryConfig = {
metrics: {
Expand Down

0 comments on commit 20439b7

Please sign in to comment.