Digma Developer Guide
  • Welcome to the Digma Docs!
  • What is a Continuous Feedback platform?
  • Digma Quickstart
  • Installation
    • Local Install
      • Local Install Architecture
      • Installation Troubleshooting
    • Central (on-prem) Install
      • Resource Requirements
  • INSTRUMENTATION
    • Instrumenting your code for tracing
    • Java
      • Automatic Instrumentation in the IDE (IntelliJ)
      • Spring, Spring Boot, Dropwizard
        • Instrumenting your code in CI/Staging or the terminal
        • Instrumenting your application in Docker Compose
        • Instrumenting your application on Kubernetes
        • Covering more of your code with Observability
        • Using GitHub Actions (beta)
        • Using Micrometer Tracing (Spring Boot 3.x only)
        • Instrumenting code running in CLI
      • Quarkus, Micronaut, OpenLiberty
    • .NET
    • Correlating observability and source code commits
    • Sending Data to Digma using the OTEL Collector
    • Sending Data to Digma Using the Datadog agent
  • Use Cases
    • Design and write code more efficiently by understanding the system flows
    • Get early feedback on bottlenecks and code issues
    • Prioritize Technical Debt
  • Digma Core Concepts
    • Environments
    • Assets
    • Analytics vs. Issues
  • Digma Features
    • Issues
      • Suspected N+1
      • Excessive API calls (chatty API)
      • Bottleneck
      • Scaling Issue
      • Session In View Query Detected
      • Query Optimization Suggested
      • High number of queries
      • Slow Endpoint
    • Analytics
      • Top Usage
      • Request Breakdown
      • Duration
      • Code Nexus
      • Duration Breakdown
      • Endpoint Low/High Usage
    • Performance Impact
    • Test observability
    • Issue Criticality
  • Sample Projects
    • Spring Boot
  • Troubleshooting
    • Reporting Plugin Issues
    • Digma Overload Warning
Powered by GitBook
On this page
  • Using Helm and Kustomize
  • Updating the Helm file manually
  1. INSTRUMENTATION
  2. Java
  3. Spring, Spring Boot, Dropwizard

Instrumenting your application on Kubernetes

PreviousInstrumenting your application in Docker ComposeNextCovering more of your code with Observability

Last updated 11 months ago

Using Helm and Kustomize

If your application is running on Kubernetes you can easily instrument it using Digma without changing the original Helm chart/YAML files. We recommend using for ease of use.

  1. Install .

  2. Clone or download our repo

  3. Make sure the scripts have execution permission

sudo chmod +x ./kustomize/kustomize_build.sh
sudo chmod +x ./kustomize/create_customization.sh
  1. Run the create_customization.sh script. You'll need to pass it some parameters based on the application and the Digma collector-api IP/DNS address (read more ). Once you run this command, the helper scripts will generate a patch that can be applied with your Helm file to instrument the application.

[PATH_TO_HELPER_REPO_ROOT]/kustomize/create_kustomization.sh [DIGMA_COLLECTOR_URL] [SERVICE_NAME] [ENV_NAME] [LABEL_TARGET_SELECTOR]
  • PATH_TO_HELPER_REPO_ROOT: The location where you cloned the helper repo to

  • DIGMA_COLLECTOR_URL: The URL of the Digma collector endpoint and port. For example: http://internal.collector.dns:5050

  • ENVIRONMENT_ID: The Digma identifier to associate the observability data for this deployment with. To retrieve the environment identifier see the instructions on the .

  • LABEL_TARGET_SELECTOR: These are selectors used to select which application to apply the instrumentation on.

Following the last step, you should have two generated files in your local directory: patch.yaml and kustomization.yaml these will be used to patch in the instrumentation logic when you run the Helm file in the next step.

  1. Finally, run your helm file with an additional --post-renderer argument

helm install [NAME] [PATH_TO_HELM_CHART] -n [NAMESPACE} --post-renderer [PATH_TO_HELPER_REPO_ROOT]/kustomize/kustomize_build.sh 

Updating the Helm file manually

The key steps to updating the application deployment are:

  1. Mounting the OTEL agent and Digma agent extension to a volume accessible to the app container

  2. Setting environment variables so that the Java process will use the OTEL agent and extension

See below an example of accomplishing these two steps using an init container and some environment variables. You can see the added code between the comment lines.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-deployment
  labels:
    app: pet-clinic-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pet-clinic-app
  template:
    metadata:
      labels:
        app: pet-clinic-app
    spec:
      containers:
      - name: pet-clinic
        image: springio/petclinic:latest
#--------------------------------------------- 
# add instrumentation logic
        env:
        - name: JAVA_TOOL_OPTIONS 
          value: -javaagent:/shared-vol/otel-agent.jar -Dotel.javaagent.extensions=/shared-vol/digma-ext.jar -Dotel.exporter.otlp.traces.endpoint=http://meloona-digma-collector-api.meloona.svc.cluster.local:5050 -Dotel.traces.exporter=otlp -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.exporter.otlp.protocol=grpc -Dotel.instrumentation.common.experimental.controller.telemetry.enabled=true -Dotel.instrumentation.common.experimental.view.telemetry.enabled=true -Dotel.instrumentation.experimental.span-suppression-strategy=none -Dotel.service.name=spring-petclinic
        - name: OTEL_RESOURCE_ATTRIBUTES
          value: digma.environment=PETCLINIC

        volumeMounts:
        - name: shared
          mountPath: /shared-vol

      initContainers:
      - name: java-agent-initializer
        image: digmaai/java-agent-initializer:latest
        volumeMounts:
        - name: shared
          mountPath: /shared-vol

      volumes:
      - name: shared
        emptyDir: {}
#--------------------------------------------- 
---

apiVersion: v1
kind: Service
metadata:
  name: petclinic
spec:
  selector:
    app: pet-clinic-app
  ports:
  - port: 8080
    protocol: TCP
Kustomize
Kustimize
helper
here
Environment
environment page
patch