AdSense

網頁

2024/3/31

2024/3/30

今日風情 20240330

2024年3月30日星期六。

2024/3/27

Git cherry-pick 特定檔案

Git cherry pick特定檔案方式如下。

Jenkins Pipeline checkout/clone GitLab repo

Jenkins Pipeline將GitLab repo程式碼抓取下來的設定方式如下。

Jenkins 2.4 Node Monitors設定位置

Jenkins 2.4的Node Monitors設定位置在Dashboard > Manage Jenkins > Nodes > Configure Node Monitors

2024/3/26

Jenkins Pipeline工作無法執行 Disk space is below threshold

Jenkins裝好後無法執行pipeline工作(即使是簡單的hello world pipeline)。點擊pipeline的[Build Now],只顯示"Build scheduled",但[Build History]沒有出現任何運行紀錄。

2024/3/25

AWS EC2 Linux AMI 安裝Jenkins

AWS EC2 Amazon Linux 2023 AMI安裝Jenkins。

Mac 安裝java openjdk@21 by Homebrew

Mac使用Homebrew安裝Java OpenJDK 21 (Formulea openjdk@21)的方式如下。

2024/3/24

Golang struct slice排序

Go對包含struct元素的slice的排序方式如下。

今日風情 20240324

2024年3月24日星期日。

2024/3/23

2024/3/20

Golang Gin BindJSON ShoudBindJSON 差別

Gin可用gin.Context.BindJSONgin.Context.ShouldBindJSON將請求payload轉為struct,兩者差別如下。

Golang WaitGroup用法

Go的sync.WaitGroup可用來等待所有的goroutine都執行結束。

Golang 併發處理訊息練習

Go使用goroutine搭配channel併發處理大量訊息練習。

2024/3/18

Golang 避免index out of range錯誤

Go以index(索引)從slice取值時,避免panic: runtime error: index out of range [x] with length [y]錯誤。

Golang Swag 查詢字串參數範例 @Param example

Go swagger API文件的查詢字串(query string)參數值的範例設定方式如下。

Golang 取得GCP Monitoring Instance Disk寫入大小統計

Go以Google Cloud Client Libraries for Go來取得GCP Monitoring的instance [Disk write bytes]指標的時間序列資料。

2024/3/16

2024/3/10

Prometheus PromQL資料類型

Prometheus的PromQL語言的敘述結果分為以下資料類型。

GCP Monitoring Metric名稱與PromQL對照

由於PromQL語法只支援:_特殊字元,因此GCP Monitoring Metric(指標)名稱,例如compute.googleapis.com/instance/cpu/utilization中的./必須進行替換以便在PromQL中使用。

Prometheus PromQL是什麼?

PromQL全名為Prometheus Query Language,是由Prometheus發展的查詢語言。

2024/3/9

2024/3/8

英文 Artifact 翻譯

Artifacts字典解釋為「手工藝品」、「製品」、「人造物品」、「加工品」等。

Golang 取得GCP Monitoring Metric time series data

Go以Google Cloud Client Libraries for Go來取得GCP Cloud Monitoring的metric time series data

Golang 取得GCP Monitoring Metric descriptor

Go以Google Cloud Client Libraries for Go來取得GCP Cloud Monitoring的metric descriptor。

2024/3/7

GCP Monitoring Metric type

GCP Monitoring的metric type用來描述一個指標,包括指標名稱、測量的資源、類型、對象、資料型態、取樣間隔等;例如instance的CPU使用率、磁碟讀取bytes大小皆是一種metric type。

GCP Monitoring Metric kind種類

GCP Cloud Monitoring的metric測量值(time series)中都會包含MetricKind(指標類型),用來說明測量值的衡量方式,分為以下三種:

Golang 建立GCP Monitoring Metric Client

Go以Google Cloud Client Libraries for Go來建立存取GCP Cloud Monitoring API的Monitoring Metric Client。

GCP Cloud Monitoring metric model簡介

GCP Cloud Monitoring的metric model(指標模型)用來定義要收集哪些測量資料,由以下三個部分組成:

2024/3/5

AWS CLI 取得CloudWatch metrics統計資料

使用AWS CLI取得CloudWatch metrics統計資料。

AWS CLI修改目前設定的Region

修改AWS CLI目前設定的region的方式如下。

AWS CloudWatch Dashboard新增widget

在AWS CloudWatch的dashboard新增widget。

Golang 建立CloudWatch Dashboard

Go以Google API Client Libraries來建立CloudWatch dashboard。

AWS CloudWatch 建立Dashboard

AWS建立CloudWatch dashboard。

2024/3/3

Golang map與struct轉換

Go map與struct轉換的方法如下。

今日風情 20240303

2024年3月3日星期日。

2024/3/2

今日風情 20240302

2024年3月2日星期六。

AdSense