Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
55b75dc
Add interactive mode to demo.sh and test folder
girodav Oct 28, 2025
176cc42
Add basic tests and github workflow
girodav Oct 30, 2025
5521a29
Add K8s tests
girodav Oct 30, 2025
1184cf8
Add branch directive to github workflow
girodav Oct 30, 2025
7dbeef8
Use the actual return code
girodav Oct 30, 2025
8a86809
Varius fixes
girodav Oct 31, 2025
2208b25
fix: Add newline to end of files
osullivandonal Dec 9, 2025
6d2c552
fix: Remove newline
osullivandonal Dec 9, 2025
44579ac
Merge remote-tracking branch 'origin/main' into questions-for-arguments
osullivandonal Dec 9, 2025
fda8d5f
Add spacing and newline to user prompts when running demo.sh in
osullivandonal Dec 9, 2025
bda02b3
fix: Free up disc space for running elastic integration tests
osullivandonal Dec 9, 2025
a034df0
Update bash unit test for the docker services to use a list of docker
osullivandonal Dec 10, 2025
d32cb85
Update the Elastic README to reflect the new prompt input for running
osullivandonal Dec 10, 2025
6ca10de
Fix docker compose list of services
osullivandonal Dec 10, 2025
0a64942
Update elastic tests to include error logging for CI output
osullivandonal Dec 10, 2025
f55f108
Removed not needed comments
osullivandonal Dec 10, 2025
28e4ab0
Add debug statements to k8s test
osullivandonal Dec 10, 2025
6e68e23
Revert "Update elastic tests to include error logging for CI output"
osullivandonal Dec 10, 2025
63d930c
Update bashunit k8s tests to use custom assertions, this will allow test
osullivandonal Dec 10, 2025
a60011f
Update bashunit docker tests to use custom assertions, this will allow
osullivandonal Dec 10, 2025
7d43da2
Update demo to only prompt the user for elastic creds if they do not
osullivandonal Dec 10, 2025
ab5c1ee
Log out debug info to see what is going on with the k8s test
osullivandonal Dec 10, 2025
0c7b92f
Update elastic README to remove Managed Ingest Endpoint and replace it
osullivandonal Dec 11, 2025
b2f308c
Skip elastic k8s integration tests as helm is causing missing values to
osullivandonal Dec 11, 2025
c670473
Move the bashunit env var to .env.override
osullivandonal Dec 11, 2025
75943b6
Remove the newline added
osullivandonal Dec 11, 2025
d0da9e4
Update the bashunit integration tests to use maximize-build-space
osullivandonal Dec 11, 2025
d0b554c
Merge branch 'main' into questions-for-arguments
osullivandonal Dec 11, 2025
66b577f
Remove dotnet and androind from ubuntu test runner for elastic
osullivandonal Dec 12, 2025
494ca31
Use 4 core ubuntu for running elastic integration tests in CI, the
osullivandonal Dec 12, 2025
e362a1a
Run the elastic integration tests in the CI on ubuntu latest
osullivandonal Dec 12, 2025
8e9a55c
Only install elastic search for elastic integration tests in CI, this is
osullivandonal Dec 12, 2025
83ce2ae
Maximise build space for elastic CI tests
osullivandonal Dec 12, 2025
97387eb
Use ubuntu-slim for elastic integration tests to address resource issues
osullivandonal Dec 12, 2025
76a567c
Perform disc cleanup before running elastic integration tests in CI
osullivandonal Dec 12, 2025
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
3 changes: 3 additions & 0 deletions .env.bashunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BASHUNIT_DEFAULT_PATH=test/elastic
BASHUNIT_BOOTSTRAP="${BASHUNIT_DEFAULT_PATH}/bootstrap.sh"

5 changes: 5 additions & 0 deletions .env.override
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ OTEL_COLLECTOR_CONFIG="./src/otel-collector/otelcol-elastic-config.yaml"
ELASTICSEARCH_ENDPOINT="YOUR_ENDPOINT"
ELASTICSEARCH_API_KEY="YOUR_API_KEY"

# *********************
# Bashunit Tests
# *********************
BASHUNIT_BOOTSTRAP=test/elastic/bootstrap.sh

# To use a real OpenAI API-compatible LLM,
# set the appropriate values for the target LLM
# Required permissions:
Expand Down
20 changes: 14 additions & 6 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ Additionally, the OpenTelemetry Contrib collector has also been changed to the [
#### Elasticsearch exporter (default)

1. Start a free trial on [Elastic Cloud](https://cloud.elastic.co/) and copy the `Elasticsearch endpoint` and the `API Key` from the `Help -> Connection details` drop down instructions in your Kibana. These variables will be used by the [elasticsearch exporter](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter#elasticsearch-exporter) to authenticate and transmit data to your Elasticsearch instance.
2. Run `./demo.sh cloud-hosted docker`.
2. Run `./demo.sh` and enter:
- Deployment type: `cloud-hosted`
- Platform: `docker`

#### Managed Ingest Endpoint
#### mOTLP
1. Sign up for a free trial on [Elastic Cloud](https://cloud.elastic.co/) and start an Elastic Cloud Serverless Observability type project. Select Add data, Application and then OpenTelemetry.
2. Copy the OTEL_EXPORTER_OTLP_ENDPOINT URL.
3. Click "Create an API Key" to create one.
4. Run `./demo.sh serverless docker`
4. Run `./demo.sh` and enter:
- Deployment type: `serverless`
- Platform: `docker`

#### Connect to a local Elasticsearch cluster
The following steps shows how to start the Otel demo in a Docker container and send the generated otel data to an Elasticsearch instance running locally on the host.
Expand Down Expand Up @@ -64,7 +68,7 @@ make start
make start
```

#### Managed Ingest Endpoint
#### mOTLP

1. Sign up for a free trial on [Elastic Cloud](https://cloud.elastic.co/) and start an Elastic Cloud Serverless Observability type project. Select Add data, Application and then OpenTelemetry.
2. Copy the OTEL_EXPORTER_OTLP_ENDPOINT URL.
Expand All @@ -87,8 +91,12 @@ make start

### Automated Installation

- **Elasticsearch exporter:** Run `./demo.sh cloud-hosted k8s`
- **Managed Ingest Endpoint:** Run `./demo.sh serverless k8s`
- **Elasticsearch exporter:** Run `./demo.sh` and enter:
- Deployment type: `cloud-hosted`
- Platform: `k8s`
- **mOTLP:** Run `./demo.sh` and enter:
- Deployment type: `serverless`
- Platform: `k8s`

### Manual Installation

Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/run-integration-tests-elastic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Elastic Integration Tests

on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
paths-ignore:
- '.github/README.md'

permissions:
contents: read

jobs:
run-tests:
name: Test
runs-on: ubuntu-latest

steps:
- name: Free up disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo docker builder prune -a

- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Compose
uses: docker/setup-compose-action@v1

- name: Create k8s Kind Cluster
uses: helm/kind-action@v1

- name: Set up helm
uses: azure/[email protected]

- name: Install bashunit
run: |
curl -s https://bashunit.typeddevs.com/install.sh | bash -s bin

- name: Run the tests
run: |
./bin/bashunit --env .env.bashunit
140 changes: 92 additions & 48 deletions demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,37 @@ elasticsearch_endpoint=""
elasticsearch_api_key=""

usage() {
echo "Usage: $0 [cloud-hosted|serverless] [docker|k8s] | destroy [docker|k8s]"
exit 1
echo "Run the script with no arguments. This will start an interactive prompt that will guide you through the setup of the Elastic OpenTelemetry Demo."
echo
echo "To destroy the demo, run: $0 destroy [docker|k8s]"
echo " - pass 'docker' or 'k8s' to destroy only that platform"
echo " - omit the platform to destroy both docker and k8s resources"
exit 1
}

parse_args() {
if [ $# -eq 0 ]; then
usage

while true; do
echo
printf "❓ Which Elasticsearch deployment type do you want to send the data into? [serverless/cloud-hosted]? "
read -r deployment_type
case "$deployment_type" in
cloud-hosted | serverless) break ;;
*) echo "Please enter 'cloud-hosted' or 'serverless'." ;;
esac
done

while true; do
echo
printf "❓ In which environment the demo should be deployed? [docker/k8s]? "
read -r platform
case "$platform" in
docker | k8s) break ;;
*) echo "Please enter 'docker' or 'k8s'." ;;
esac
done
return
fi

if [ "$1" = "destroy" ]; then
Expand All @@ -67,20 +91,18 @@ parse_args() {
fi
return
fi

deployment_type="$1"
if [ $# -ge 2 ]; then
platform="$2"
fi
usage
}

update_env_var() {
VAR="$1"
VAL="$2"
tmp=$(mktemp) || exit 1

if grep -q "^$VAR=" "$ENV_OVERRIDE_FILE"; then
sed_in_place "s|^$VAR=.*|$VAR=\"$VAL\"|" "$ENV_OVERRIDE_FILE"
else
echo "$VAR=\"$VAL\"" >> "$ENV_OVERRIDE_FILE"
echo "$VAR=\"$VAL\"" >>"$ENV_OVERRIDE_FILE"
fi
}

Expand All @@ -100,13 +122,15 @@ read_secret() {

ensure_env_values() {
echo
if [ -z "$elasticsearch_endpoint" ]; then
if [ "$deployment_type" = "serverless" ]; then
printf "🔑 Enter your Elastic OTLP endpoint: "
else
printf "🔑 Enter your Elastic endpoint: "
if ! check_existing_credentials; then
if [ -z "$elasticsearch_endpoint" ]; then
if [ "$deployment_type" = "serverless" ]; then
printf "🔑 Enter your Elastic OTLP endpoint: "
else
printf "🔑 Enter your Elastic endpoint: "
fi
read -r elasticsearch_endpoint
fi
read -r elasticsearch_endpoint
fi

if [ -z "$elasticsearch_api_key" ]; then
Expand All @@ -118,15 +142,35 @@ ensure_env_values() {
# Resolve OTEL Collector config path for Docker based on deployment_type
set_docker_collector_config() {
case "$deployment_type" in
cloud-hosted)
OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_CLOUD
;;
serverless)
OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_SERVERLESS
;;
cloud-hosted)
OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_CLOUD
;;
serverless)
OTEL_COLLECTOR_CONFIG=$DOCKER_COLLECTOR_CONFIG_SERVERLESS
;;
esac
}

check_existing_credentials() {
if [ ! -f "$ENV_OVERRIDE_FILE" ]; then
return 1
fi

elasticsearch_endpoint=$(grep "^ELASTICSEARCH_ENDPOINT=" "$ENV_OVERRIDE_FILE" | cut -d'=' -f2- | tr -d '"')
elasticsearch_api_key=$(grep "^ELASTICSEARCH_API_KEY=" "$ENV_OVERRIDE_FILE" | cut -d'=' -f2- | tr -d '"')

if [ -n "$elasticsearch_endpoint" ] && [ -n "$elasticsearch_api_key" ] &&
[ "$elasticsearch_endpoint" != "YOUR_ENDPOINT" ] &&
[ "$elasticsearch_api_key" != "YOUR_API_KEY" ]; then
echo "✅ Using existing credentials from $ENV_OVERRIDE_FILE"
return 0
fi

elasticsearch_endpoint=""
elasticsearch_api_key=""
return 1
}

start_docker() {
set_docker_collector_config
ensure_env_values
Expand All @@ -147,31 +191,31 @@ ensure_k8s_prereqs() {
apply_k8s_secret() {
ensure_env_values
case "$deployment_type" in
cloud-hosted)
kubectl create secret generic "$SECRET_NAME" \
--namespace "$NAMESPACE" \
--from-literal=elastic_endpoint="$elasticsearch_endpoint" \
--from-literal=elastic_api_key="$elasticsearch_api_key" \
--dry-run=client -o yaml | kubectl apply -f -
;;
serverless)
kubectl create secret generic "$SECRET_NAME" \
--namespace "$NAMESPACE" \
--from-literal=elastic_otlp_endpoint="$elasticsearch_endpoint" \
--from-literal=elastic_api_key="$elasticsearch_api_key" \
--dry-run=client -o yaml | kubectl apply -f -
;;
cloud-hosted)
kubectl create secret generic "$SECRET_NAME" \
--namespace "$NAMESPACE" \
--from-literal=elastic_endpoint="$elasticsearch_endpoint" \
--from-literal=elastic_api_key="$elasticsearch_api_key" \
--dry-run=client -o yaml | kubectl apply -f -
;;
serverless)
kubectl create secret generic "$SECRET_NAME" \
--namespace "$NAMESPACE" \
--from-literal=elastic_otlp_endpoint="$elasticsearch_endpoint" \
--from-literal=elastic_api_key="$elasticsearch_api_key" \
--dry-run=client -o yaml | kubectl apply -f -
;;
esac
}

install_kube_stack() {
case "$deployment_type" in
cloud-hosted)
VALUES_URL="$KUBE_STACK_VALUES_URL_CLOUD"
;;
serverless)
VALUES_URL="$KUBE_STACK_VALUES_URL_SERVERLESS"
;;
cloud-hosted)
VALUES_URL="$KUBE_STACK_VALUES_URL_CLOUD"
;;
serverless)
VALUES_URL="$KUBE_STACK_VALUES_URL_SERVERLESS"
;;
esac

helm upgrade --install "$KUBE_STACK_RELEASE" "$KUBE_STACK_CHART" \
Expand All @@ -197,7 +241,6 @@ destroy_docker() {
echo
}


destroy_k8s() {
echo
helm uninstall "$DEMO_RELEASE" --ignore-not-found
Expand All @@ -208,33 +251,33 @@ destroy_k8s() {
}

main() {
parse_args "$@"

echo '----------------------------------------------------'
echo '🚀 OpenTelemetry Demo with Elastic Observability'
echo '----------------------------------------------------'

parse_args "$@"

if [ "$destroy" = "true" ]; then
if [ -z "$platform" ]; then
echo "⌛️ Destroying Docker and Kubernetes resources..."
destroy_docker
destroy_k8s
echo "✅ Done! Destroyed Docker and Kubernetes resources."
return 0
exit 0
fi

if [ "$platform" = "docker" ]; then
echo "⌛️ Destroying Docker resources..."
destroy_docker
echo "✅ Done! Destroyed Docker resources."
return 0
exit 0
fi

if [ "$platform" = "k8s" ]; then
echo "⌛️ Destroying Kubernetes resources..."
destroy_k8s
echo "✅ Done! Destroyed Kubernetes resources."
return 0
exit 0
fi

usage
Expand All @@ -248,8 +291,9 @@ main() {
usage
fi

echo "⌛️ Starting OTel Demo + EDOT on '$platform' → Elastic ($deployment_type)..."
echo
echo "⌛️ Starting OTel Demo + EDOT on '$platform' → Elastic ($deployment_type)..."

if [ "$platform" = "docker" ]; then
start_docker
else
Expand Down
Loading
Loading