elastic / opentelemetry-demo

OpenTelemetry Community Demo Application
Apache License 2.0
21 stars 30 forks source link

OTel logo :heavy_plus_sign: OTel logo OpenTelemetry Demo with Elastic Observability

The following guide describes how to setup the OpenTelemetry demo with Elastic Observability using Docker compose or Kubernetes. This fork introduces several changes to the agents used in the demo:

Additionally, the OpenTelemetry Contrib collector has also been changed to the Elastic OpenTelemetry Collector distribution. This ensures a more integrated and optimized experience with Elastic Observability.

Docker compose

  1. Start a free trial on Elastic Cloud and copy the endpoint and secretToken from the Elastic APM setup instructions in your Kibana.
  2. Open the file src/otelcollector/otelcol-elastic-config-extras.yaml in an editor and replace the following two placeholders:
    • YOUR_APM_ENDPOINT_WITHOUT_HTTPS_PREFIX: your Elastic APM endpoint (without https:// prefix) that must also include the port (example: 1234567.apm.us-west2.gcp.elastic-cloud.com:443).
    • YOUR_APM_SECRET_TOKEN: your Elastic APM secret token.
  3. Start the demo with the following command from the repository's root directory:
    make start

Kubernetes

Prerequisites:

Start the Demo

  1. Setup Elastic Observability on Elastic Cloud.
  2. Create a secret in Kubernetes with the following command.
    kubectl create secret generic elastic-secret \
     --from-literal=elastic_apm_endpoint='YOUR_APM_ENDPOINT_WITHOUT_HTTPS_PREFIX' \
     --from-literal=elastic_apm_secret_token='YOUR_APM_SECRET_TOKEN'

    Don't forget to replace

    • YOUR_APM_ENDPOINT_WITHOUT_HTTPS_PREFIX: your Elastic APM endpoint (without https:// prefix) that must also include the port (example: 1234567.apm.us-west2.gcp.elastic-cloud.com:443).
    • YOUR_APM_SECRET_TOKEN: your Elastic APM secret token
  3. Execute the following commands to deploy the OpenTelemetry demo to your Kubernetes cluster:

    # clone this repository
    git clone https://github.com/elastic/opentelemetry-demo
    
    # switch to the kubernetes/elastic-helm directory
    cd kubernetes/elastic-helm
    
    # !(when running it for the first time) add the open-telemetry Helm repostiroy
    helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
    
    # !(when an older helm open-telemetry repo exists) update the open-telemetry helm repo
    helm repo update open-telemetry
    
    # deploy the demo through helm install
    helm install -f deployment.yaml my-otel-demo open-telemetry/opentelemetry-demo

Kubernetes monitoring

This demo already enables cluster level metrics collection with clusterMetrics and Kubernetes events collection with kubernetesEvents.

In order to add Node level metrics collection we can run an additional Otel collector Daemonset with the following:

  1. Create a secret in Kubernetes with the following command.

    kubectl create secret generic elastic-secret-ds \
     --from-literal=elastic_endpoint='YOUR_ELASTICSEARCH_ENDPOINT' \
     --from-literal=elastic_api_key='YOUR_ELASTICSEARCH_API_KEY'

    Don't forget to replace

    • YOUR_ELASTICSEARCH_ENDPOINT: your Elasticsearch endpoint (with https:// prefix example: https://1234567.us-west2.gcp.elastic-cloud.com:443).
    • YOUR_ELASTICSEARCH_API_KEY: your Elasticsearch API Key
  2. Execute the following command to deploy the OpenTelemetry Collector to your Kubernetes cluster, in the same directory kubernetes/elastic-helm in this repository.

# deploy the Elastic OpenTelemetry collector distribution through helm install
helm install otel-daemonset open-telemetry/opentelemetry-collector --values daemonset.yaml

Explore and analyze the data With Elastic

Service map

Service map

Traces

Traces

Correlation

Correlation

Logs

Logs