# SUSE Observability Traces應用與注意事項 stackstate為SUSE收購之公司,後續改名為SUSE Observability,屬於SUSE觀測應用服務。 traces服務相容於SUSE Obserbability,使用上需要先安裝open telemetry。 ## 1. 下載 task 工具 下載binary版本即可。 ```shell= wget https://github.com/go-task/task/releases/download/v3.41.0/task_linux_amd64.tar.gz tar -zxvf task_linux_amd64.tar.gz cp task /usr/local/bin/ ``` ## 2. 下載stackstate使用的sample。 ```shell= git clone https://github.com/ravan/observability-hands-on ``` 先建立.env檔,此檔案請存放於observability-hands-on資料夾中。 重點在於以下兩個參數,主要是確認kubeconfig位置與檔案,在此使用常規的位置。 KUBECONFIG_FILE_PATH=/root/.kube KUBECONFIG_FILE_NAME=config ```shell= #STS_URL=https://obs1.example.com/receiver/stsAgent #STS_API_KEY=A0euZwK3fDee27mg4IAd2CfBw9qI4X9m # STS_TOKEN= #STS_OTLP=otel-xxx-lab.app.stackstate.io #STS_CONTEXT=name of cli context to connecto to STS_URL LOCAL_CLUSTER=false CLUSTER_NAME=democluster # In the local cluster, where is the local otel collector available at #CLUSTER_OTLP_HTTP_ENDPOINT=opentelemetry-collector.open-telemetry.svc.cluster.local:4318 CLUSTER_OTLP_HTTP_ENDPOINT=otlp-stackstate.example.com:4318 # When LOCAL_CLUSTER is false, specify the kubeconfig to use: KUBECONFIG_FILE_PATH=/root/.kube KUBECONFIG_FILE_NAME=config # helm add stackstate-addons https://ravan.github.io/helm-charts/ HELM_REPO=stackstate-addons ``` sample存放在observability-hands-on/charts中,需要進入特定的use case中進行測試,例如dino-kiosk。 在開始進行測試前,請注意要修改values.yaml中的: :::warning otelHttpEndpoint: opentelemetry-collector.open-telemetry.svc.cluster.local:4318 ::: :::danger 注意!!! 這個位置不是直接指向Observability cluster對外的ingress,是指向已經安裝opentelemetry的collector service。 ::: 例如以下資訊: ```shell= # kubectl -n open-telemetry get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE opentelemetry-collector ClusterIP 10.43.30.104 <none> 6831/UDP,14250/TCP,14268/TCP,8888/TCP,4317/TCP,4318/TCP,9411/TCP 22h ``` ## 3. 執行sample 啟動sample ```shell= # ~/observability-hands-on/charts/dino-kiosk # task labs:dino-kiosk:setup ``` 模擬錯誤 ```shell= # ~/observability-hands-on/charts/dino-kiosk # task labs:dino-kiosk:trigger ``` 清除sample ```shell= # ~/observability-hands-on/charts/dino-kiosk # task labs:dino-kiosk:teardown ``` 設定正常的話,在traces裡面就會看到非常多資訊了。 ![截圖 2025-03-06 10.16.46](https://hackmd.io/_uploads/HJ29BkOsyx.png) ![截圖 2025-03-06 10.18.23](https://hackmd.io/_uploads/B14oHJuoyx.png) ## 4. 參考資料: [1. 安裝open telemetry](https://hackmd.io/YStO-rfRQU-H_V48u0VDsg?view#6-%E5%AE%89%E8%A3%9Dcollector) [2. task工具](https://taskfile.dev/installation/#binary) [3. sample來源](https://github.com/ravan/observability-hands-on/blob/main/README.md)