|
| 1 | +--- |
| 2 | +title: Configure Applications for SigNoz |
| 3 | +sidebar_position: 5 |
| 4 | +--- |
| 5 | +## Configure applications for SigNoz Observability |
| 6 | + |
| 7 | +In order for SigNoz to be able to collect logs, metrics and traces from applications, some configurations are required to be added. |
| 8 | + |
| 9 | +### Configure OpenTelemetry and Micrometer |
| 10 | + |
| 11 | +[OpenTelemetry zero-code instrumentation](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/getting-started/) enables adding observability to Spring Boot based applications without changing any code. Similarly [Micrometer](https://docs.micrometer.io/micrometer/reference/observation/projects.html) enables instrumentation of JVM based applications and can be configured using Spring Boot starters. |
| 12 | + |
| 13 | +:::note |
| 14 | +The versions in the below pom.xml might be outdated. |
| 15 | +::: |
| 16 | + |
| 17 | +```xml |
| 18 | +<dependencies> |
| 19 | + <dependency> |
| 20 | + <groupId>io.micrometer</groupId> |
| 21 | + <artifactId>micrometer-core</artifactId> |
| 22 | + </dependency> |
| 23 | + <dependency> |
| 24 | + <groupId>io.micrometer</groupId> |
| 25 | + <artifactId>micrometer-registry-prometheus</artifactId> |
| 26 | + </dependency> |
| 27 | + <dependency> |
| 28 | + <groupId>io.micrometer</groupId> |
| 29 | + <artifactId>micrometer-tracing-bridge-otel</artifactId> |
| 30 | + <exclusions> |
| 31 | + <exclusion> |
| 32 | + <groupId>io.opentelemetry.instrumentation</groupId> |
| 33 | + <artifactId>opentelemetry-instrumentation-api-incubator</artifactId> |
| 34 | + </exclusion> |
| 35 | + </exclusions> |
| 36 | + </dependency> |
| 37 | + <dependency> |
| 38 | + <groupId>io.opentelemetry</groupId> |
| 39 | + <artifactId>opentelemetry-exporter-otlp</artifactId> |
| 40 | + </dependency> |
| 41 | + <dependency> |
| 42 | + <groupId>io.micrometer</groupId> |
| 43 | + <artifactId>micrometer-tracing</artifactId> |
| 44 | + </dependency> |
| 45 | + <dependency> |
| 46 | + <groupId>io.opentelemetry.instrumentation</groupId> |
| 47 | + <artifactId>opentelemetry-spring-boot-starter</artifactId> |
| 48 | + </dependency> |
| 49 | + <dependency> |
| 50 | + <groupId>net.ttddyy.observation</groupId> |
| 51 | + <artifactId>datasource-micrometer-spring-boot</artifactId> |
| 52 | + </dependency> |
| 53 | + <dependency> |
| 54 | + <groupId>com.oracle.database.spring</groupId> |
| 55 | + <artifactId>oracle-spring-boot-starter-ucp</artifactId> |
| 56 | + <type>pom</type> |
| 57 | + </dependency> |
| 58 | + <dependency> |
| 59 | + <groupId>io.opentelemetry.instrumentation</groupId> |
| 60 | + <artifactId>opentelemetry-oracle-ucp-11.2</artifactId> |
| 61 | + </dependency> |
| 62 | +</dependencies> |
| 63 | + |
| 64 | +<dependencyManagement> |
| 65 | + <dependencies> |
| 66 | + <dependency> |
| 67 | + <groupId>io.opentelemetry.instrumentation</groupId> |
| 68 | + <artifactId>opentelemetry-instrumentation-bom</artifactId> |
| 69 | + <type>pom</type> |
| 70 | + <scope>import</scope> |
| 71 | + </dependency> |
| 72 | + <dependency> |
| 73 | + <groupId>io.micrometer</groupId> |
| 74 | + <artifactId>micrometer-tracing-bom</artifactId> |
| 75 | + <version>${micrometer-tracing.version}</version> |
| 76 | + <type>pom</type> |
| 77 | + <scope>import</scope> |
| 78 | + </dependency> |
| 79 | + </dependencies> |
| 80 | +</dependencyManagement> |
| 81 | +``` |
| 82 | + |
| 83 | +### Configure Datasource Observability |
| 84 | + |
| 85 | +[datasource-micrometer](https://github.com/jdbc-observations/datasource-micrometer) and [Oracle Universal Connection Pool Instrumentation](https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/oracle-ucp-11.2) can be configured to enable observability for Database connections and queries. |
| 86 | + |
| 87 | +:::note |
| 88 | +The versions in the below pom.xml might be outdated. |
| 89 | +::: |
| 90 | + |
| 91 | +```xml |
| 92 | +<dependencies> |
| 93 | + <dependency> |
| 94 | + <groupId>net.ttddyy.observation</groupId> |
| 95 | + <artifactId>datasource-micrometer-spring-boot</artifactId> |
| 96 | + </dependency> |
| 97 | + <dependency> |
| 98 | + <groupId>io.opentelemetry.instrumentation</groupId> |
| 99 | + <artifactId>opentelemetry-oracle-ucp-11.2</artifactId> |
| 100 | + </dependency> |
| 101 | +</dependencies> |
| 102 | +``` |
| 103 | + |
| 104 | +### Configure Spring Boot Actuator |
| 105 | + |
| 106 | +When you deploy an application with Oracle Backend for Microservices and AI CLI or Visual Code Extension, provided you included the Spring Actuator in your application, SigNoz will automatically find your application (using the annotations) and start collecting metrics. These metrics will be included in both the Spring Boot Observability dashboard and the Spring Boot Statistic dashboard automatically. |
| 107 | + |
| 108 | +To include the Actuator in your application, add the following dependencies to your Maven POM or equivalent: |
| 109 | + |
| 110 | +```xml |
| 111 | +<dependency> |
| 112 | + <groupId>org.springframework.boot</groupId> |
| 113 | + <artifactId>spring-boot-starter-actuator</artifactId> |
| 114 | +</dependency> |
| 115 | +``` |
| 116 | + |
| 117 | +You must also add the configuration similar to one given below, after customizing it for your application, to your Spring `application.yaml` |
| 118 | + |
| 119 | +```yaml |
| 120 | +spring: |
| 121 | + threads: |
| 122 | + virtual: |
| 123 | + enabled: true |
| 124 | + jpa: |
| 125 | + hibernate: |
| 126 | + ddl-auto: validate |
| 127 | + properties: |
| 128 | + hibernate: |
| 129 | + dialect: org.hibernate.dialect.OracleDialect |
| 130 | + format_sql: true |
| 131 | + show-sql: true |
| 132 | + |
| 133 | +eureka: |
| 134 | + instance: |
| 135 | + hostname: ${spring.application.name} |
| 136 | + preferIpAddress: true |
| 137 | + client: |
| 138 | + service-url: |
| 139 | + defaultZone: ${eureka.service-url} |
| 140 | + fetch-registry: true |
| 141 | + register-with-eureka: true |
| 142 | + enabled: true |
| 143 | + |
| 144 | +management: |
| 145 | + endpoint: |
| 146 | + health: |
| 147 | + show-details: always |
| 148 | + show-components: always |
| 149 | + endpoints: |
| 150 | + web: |
| 151 | + exposure: |
| 152 | + include: "*" |
| 153 | + metrics: |
| 154 | + tags: |
| 155 | + application: ${spring.application.name} |
| 156 | + distribution: |
| 157 | + percentiles[http.server.requests]: 0.5, 0.90, 0.95, 0.99 |
| 158 | + percentiles-histogram[http.server.requests]: true |
| 159 | + slo[http.server.requests]: 100ms, 250ms, 500ms, 1s, 2s, 5s, 10s, 30s |
| 160 | + percentiles[http.client.requests]: 0.5, 0.90, 0.95, 0.99 |
| 161 | + percentiles-histogram[http.client.requests]: true |
| 162 | + slo[http.client.requests]: 100ms, 250ms, 500ms, 1s, 2s, 5s, 10s, 30s |
| 163 | + health: |
| 164 | + probes: |
| 165 | + enabled: true |
| 166 | + tracing: |
| 167 | + sampling: |
| 168 | + probability: 1.0 |
| 169 | + info: |
| 170 | + os: |
| 171 | + enabled: true |
| 172 | + env: |
| 173 | + enabled: true |
| 174 | + java: |
| 175 | + enabled: true |
| 176 | + observations: |
| 177 | + key-values: |
| 178 | + app: ${spring.application.name} |
| 179 | + |
| 180 | +logging: |
| 181 | + level: |
| 182 | + root: INFO |
| 183 | + com.example: INFO |
| 184 | + org.springframework.web.filter.AbstractRequestLoggingFilter: INFO |
| 185 | + |
| 186 | +jdbc: |
| 187 | + datasource-proxy: |
| 188 | + query: |
| 189 | + enable-logging: true |
| 190 | + log-level: INFO |
| 191 | + include-parameter-values: true |
| 192 | +``` |
| 193 | +
|
| 194 | +The Oracle Backend for Microservices and AI platform adds following annotations to your application pods for SigNoz to start scraping the actuator endpoint for metrics. |
| 195 | +
|
| 196 | +```yaml |
| 197 | +signoz.io/path: /actuator/prometheus |
| 198 | +signoz.io/port: "8080" |
| 199 | +signoz.io/scrape: "true" |
| 200 | +``` |
| 201 | +
|
| 202 | +It also adds the `OTEL_EXPORTER_OTLP_ENDPOINT` to pod environment variables for the OpenTelemetry instrumentation libraries to access the the OpenTelemtry collector of SigNoz. |
| 203 | + |
| 204 | +```yaml |
| 205 | +- name: OTEL_EXPORTER_OTLP_ENDPOINT |
| 206 | + value: http://obaas-signoz-otel-collector.observability:4318 |
| 207 | +``` |
0 commit comments