Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #5 - Add Kubernetes demo with inspectIT Ocelot and OpenTelmetry Collector #7

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
/.nb-gradle/

/working_directory/
**/configuration-server/users.db
spring-petclinic-docker-demo-gradle/configuration-server/users.db
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

This project provides a comprehensive demonstration of the capabilities of the inspectIT Ocelot Java agent using different infrastructure architectures.
A detailed description of each existing scenario can be found in the [documentation](https://inspectit.github.io/inspectit-ocelot/docs/getting-started/docker-examples).

You can find the docker demo based on the [Spring PetClinic](https://github.com/spring-projects/spring-petclinic) in the [`spring-petclinic-docker-demo`](./spring-petclinic-docker-demo) directory.

The kubernetes demo based on the [trading demo application](https://github.com/inspectIT/trading-demo-application) can be found in the [`trading-application-k8s-demo`](./trading-application-k8s-demo) directory.
File renamed without changes.
3 changes: 3 additions & 0 deletions spring-petclinic-docker-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# inspectIT Ocelot - Spring Petclinic Docker Demo

You can find the documentation of this demo in the [official inspectIT Ocelot documentation](https://inspectit.github.io/inspectit-ocelot/docs/getting-started/docker-examples).
2 changes: 1 addition & 1 deletion build.gradle → spring-petclinic-docker-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ task setVersionForDockerCompose(type: Copy) {

task packageDemo(type: Zip) {
dependsOn 'setVersionForDockerCompose'
archiveName = "inspectit-ocelot-demo-${version}.zip"
archiveName = "inspectit-ocelot-spring-petclinic-docker-demo-${version}.zip"
destinationDir = file(buildDir)

from (projectDir){
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
651 changes: 651 additions & 0 deletions trading-application-k8s-demo/README.md

Large diffs are not rendered by default.

Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
kind: Namespace
apiVersion: v1
metadata:
name: inspectit-ocelot
labels:
name: inspectit-ocelot
---
apiVersion: v1
kind: ConfigMap
metadata:
name: inspectit-ocelot-configurationserver-conf
namespace: inspectit-ocelot
labels:
app: inspectit-ocelot-configurationserver
component: inspectit-ocelot-configurationserver-conf
data:
inspectit-ocelot-configurationserver-config: |
inspectit:
exporters:
tracing:
jaeger:
enabled: ENABLED
# when the OTEL collector agent is injected as a sidecar, we can go with 'localhost'
url: http://localhost:14268/api/traces
# when the OTEL collector is deployed as an deployment, we need to address it directly
#url: http://otel-collector.otel.svc.cluster.local:14268/api/traces
instrumentation:
rules:
r_method_configuration_trace:
include:
r_trace_method: true
scopes:
s_trading_demo_frontend_public: true
s_trading_demo_backend_ExchangeController: true
r_method_configuration_duration:
include:
r_method_metric: true
scopes: {}

scopes:
s_trading_demo_frontend_public:
type:
name: rocks.inspectit.demo.frontend
matcher-mode: STARTS_WITH
methods:
- visibility: PUBLIC
s_trading_demo_backend_ExchangeController:
type:
name: rocks.inspectitdemo.backend.ExchangeController
matcher-mode: STARTS_WITH
methods:
- visibility: PUBLIC
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: inspectit-ocelot-configurationserver
name: inspectit-ocelot-configurationserver
namespace: inspectit-ocelot
spec:
replicas: 1
selector:
matchLabels:
app: inspectit-ocelot-configurationserver
strategy: {}
template:
metadata:
labels:
app: inspectit-ocelot-configurationserver
spec:
containers:
- image: inspectit/inspectit-ocelot-configurationserver
name: inspectit-ocelot-configurationserver
resources: {}
command: ["/bin/sh", "-c"]
args: ["mkdir -p /working_directory/files/trading-demo && cp /tmp/trading-demo-config.yaml /working_directory/files/trading-demo/trading-demo-config.yaml && sh /entrypoint.sh"]
env:
- name: INSPECTIT_CONFIG_SERVER_DEFAULT_USER_PASSWORD
value: "demo"
volumeMounts:
- name: inspectit-ocelot-configurationserver-config-vol
mountPath: /tmp/trading-demo-config.yaml
subPath: trading-demo-config.yaml
volumes:
- configMap:
name: inspectit-ocelot-configurationserver-conf
items:
- key: inspectit-ocelot-configurationserver-config
path: trading-demo-config.yaml
name: inspectit-ocelot-configurationserver-config-vol
status: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
app: inspectit-ocelot-configurationserver
name: inspectit-ocelot-configurationserver
namespace: inspectit-ocelot
spec:
ports:
- port: 8090
protocol: TCP
targetPort: 8090
selector:
app: inspectit-ocelot-configurationserver
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: opentelemetry.io/v1alpha1
kind: Instrumentation
metadata:
name: inspectit-ocelot-instrumentation
spec:
java:
image: inspectit/inspectit-ocelot-agent:1.15.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Service
metadata:
name: jaeger
namespace: monitoring
labels:
app: opentelemetry
component: jaeger-all-in-one
spec:
clusterIP: None
selector:
component: jaeger-all-in-one
ports:
- name: ui
protocol: TCP
port: 16686
targetPort: 16686
- name: thrift
protocol: TCP
port: 14268
targetPort: 14268
- name: proto
protocol: TCP
port: 14250
targetPort: 14250
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: jaeger
namespace: monitoring
labels:
app: opentelemetry
component: jaeger-all-in-one
spec:
selector:
matchLabels:
app: opentelemetry
component: jaeger-all-in-one
minReadySeconds: 5
progressDeadlineSeconds: 120
replicas: 1
template:
metadata:
labels:
app: opentelemetry
component: jaeger-all-in-one
spec:
containers:
- name: jaeger-all-in-one
image: jaegertracing/all-in-one:latest
ports:
- containerPort: 16686 # ui
- containerPort: 14268 # jaeger thrift
- containerPort: 14250 # jaeger model.proto
4 changes: 4 additions & 0 deletions trading-application-k8s-demo/jaeger/jaeger-all-in-one.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
name: jaeger
145 changes: 145 additions & 0 deletions trading-application-k8s-demo/otel/otel-collector-contrib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
kind: Namespace
apiVersion: v1
metadata:
name: otel
labels:
name: otel
---
apiVersion: v1
kind: Service
metadata:
name: otel-collector
namespace: otel
labels:
app: opentelemetry
component: otel-collector
spec:
ports:
- name: otlp-grpc # Default endpoint for OpenTelemetry gRPC receiver.
port: 4317
protocol: TCP
targetPort: 4317
- name: otlp-http # Default endpoint for OpenTelemetry HTTP receiver.
port: 4318
protocol: TCP
targetPort: 4318
- name: metrics # Default endpoint for querying metrics.
port: 8888
- name: prometheus # Prometheus exporter
protocol: TCP
port: 8889
targetPort: 8889
- name: jaeger-ace # Jaeger ACE receiver
port: 6831
targetPort: 6831
protocol: TCP
- name: jaeger-inspectit # Jaeger InspectIT Ocelot receiver
port: 14268
targetPort: 14268
protocol: TCP
selector:
component: otel-collector
---
apiVersion: v1
kind: ConfigMap
metadata:
name: otel-collector-conf
namespace: otel
labels:
app: opentelemetry
component: otel-collector-conf
data:
otel-collector-config: |
receivers:
otlp:
protocols:
grpc:
http:
jaeger:
protocols:
thrift_compact:
thrift_binary:
thrift_http:
processors:
batch:
memory_limiter:
# 80% of maximum memory up to 2G
limit_mib: 1500
# 25% of limit up to 2G
spike_limit_mib: 512
check_interval: 5s
extensions:
zpages: {}
memory_ballast:
# Memory Ballast size should be max 1/3 to 1/2 of memory.
size_mib: 683
exporters:
jaeger:
# export to Jaeger in the namespace monitoring via gRPC
endpoint: "jaeger.monitoring:14250"
tls:
insecure: true
logging:
service:
extensions: [zpages, memory_ballast]
pipelines:
traces/1:
receivers: [otlp, jaeger]
processors: [memory_limiter, batch]
exporters: [jaeger, logging]
telemetry:
logs:
level: "info"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: otel-collector
namespace: otel
labels:
app: opentelemetry
component: otel-collector
spec:
selector:
matchLabels:
app: opentelemetry
component: otel-collector
minReadySeconds: 5
progressDeadlineSeconds: 120
replicas: 1
template:
metadata:
labels:
app: opentelemetry
component: otel-collector
spec:
containers:
- command:
- "/otelcol"
- "--config=/conf/otel-collector-config.yaml"
image: otel/opentelemetry-collector-contrib:0.47.0
name: otel-collector
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 200m
memory: 400Mi
ports:
- containerPort: 55679 # Default endpoint for ZPages.
- containerPort: 4317 # Default endpoint for OpenTelemetry receiver.
- containerPort: 14250 # Default endpoint for Jaeger gRPC receiver.
- containerPort: 14268 # Default endpoint for Jaeger HTTP receiver.
- containerPort: 9411 # Default endpoint for Zipkin receiver.
- containerPort: 8888 # Default endpoint for querying metrics.
volumeMounts:
- name: otel-collector-config-vol
mountPath: /conf
volumes:
- configMap:
name: otel-collector-conf
items:
- key: otel-collector-config
path: otel-collector-config.yaml
name: otel-collector-config-vol
Loading