Advanced Search
Search Results
240 total results found
omitempty
默认行为 在使用 protoc 3 时,默认会为所有标量字段(包括字符串)添加 omitempty 标签。这是 protobuf 3 的一个默认行为。要解决这个问题,有几种方式: gogoproto 例子1 Inputmessage Config { int64 id = 1; string name = 2 [(gogoproto.jsontag) = "name"]; string desc = 3 [(gogoproto.jsontag) = "desc"]; Role role = 5 ...
Batch Send With Timeout
idleDuration := 10 * time.Second idleDelay := time.NewTimer(idleDuration) for { idleDelay.Reset(idleDuration) msgQueue := make([]model.MinIOEvent, 0, BatchSize) var needToSend bool for !needToSend { select { case msg := <-k.ms...
GORM Update
会忽略零值字段(默认值) type User struct { Name string Age int } db.Model(&user).Updates(User{Name: "Tom", Age: 0}) 这条语句中,Age: 0 会被忽略,因为 GORM 默认只更新非零值字段。 Solutions Model.Update(column, value) db.Model(&user).Update("age", 0) // 会把 age 更新为 0 使用 Map db.Model(&user...
Quick Start
Installation https://getcomposer.org/download/ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e55...
Benchmark
ENV Ubuntu 22.04 2C2G/4C8G Response {"code":0,"message":"\u83b7\u53d6\u6210\u529f","data":{"total":10,"list":[{"id":1,"name":"\u6d4b\u8bd5\u7528\u62371","email":"test1@example.com","isVerified":true,"verifiedAt":"2025-04-08T09:22:52.000000Z","createdAt":"2...
Quick Start
Installation composer global require laravel/installer Errors Change Source. composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ New Project laravel new example-app php artisan migrate
Virtual Environment
pyenv Installation brewn install pyenv echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc Usage List versions pyenv insta...
Logs Schema
Version 0.113.0 otel_logs CREATE TABLE otel_logs ( `Timestamp` DateTime64(9) CODEC(Delta(8), ZSTD(1)), `TimestampTime` DateTime DEFAULT toDateTime(Timestamp), `TraceId` String CODEC(ZSTD(1)), `SpanId` String CODEC(ZSTD(1)), `TraceFlags` ...
BookStack Rocks
The blog has finally migrated from VitePress to BookStack. During the migration, many modifications were made by Cursor, costing $0.08 per session 💰. VitePress Style The Markdown rendering style is basically consistent with the VitePress style. New List View...
settings.json
Preferences: Open user settings inlayHints Remove value: field hint. "editor.inlayHints.enabled": false, References https://stackoverflow.com/questions/71873489/disable-field-name-description-in-vscode
Applications
在 Kubernetes 中,如果你想通过 Prometheus 获取 部署的应用信息(比如 Deployment、StatefulSet、Service 等),通常使用 kube-state-metrics 提供的以下指标。它会将 Kubernetes 对象的状态以指标暴露出来。 Service 相关指标(服务) kube_service_info 描述:K8s 中每个 Service 的基本信息 常用 label: exported_namespace(服务所在命名空间) exported_service...
Quick Start
https://koderover.com/tutorials-detail/codelabs/t100/index.html#0 Installation Version 3.4.0 Resources: 2C/4G Add Repo helm repo add koderover-chart https://koderover.tencentcloudcr.com/chartrepo/chart helm repo update Get Node IP Get K8s node ip first. k...
Commands
Get Version minikube version List Cluster * is the current cluster. minikube profile list | Profile | Status | Minikube Version | ... |------------|-----------|------------------| | *minikube | Running | v1.33.1 | | mycluster | Stopped ...
Commands
List Remote git remote -v Set Remote git remote set-url origin git@github.com:user/repo.git
Metrics Server
Enable minikube addons enable metrics-server Errors Error from server (ServiceUnavailable): the server is currently unable to handle the request (get nodes.metrics.k8s.io) Check pod status. kubectl -n kube-system get pods | grep metrics-server metrics-serv...
Commands
Topic Consumer Group & Lag Use akw 'NR==2 || /topic-name/' to get header row. kafka-consumer-groups.sh --bootstrap-server localhost:9092 --all-groups --describe | awk 'NR==2 || /topic-name/' GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSU...
Communication Errors
Background ✅ MySQL can connect from its own pod. ❌ MySQL can't connect by K8s service. Service endpoint is right. getent inside pod, sometimes failed Pod network issue(Calico CNI). Errors JDBC Errorscom.mysql.cj.jdbc.exceptions.CommunicationsException: C...
Delete WAL For Launch
Sometimes readness probe will be timeout because of the large wal logs. If the data is not important, just delete it. kubectl exec -it xxx -- /bin/sh rm -rf /prometheus/wal/ kubectl rollout restart deploy/sts xxx
Container Advisor
The following metrics needs cAdvisor job. container_cpu_usage_seconds_total container_network_receive_bytes_total container_network_transmit_bytes_total ... kubectl edit cm prometheus-configmap config map- job_name: 'kubelet' scheme: https metrics_path:...
Tailscale iptables with Aliyun DNS
Troubleshooting resolvectl status Global Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported resolv.conf mode: foreign DNS Domain: tail2fb681.ts.net Link 2 (eth0) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNS...