Skip to content

Commit

Permalink
Add hierarchy relations auto-matching for MYSQL/POSTGRESQL/SO11Y_OAP/…
Browse files Browse the repository at this point in the history
…VIRTUAL_DATABASE (#159)
  • Loading branch information
wankai123 authored Jan 25, 2024
1 parent 1aa56b2 commit 22491ac
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ ES_IMAGE ?= docker.elastic.co/elasticsearch/elasticsearch-oss
ES_IMAGE_TAG ?= 7.10.2

SW_OAP_IMAGE ?= ghcr.io/apache/skywalking/oap
SW_OAP_IMAGE_TAG ?= cc79bf688cd6e3faf091be9103f8254fbec0befe
SW_OAP_IMAGE_TAG ?= df3b0960914ae2cad43f96b110833032d0ff7109

SW_UI_IMAGE ?= ghcr.io/apache/skywalking/ui
SW_UI_IMAGE_TAG ?= cc79bf688cd6e3faf091be9103f8254fbec0befe
SW_UI_IMAGE_TAG ?= df3b0960914ae2cad43f96b110833032d0ff7109

SW_CLI_IMAGE ?= ghcr.io/apache/skywalking-cli/skywalking-cli:0883266bfaa36612927b69e35781b64ea181758d
SW_EVENT_EXPORTER_IMAGE ?= ghcr.io/apache/skywalking-kubernetes-event-exporter/skywalking-kubernetes-event-exporter:8a012a3f968cb139f817189afb9b3748841bba22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ spec:
value: tcp://activemq:61616
- name: ACTIVE_MQ_QUEUE
value: queue-songs-ping

{{- if .Values.features.postgresqlMonitor.enabled }}
- name: DATA_SOURCE_URL
value: jdbc:postgresql://psql.{{ .Release.Namespace }}.svc.cluster.local:5432/postgres
- name: DATA_SOURCE_USER
value: postgres
- name: DATA_SOURCE_PASSWORD
value: password
{{- end }}
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -510,4 +517,4 @@ spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
targetPort: 80
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
- source_labels: [ __meta_kubernetes_pod_container_name, __meta_kubernetes_pod_container_port_name ]
action: keep
regex: mysqld-exporter;metrics # @feature: mysql; reference the name of the metrics port
- source_labels: [ __meta_kubernetes_pod_name ]
- source_labels: [ ]
target_label: host_name
replacement: mysql.{{ .Release.Namespace }}
- source_labels: [ __meta_kubernetes_pod_name ]
target_label: service_instance_id
regex: (.+)
replacement: $$1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
- source_labels: [ __meta_kubernetes_pod_container_name, __meta_kubernetes_pod_container_port_name ]
action: keep
regex: psql-exporter;metrics # @feature: postgresql; reference the name of the metrics port
- source_labels: [ __meta_kubernetes_pod_name ]
- source_labels: [ ]
target_label: host_name
replacement: psql.{{ .Release.Namespace }}
- source_labels: [ __meta_kubernetes_pod_name ]
target_label: service_instance_id
regex: (.+)
replacement: $$1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
regex: oap;metrics # @feature: so11y; reference the name of the metrics port
- source_labels: [ ]
target_label: service
replacement: oap-server
replacement: {{ include "skywalking.oap.fullname" .Subcharts.skywalking }}.{{ .Release.Namespace }}
- source_labels: [ __meta_kubernetes_pod_name ]
target_label: host_name
regex: (.+)
Expand Down
1 change: 1 addition & 0 deletions services/songs-service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
implementation 'org.apache.skywalking:apm-toolkit-logback-1.x:8.11.0'
implementation 'org.apache.skywalking:apm-toolkit-micrometer-registry:8.11.0'
implementation 'com.google.guava:guava:23.0'
Expand Down
11 changes: 11 additions & 0 deletions services/songs-service/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,16 @@ server:
address: 0.0.0.0

spring:
sql:
init:
data-locations: classpath:data.sql
mode: always
datasource:
url: ${DATA_SOURCE_URL:jdbc:h2:mem:mem-db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=FALSE}
username: ${DATA_SOURCE_USER:}
password: ${DATA_SOURCE_PASSWORD:}
jpa:
defer-datasource-initialization: true
hibernate:
ddl-auto: create

0 comments on commit 22491ac

Please sign in to comment.