Skip to content

Commit

Permalink
[patch] ✨ Add Stackdriver Monitoring, Tracing and Profiler support (#479
Browse files Browse the repository at this point in the history
)

* ✨ Add Stackdriver metrics and traces

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* 💚 Fix detecting internal config changes workflow

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

💚 Fix detecting internal changes

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ✨ Add Stackdriver Profiler support

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ♻️ Refactor observability packages

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ✅ fix tests

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* 🐛 Fix initialize

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ✨ Add google API client options

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* 🔥 remove serviceAccountFile option and revise functions

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* 🔧 version labels can be configured

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* 🎨 fix format of version labels

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ♻️ use exporter & profiler interface as embed interface

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>

* ♻️ stop all exporters & profilers if initialize failed

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
  • Loading branch information
rinx authored Jun 18, 2020
1 parent 1038c46 commit 42577f9
Show file tree
Hide file tree
Showing 28 changed files with 5,974 additions and 321 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/detect-internal-config-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ jobs:
steps:
- name: Warn
run: |
curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST \
--data "{\"body\": \"**[WARNING]** Changes in \`interal/config\` may require you to change Helm charts. Please check.\"}" \
${API_URL}
PR_COMMENTS=`curl ${API_URL}?per_page=10000`
BODY=`echo -E $PR_COMMENTS | jq 'last(.[] | select(.user.login == "vdaas-ci") | select(.body | test("^\\\\*\\\\*\\\\[WARNING:INTCFG")) | .body)' -r`
if [ "$BODY" = "null" ]; then
curl --include --verbose --fail \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
--request POST \
--data "{\"body\": \"**[WARNING:INTCFG]** Changes in \`interal/config\` may require you to change Helm charts. Please check.\"}" \
${API_URL}
fi
env:
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
API_URL: ${{ github.event.pull_request.comments_url }}
PR_USER: ${{ github.event.pull_request.user.login }}
PR_NUM: ${{ github.event.issue.number }}
115 changes: 102 additions & 13 deletions charts/vald/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,15 @@ tls:
gRPC client configuration
*/}}
{{- define "vald.grpc.client" -}}
addrs: {{ default .default.addrs .Values.addrs }}
{{- if .Values.addrs }}
addrs:
{{- toYaml .Values.addrs | nindent 2 }}
{{- else if .default.addrs }}
addrs:
{{- toYaml .default.addrs | nindent 2 }}
{{- else }}
addrs: []
{{- end }}
health_check_duration: {{ default .default.health_check_duration .Values.health_check_duration | quote }}
connection_pool:
{{- if .Values.connection_pool }}
Expand Down Expand Up @@ -549,10 +557,19 @@ collector:
duration: {{ default .default.collector.duration .Values.collector.duration }}
metrics:
{{- if .Values.collector.metrics }}
enable_version_info: {{ default .default.collector.metrics.enable_version_info .Values.collector.metrics.enable_version_info }}
enable_memory: {{ default .default.collector.metrics.enable_memory .Values.collector.metrics.enable_memory }}
enable_goroutine: {{ default .default.collector.metrics.enable_goroutine .Values.collector.metrics.enable_goroutine }}
enable_cgo: {{ default .default.collector.metrics.enable_cgo .Values.collector.metrics.enable_cgo }}
enable_version_info: {{ default .default.collector.metrics.enable_version_info .Values.collector.metrics.enable_version_info }}
{{- if .Values.collector.metrics.version_info_labels }}
version_info_labels:
{{- toYaml .Values.collector.metrics.version_info_labels | nindent 6 }}
{{- else if .default.collector.metrics.version_info_labels }}
version_info_labels:
{{- toYaml .default.collector.metrics.version_info_labels | nindent 6 }}
{{- else }}
version_info_labels: []
{{- end }}
enable_memory: {{ default .default.collector.metrics.enable_memory .Values.collector.metrics.enable_memory }}
enable_goroutine: {{ default .default.collector.metrics.enable_goroutine .Values.collector.metrics.enable_goroutine }}
enable_cgo: {{ default .default.collector.metrics.enable_cgo .Values.collector.metrics.enable_cgo }}
{{- else }}
{{- toYaml .default.collector.metrics | nindent 4 }}
{{- end }}
Expand All @@ -568,22 +585,94 @@ trace:
{{- end }}
prometheus:
{{- if .Values.prometheus }}
enabled: {{ default .default.prometheus.enabled .Values.prometheus.enabled }}
enabled: {{ default .default.prometheus.enabled .Values.prometheus.enabled }}
{{- else }}
{{- toYaml .default.prometheus | nindent 2 }}
{{- end }}
jaeger:
{{- if .Values.jaeger }}
enabled: {{ default .default.jaeger.enabled .Values.jaeger.enabled }}
collector_endpoint: {{ default .default.jaeger.collector_endpoint .Values.jaeger.collector_endpoint | quote }}
agent_endpoint: {{ default .default.jaeger.agent_endpoint .Values.jaeger.agent_endpoint | quote }}
username: {{ default .default.jaeger.username .Values.jaeger.username | quote }}
password: {{ default .default.jaeger.password .Values.jaeger.password | quote }}
service_name: {{ default .default.jaeger.service_name .Values.jaeger.service_name | quote }}
buffer_max_count: {{ default .default.jaeger.buffer_max_count .Values.jaeger.buffer_max_count }}
enabled: {{ default .default.jaeger.enabled .Values.jaeger.enabled }}
collector_endpoint: {{ default .default.jaeger.collector_endpoint .Values.jaeger.collector_endpoint | quote }}
agent_endpoint: {{ default .default.jaeger.agent_endpoint .Values.jaeger.agent_endpoint | quote }}
username: {{ default .default.jaeger.username .Values.jaeger.username | quote }}
password: {{ default .default.jaeger.password .Values.jaeger.password | quote }}
service_name: {{ default .default.jaeger.service_name .Values.jaeger.service_name | quote }}
buffer_max_count: {{ default .default.jaeger.buffer_max_count .Values.jaeger.buffer_max_count }}
{{- else }}
{{- toYaml .default.jaeger | nindent 2 }}
{{- end }}
stackdriver:
{{- if .Values.stackdriver }}
project_id: {{ default .default.stackdriver.project_id .Values.stackdriver.project_id | quote }}
client:
{{- if .Values.stackdriver.client }}
api_key: {{ default .default.stackdriver.client.api_key .Values.stackdriver.client.api_key | quote }}
{{- if .Values.stackdriver.client.audiences }}
audiences:
{{- toYaml .Values.stackdriver.client.audiences | nindent 6 }}
{{- else if .default.stackdriver.client.audiences }}
audiences:
{{- toYaml .default.stackdriver.client.audiences | nindent 6 }}
{{- else }}
audiences: []
{{- end }}
credentials_file: {{ default .default.stackdriver.client.credentials_file .Values.stackdriver.client.credentials_file | quote }}
credentials_json: {{ default .default.stackdriver.client.credentials_json .Values.stackdriver.client.credentials_json | quote }}
endpoint: {{ default .default.stackdriver.client.endpoint .Values.stackdriver.client.endpoint | quote }}
quota_project: {{ default .default.stackdriver.client.quota_project .Values.stackdriver.client.quota_project | quote }}
request_reason: {{ default .default.stackdriver.client.request_reason .Values.stackdriver.client.request_reason | quote }}
{{- if .Values.stackdriver.client.scopes }}
scopes:
{{- toYaml .Values.stackdriver.client.scopes | nindent 6 }}
{{- else if .default.stackdriver.client.scopes }}
scopes:
{{- toYaml .default.stackdriver.client.scopes | nindent 6 }}
{{- else }}
scopes: []
{{- end }}
user_agent: {{ default .default.stackdriver.client.user_agent .Values.stackdriver.client.user_agent | quote }}
telemetry_enabled: {{ default .default.stackdriver.client.telemetry_enabled .Values.stackdriver.client.telemetry_enabled }}
authentication_enabled: {{ default .default.stackdriver.client.authentication_enabled .Values.stackdriver.client.authentication_enabled }}
{{- else }}
{{- toYaml .default.stackdriver.client | nindent 4 }}
{{- end }}
exporter:
{{- if .Values.stackdriver.exporter }}
monitoring_enabled: {{ default .default.stackdriver.exporter.monitoring_enabled .Values.stackdriver.exporter.monitoring_enabled }}
tracing_enabled: {{ default .default.stackdriver.exporter.tracing_enabled .Values.stackdriver.exporter.tracing_enabled }}
location: {{ default .default.stackdriver.exporter.location .Values.stackdriver.exporter.location | quote }}
bundle_delay_threshold: {{ default .default.stackdriver.exporter.bundle_delay_threshold .Values.stackdriver.exporter.bundle_delay_threshold | quote }}
bundle_count_threshold: {{ default .default.stackdriver.exporter.bundle_count_threshold .Values.stackdriver.exporter.bundle_count_threshold }}
trace_spans_buffer_max_bytes: {{ default .default.stackdriver.exporter.trace_spans_buffer_max_bytes .Values.stackdriver.exporter.trace_spans_buffer_max_bytes }}
metric_prefix: {{ default .default.stackdriver.exporter.metric_prefix .Values.stackdriver.exporter.metric_prefix | quote }}
skip_cmd: {{ default .default.stackdriver.exporter.skip_cmd .Values.stackdriver.exporter.skip_cmd }}
timeout: {{ default .default.stackdriver.exporter.timeout .Values.stackdriver.exporter.timeout | quote }}
reporting_interval: {{ default .default.stackdriver.exporter.reporting_interval .Values.stackdriver.exporter.reporting_interval | quote }}
number_of_workers: {{ default .default.stackdriver.exporter.number_of_workers .Values.stackdriver.exporter.number_of_workers }}
{{- else }}
{{- toYaml .default.stackdriver.exporter | nindent 4 }}
{{- end }}
profiler:
{{- if .Values.stackdriver.profiler }}
enabled: {{ default .default.stackdriver.profiler.enabled .Values.stackdriver.profiler.enabled }}
service: {{ default .default.stackdriver.profiler.service .Values.stackdriver.profiler.service | quote }}
service_version: {{ default .default.stackdriver.profiler.service_version .Values.stackdriver.profiler.service_version | quote }}
debug_logging: {{ default .default.stackdriver.profiler.debug_logging .Values.stackdriver.profiler.debug_logging }}
mutex_profiling: {{ default .default.stackdriver.profiler.mutex_profiling .Values.stackdriver.profiler.mutex_profiling }}
cpu_profiling: {{ default .default.stackdriver.profiler.cpu_profiling .Values.stackdriver.profiler.cpu_profiling }}
alloc_profiling: {{ default .default.stackdriver.profiler.alloc_profiling .Values.stackdriver.profiler.alloc_profiling }}
heap_profiling: {{ default .default.stackdriver.profiler.heap_profiling .Values.stackdriver.profiler.heap_profiling }}
goroutine_profiling: {{ default .default.stackdriver.profiler.goroutine_profiling .Values.stackdriver.profiler.goroutine_profiling }}
alloc_force_gc: {{ default .default.stackdriver.profiler.alloc_force_gc .Values.stackdriver.profiler.alloc_force_gc }}
api_addr: {{ default .default.stackdriver.profiler.api_addr .Values.stackdriver.profiler.api_addr | quote }}
instance: {{ default .default.stackdriver.profiler.instance .Values.stackdriver.profiler.instance | quote }}
zone: {{ default .default.stackdriver.profiler.zone .Values.stackdriver.profiler.zone | quote }}
{{- else }}
{{- toYaml .default.stackdriver.profiler | nindent 4 }}
{{- end }}
{{- else }}
{{- toYaml .default.stackdriver | nindent 2 }}
{{- end }}
{{- end -}}

{{/*
Expand Down
Loading

0 comments on commit 42577f9

Please sign in to comment.