Opentelemetry Java Agent 浅度解构
· ☕ 2 åˆ†é’Ÿ
https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/contributing/javaagent-jar-components.md Conf Creating spans around methods with otel.instrumentation.methods.include Ref: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/manual-instrumentation.md Format is "java -Dotel.instrumentation.methods.include=my.package.MyClass1[method1,method2];my.package.MyClass2[method3]" Classloader [arthas@16908]$ classloader -t +-BootstrapClassLoader +-io.opentelemetry.javaagent.bootstrap.AgentClassLoader@379619aa +-sun.misc.Launcher$ExtClassLoader@41fa769c +-com.taobao.arthas.agent.ArthasClassloader@3697b340 +-sun.misc.Launcher$AppClassLoader@18b4aac2 +-java.net.URLClassLoader@71b2d611 +-java.net.URLClassLoader@69cd1085 | +-WebAppClassLoader=266661735@fe4ef67 | | +-com.mycom.sig.foundation.servicediscovery.ExtendedClassLoader@573f7aae | +-WebAppClassLoader=Server Initiated@1ccb04b3 | | +-com.mycom.sig.foundation.servicediscovery.ExtendedClassLoader@4b3b9a06 | | +-jnr.ffi.provider.jffi.AsmClassLoader@73cb9ccb | | +-jnr.ffi.provider.jffi.AsmClassLoader@7c380e94 | | +-jnr.ffi.provider.jffi.AsmClassLoader@69ec5d1f | +-WebAppClassLoader=OAuth Server@10d98940 | | +-com.mycom.ece.common.svcfinder.ExtendedClassLoader@3528968e | | +-com.mycom.sig.foundation.servicediscovery.ExtendedClassLoader@2919aff3 | | +-jnr.ffi.provider.jffi.AsmClassLoader@1b0e6bac | | +-jnr.ffi.provider.jffi.AsmClassLoader@2f12d8d1 | | +-jnr.ffi.provider.jffi.AsmClassLoader@73123f21 | +-WebAppClassLoader=1133988396@43974a2c | +-com.mycom.sig.foundation.servicediscovery.ExtendedClassLoader@39d87c5f +-java.net.URLClassLoader@1b4c457c +-java.net.URLClassLoader@3a477cf5 Affect(row-cnt:24)

K8s Custom Resources(CR)
· ☕ 2 åˆ†é’Ÿ
Custom Resource 的入口 请求是这样分发到 api 扩展点的: 例如我们有 (Custom Resource)CR 1 2 3 4 5 6 7 8 apiVersion:cnat.programming-kubernetes.info/v1alpha1kind:Atmetadata:name:example-atspec:schedule:"2019-07-03T02:00:00Z"status:phase:"pending" 相应的 CustomResourceDefinition (CRD) 会是这样: 1 2 3 4 5 6 7 8 9

K8s API 核心对象 —— client-go
· ☕ 3 åˆ†é’Ÿ
API 入口 Client Sets 接收变更通知和缓存(Informers and Caching) Client Sets可以 watch 变更,但一般我们用更高级的 Informers,因为它有缓存

Helm base
· ☕ 1 åˆ†é’Ÿ
Concept umbrella chart you can also create a chart with dependencies to other charts (a.k.a. umbrella chart) which are completely external using the requirements.yaml file. versioning Simple 1-1 versioning Chart versus application versioning 参考 https://codefresh.io/docs/docs/new-helm/helm-best-practices/

Kubernetes extends concept
· ☕ 3 åˆ†é’Ÿ
前言 最近由于工作需要,重新系统回顾 Kubernetes 的编程。发现《Programming Kubernetes》这书写得比较系统。于是边学,边记录一些重点。 Controller

helm GO SDK
· ☕ 1 åˆ†é’Ÿ
参考 https://helm.sh/docs/topics/advanced/#go-sdk https://pkg.go.dev/helm.sh/helm/v3

Kubernetes 自动扩缩容
· ☕ 1 åˆ†é’Ÿ
本文状态:草稿 配置例子 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 apiVersion:autoscaling/v2beta2kind:HorizontalPodAutoscalermetadata:name:php-apachespec:scaleTargetRef:apiVersion:apps/v1kind:Deploymentname:php-apacheminReplicas:1maxReplicas:10metrics:- type:Resourceresource:name:cputarget:type:UtilizationaverageUtilization:50 算法 desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )] currentMetricValue 为相关 pod 的 metric 平均数。 If multiple metrics are specified in a HorizontalPodAutoscaler, this calculation is done for each metric, and then

内核同步原语
· ☕ 5 åˆ†é’Ÿ
什么是同步原语 共享内存,多进程/线程的运行期设计模式已成主流的今天,你有好奇一下,进程/线程间的怎么同步的吗?大部分人知道,我们用的开发语言

Istio Canary(金丝雀) 上线
· ☕ 1 åˆ†é’Ÿ
按比例分配分配新旧版本流量 VirtualService: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 apiVersion:networking.istio.io/v1alpha3kind:VirtualServicemetadata:name:reviewsspec:hosts:- reviewshttp:- route:- destination:host:reviewssubset:v1weight:75- destination:host:reviewssubset:v2weight:25 DestinationRule : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 apiVersion:networking.istio.io/v1alpha3kind:DestinationRulemetadata:name:bookinfo-ratingsspec:host:reviewstrafficPolicy:loadBalancer:simple:LEAST_CONNsubsets:- name:v1labels:version:v1trafficPolicy:loadBalancer:simple:ROUND_ROBIN- name:v2labels:version:v2trafficPolicy:loadBalancer:simple:ROUND_ROBIN 根据请求源 pod 的

程序员的平行宇宙 —— eBPF 系统级跟踪技术简单入门
· ☕ 5 åˆ†é’Ÿ
Linus Torvalds in 1991 程序员的平行宇宙 程序员有两个世界: 一个是编码世界,我们很容易认为,我们考虑了一切,也完成了一切的代码。 然后是运行世界,我们发现,无论

bpftool
· ☕ 1 åˆ†é’Ÿ
bpftool bpftool prog 1 $ ./execsnoop & 1 2 3 4 5 6 7 $ bpftool prog 9: kprobe name syscall__execve tag f66477d6a4dd923d gpl loaded_at 2021-03-05T16:52:05+0800 uid 0 xlated 4064B jited 2321B memlock 8192B map_ids 11 10: kprobe name do_ret_sys_exec tag 3a66f7b49f929a2e gpl loaded_at 2021-03-05T16:52:05+0800 uid 0 xlated 480B jited 314B memlock 4096B map_ids 11 The prog show subcommand lists all programs (not just those that are perf_event_open() based): 1

eBPF API
· ☕ 1 åˆ†é’Ÿ
User Space API 1 2 3 4 5 6 7 8 9 10 11 # strace -ebpf ./execsnoop bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size=4, value_size=4, max_entries=4, map_flags=0, inner_map_fd=0, map_name="events", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 120) = -1 EPERM (Operation not permitted) bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size=4, value_size=4, max_entries=4, map_flags=0, inner_map_fd=0, map_name="events", map_ifindex=0, btf_fd=0, btf_key_type_id=0, btf_value_type_id=0}, 120) = 3 bpf(BPF_PROG_LOAD, {prog_type=BPF_PROG_TYPE_KPROBE, insn_cnt=508, insns=0x7fbdc7157000, license="GPL", log_level=0, log_size=0, log_buf=NULL, kern_version=KERNEL_VERSION(5, 3, 18), prog_flags=0, prog_name="syscall__execve", prog_ifindex=0, expected_attach_type=BPF_CGROUP_INET_INGRESS, prog_btf_fd=0, func_info_rec_size=0, func_info=NULL,