Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jholm117 committed Sep 4, 2024
1 parent 86c4b34 commit 91639e3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/awsxray-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion charts/awsxray-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions charts/awsxray-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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(
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 91639e3

Please sign in to comment.