Skip to content

Commit 2ae520c

Browse files
committed
last updates for swat
1 parent 560055b commit 2ae520c

File tree

3 files changed

+81
-12
lines changed

3 files changed

+81
-12
lines changed

kubernetes/opentelemetry-demo.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,8 @@ spec:
13681368
serviceAccountName: opentelemetry-demo
13691369
containers:
13701370
- name: fraud-detection
1371-
image: 'ghcr.io/open-telemetry/demo:2.1.3-fraud-detection'
1371+
#image: 'ghcr.io/open-telemetry/demo:2.1.3-fraud-detection'
1372+
image: ghcr.io/splunk/opentelemetry-demo/otel-fraud-detection:2.1.0
13721373
imagePullPolicy: IfNotPresent
13731374
env:
13741375
- name: OTEL_SERVICE_NAME
@@ -1860,8 +1861,9 @@ spec:
18601861
containers:
18611862
- name: payment
18621863
#image: 'ghcr.io/open-telemetry/demo:2.1.3-payment'
1863-
image: ghcr.io/splunk/opentelemetry-demo/otel-payment:2.1.3
1864+
image: ghcr.io/splunk/opentelemetry-demo/otel-payment:2.1.3amd
18641865
imagePullPolicy: Always
1866+
18651867
ports:
18661868
- containerPort: 8080
18671869
name: service
@@ -1877,14 +1879,16 @@ spec:
18771879
fieldPath: status.hostIP
18781880
- name: OTEL_COLLECTOR_NAME
18791881
value: $(NODE_IP)
1882+
- name: OTEL_EXPORTER_OTLP_PROTOCOL
1883+
value: grpc
18801884
- name: OTEL_TRACES_EXPORTER
18811885
value: otlp
18821886
- name: OTEL_METRICS_EXPORTER
18831887
value: otlp
18841888
- name: OTEL_LOGS_EXPORTER
18851889
value: otlp
18861890
- name: SPLUNK_OTEL_LOG_CORRELATION_ENABLED
1887-
value: "true"
1891+
value: "true"
18881892
- name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
18891893
value: cumulative
18901894
- name: PAYMENT_PORT
@@ -1894,20 +1898,24 @@ spec:
18941898
- name: FLAGD_PORT
18951899
value: "8013"
18961900
- name: OTEL_EXPORTER_OTLP_ENDPOINT
1897-
value: http://$(OTEL_COLLECTOR_NAME):4317
1901+
value: http://$(NODE_IP):4317
1902+
- name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
1903+
value: http://$(NODE_IP):4317
18981904
- name: OTEL_RESOURCE_ATTRIBUTES
18991905
value: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3
19001906
- name: OTEL_PROFILER_LOGS_ENDPOINT
1901-
value: http://$(OTEL_COLLECTOR_NAME):4317
1907+
value: http://$(OTEL_COLLECTOR_NAME):4318
19021908
- name: SPLUNK_PROFILER_CALL_STACK_INTERVAL
19031909
value: "750"
19041910
- name: SPLUNK_PROFILER_ENABLED
19051911
value: "true"
19061912
- name: SPLUNK_PROFILER_MEMORY_ENABLED
1907-
value: "true"
1913+
value: "false"
1914+
- name: OTEL_LOG_LEVEL
1915+
value: "info"
19081916
resources:
19091917
limits:
1910-
memory: 120Mi
1918+
memory: 320Mi
19111919
securityContext:
19121920
runAsGroup: 1000
19131921
runAsNonRoot: true
@@ -2354,7 +2362,7 @@ spec:
23542362
# secretKeyRef:
23552363
# name: workshop-secret
23562364
# key: url
2357-
value: 192.168.3.26
2365+
value: 192.168.3.214
23582366
volumeMounts:
23592367
- name: puppeteer
23602368
subPath: local-file
@@ -2478,4 +2486,4 @@ data:
24782486
cycle += 1;
24792487
await delay(5000); // wait 5 seconds before next cycle
24802488
}
2481-
})();
2489+
})();

src/fraud-detection/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ RUN gradle shadowJar
1515

1616
FROM gcr.io/distroless/java17-debian12:nonroot
1717

18-
ARG OTEL_JAVA_AGENT_VERSION
18+
ARG SPLUNK_OTEL_JAVA_VERSION=2.20.1
1919
WORKDIR /usr/src/app/
2020

21-
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar
22-
ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar
21+
ADD --chmod=644 https://github.com/signalfx/splunk-otel-java/releases/download/v${SPLUNK_OTEL_JAVA_VERSION}/splunk-otel-javaagent.jar /usr/src/app/splunk-otel-javaagent.jar
22+
ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/splunk-otel-javaagent.jar
2323

2424
COPY --from=builder /usr/src/app/build/libs/fraud-detection-1.0-all.jar fraud-detection-1.0-all.jar
2525

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash -e
2+
3+
# Usage:
4+
# ./build-fraud-detection.sh <version> [-cc]
5+
6+
if [ -z "$1" ]; then
7+
echo "❌ Error: No version provided."
8+
echo "Usage: $0 <version> [-cc]"
9+
exit 1
10+
fi
11+
12+
VERSION="$1"
13+
CACHE_OPTION=""
14+
15+
# Check if the second arg is -cc
16+
if [[ "$2" == "-cc" ]]; then
17+
CACHE_OPTION="--no-cache"
18+
fi
19+
20+
# Move two directories up from src/fraud-detection
21+
cd "$(dirname "$0")/../.."
22+
23+
echo "Building fraud-detection service version: $VERSION"
24+
echo "Build options: ${CACHE_OPTION:-default caching enabled}"
25+
26+
# Build without push first
27+
DOCKER_CMD=(
28+
docker buildx build
29+
--platform=linux/amd64,linux/arm64
30+
$CACHE_OPTION
31+
--build-arg SPLUNK_OTEL_JAVA_VERSION=2.20.1
32+
-t ghcr.io/splunk/opentelemetry-demo/otel-fraud-detection:"$VERSION"
33+
--load
34+
-f src/fraud-detection/Dockerfile
35+
.
36+
)
37+
38+
echo "Executing build command..."
39+
if ! "${DOCKER_CMD[@]}"; then
40+
echo "❌ Error: Docker build failed"
41+
exit 1
42+
fi
43+
44+
echo "✅ Build successful"
45+
46+
# Verify image exists locally
47+
if ! docker image inspect ghcr.io/splunk/opentelemetry-demo/otel-fraud-detection:"$VERSION" > /dev/null 2>&1; then
48+
echo "❌ Error: Built image not found locally"
49+
exit 1
50+
fi
51+
52+
echo "✅ Image verified locally"
53+
54+
# Push the image
55+
echo "Pushing image to registry..."
56+
if ! docker push ghcr.io/splunk/opentelemetry-demo/otel-fraud-detection:"$VERSION"; then
57+
echo "❌ Error: Push failed. Check your registry authentication."
58+
exit 1
59+
fi
60+
61+
echo "✅ Successfully pushed ghcr.io/splunk/opentelemetry-demo/otel-fraud-detection:$VERSION"

0 commit comments

Comments
 (0)