diff --git a/charts/awsxray-exporter/Chart.yaml b/charts/awsxray-exporter/Chart.yaml index cc9dd38..9353f0b 100644 --- a/charts/awsxray-exporter/Chart.yaml +++ b/charts/awsxray-exporter/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 +version: 0.1.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/awsxray-exporter/templates/deployment.yaml b/charts/awsxray-exporter/templates/deployment.yaml index 02da570..ed5b237 100644 --- a/charts/awsxray-exporter/templates/deployment.yaml +++ b/charts/awsxray-exporter/templates/deployment.yaml @@ -34,7 +34,7 @@ spec: - name: {{ .Chart.Name }} env: - name: OTEL_COLLECTOR_URL - value: {{ .Values.otelCollectorUrl }} + value: {{ required "otelCollectorUrl is required" .Values.otelCollectorUrl }} - name: POLLING_INTERVAL_SECONDS value: {{ .Values.pollingIntervalSeconds }} - name: FILTER_EXPRESSION diff --git a/charts/awsxray-exporter/values.yaml b/charts/awsxray-exporter/values.yaml index 42be80e..d080d18 100644 --- a/charts/awsxray-exporter/values.yaml +++ b/charts/awsxray-exporter/values.yaml @@ -2,16 +2,18 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 - -otelCollectorUrl: "" +### App settings pollingIntervalSeconds: "10" +# otelCollectorUrl: "" +# filterExpression: "" -filterExpression: "" +### + +replicaCount: 1 image: - repository: jholm117/awsxray-exporter + repository: ghcr.io/jholm117/awsxray-exporter pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "" diff --git a/src/index.ts b/src/index.ts index 496ff37..17ca6f4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import { XRayClient, } from "@aws-sdk/client-xray"; -const POLLING_INTERVAL = +const POLLING_INTERVAL_MILLISECONDS = Number(process.env.POLLING_INTERVAL_SECONDS) * 1000 || 10000; const OTEL_COLLECTOR_URL = process.env.OTEL_COLLECTOR_URL; if (!OTEL_COLLECTOR_URL) { @@ -17,7 +17,7 @@ const client = new XRayClient({ region: "us-east-2" }); async function fetchTraces() { const EndTime = new Date(); - const StartTime = new Date(EndTime.getTime() - POLLING_INTERVAL); // Fetch traces from the last 60 seconds + const StartTime = new Date(EndTime.getTime() - POLLING_INTERVAL_MILLISECONDS); // Fetch traces from the last 60 seconds try { for await (const traceSummaries of paginateGetTraceSummaries( @@ -93,7 +93,9 @@ async function main() { while (true) { console.log("Polling X-Ray for traces"); await fetchTraces(); - await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL)); // Wait for 60 seconds before fetching new traces + await new Promise((resolve) => + setTimeout(resolve, POLLING_INTERVAL_MILLISECONDS) + ); // Wait for 60 seconds before fetching new traces } }