digma-ai / digma-ui

MIT License
3 stars 1 forks source link

Update troubleshooting documentation #615

Closed doppleware closed 9 months ago

doppleware commented 9 months ago

Please update the documentation in 'troubleshooting'

Terminal

Terminal/Spring Boot + Maven:

<profile>
  <id>digma</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <jvmArguments>-javaagent:${env.TMPDIR}/temp-digma-otel-jars/opentelemetry-javaagent.jar</jvmArguments>
          <systemPropertyVariables>
            <otel.exporter.otlp.traces.endpoint>http://localhost:5050</otel.exporter.otlp.traces.endpoint>
            <otel.traces.exporter>otlp</otel.traces.exporter>
            <otel.metrics.exporter>none</otel.metrics.exporter>
            <otel.logs.exporter>none</otel.metrics.exporter>
            <otel.service.name>${pom.artifactId}</otel.service.name>
             <otel.exporter.otlp.protocol>grpc</<otel.exporter.otlp.protocol>>
            <otel.javaagent.extensions>${env.TMPDIR}/temp-digma-otel-jars/digma-otel-agent-extension.jar</otel.javaagent.extensions>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>

Spring boot/gradle:

tasks.named("bootRun") {
  if (project.hasProperty('digma')) {
    def tempDir = System.getProperty("java.io.tmpdir")
    environment["JAVA_TOOL_OPTIONS"] = "-javaagent:${tempDir}/temp-digma-otel-jars/opentelemetry-javaagent.jar"
    systemProperty 'otel.exporter.otlp.traces.endpoint', 'http://localhost:5050'
    systemProperty 'otel.traces.exporter', 'otlp'
    systemProperty 'otel.metrics.exporter', 'none'
    systemProperty 'otel.logs.exporter', 'none'
    systemProperty 'otel.exporter.otlp.protocol', 'grpc'
    systemProperty 'otel.service.name', "${project.name}"
    systemProperty 'otel.javaagent.extensions', "${tempDir}/temp-digma-otel-jars/digma-otel-agent-extension.jar"
  }
}

Spring boot/gradle.kts:

tasks.named<BootRun>("bootRun") {
  if (project.hasProperty("digma")) {
    val tempDir = System.getProperty("java.io.tmpdir")
    environment["JAVA_TOOL_OPTIONS"] = "-javaagent:${tempDir}/temp-digma-otel-jars/opentelemetry-javaagent.jar"
    systemProperty("otel.exporter.otlp.traces.endpoint", "http://localhost:5050")
    systemProperty("otel.traces.exporter", "otlp")
    systemProperty("otel.metrics.exporter", "none")
    systemProperty("otel.logs.exporter", "none")
    systemProperty("otel.exporter.otlp.protocol", "grpc")
    systemProperty("otel.service.name", project.name)
    systemProperty("otel.javaagent.extensions", "${tempDir}/temp-digma-otel-jars/digma-otel-agent-extension.jar")
  }
}

Terminal/application

curl --create-dirs -O -L --output-dir ./otel https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/opentelemetry-javaagent.jar

curl --create-dirs -O -L --output-dir ./otel https://github.com/digma-ai/otel-java-instrumentation/releases/latest/download/digma-otel-agent-extension.jar

export JAVA_TOOL_OPTIONS="-javaagent:/otel/javaagent.jar -Dotel.exporter.otlp.endpoint=http://localhost:5050 -Dotel.javaagent.extensions=/otel/digma-otel-agent-extension.jar -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.exporter.otlp.protocol=grpc"
export OTEL_SERVICE_NAME={--ENTER YOUR SERVICE NAME HERE--}
export OTEL_RESOURCE_ATTRIBUTES=digma.environment=LOCAL

java app.jar

Docker

Download the agent:

curl --create-dirs -O -L --output-dir ./otel https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v2.1.0/opentelemetry-javaagent.jar

curl --create-dirs -O -L --output-dir ./otel https://github.com/digma-ai/otel-java-instrumentation/releases/latest/download/digma-otel-agent-extension.jar

Add a docker compose override file

 #docker-compose.override.otel.yml
  version: '3'

  services:
  #[your-service]:
    volumes:
      - "./otel/opentelemetry-javaagent.jar:/otel/opentelemetry-javaagent.jar"
      - "./otel/digma-otel-agent-extension.jar:/otel/digma-otel-agent-extension.jar"
    environment:
      - JAVA_TOOL_OPTIONS=-javaagent:/otel/opentelemetry-javaagent.jar -Dotel.exporter.otlp.endpoint=http://host.docker.internal:5050 -Dotel.javaagent.extensions=/otel/digma-otel-agent-extension.jar -Dotel.metrics.exporter=none -Dotel.logs.exporter=none -Dotel.exporter.otlp.protocol=grpc
      - OTEL_SERVICE_NAME=#[your-service]
      - OTEL_RESOURCE_ATTRIBUTES=digma.environment=DOCKER_LOCAL
      - OTEL_METRICS_EXPORTER=none
    extra_hosts:
        - "host.docker.internal:host-gateway"
kshmidt-digma commented 9 months ago

Closed in https://github.com/digma-ai/digma-ui/pull/626