Temperature and Humidity Monitoring with ESP01 Board

5 min read
Introduction This article records the process of building a temperature and humidity monitor with an ESP01 + DHT11, covering hardware wiring, code implementation, and functional verification. The ESP01, a low-cost, low-power WiFi module, is well suited as a collection node. Hardware Preparation ESP01 Board: Core control module, responsible for data collection and network communication. DHT Temperature and Humidity Sensor: Used to measure ambient temperature and humidity. Dupont Wires: Used to connect the ESP01 and DHT sensor. Connect the DHT sensor’s VCC pin to the ESP01’s 3.3V pin, the GND pin to GND, and the data pin to the designated pin on the ESP01 (defined as DHTPIN in the code).
ESP01 DHT11 Arduino Temperature Humidity
Continue reading →

eBPF Series: DeepFlow Extended Protocol Parsing Practice (MongoDB Protocol & Kafka Protocol)

22 min read
Overview: How to Analyze a Protocol (MongoDB) Protocol Document Analysis Approach MongoDB Protocol OpCode Reference Table Analyzing the Most Common OpCode OP_MSG Extending Protocol Parsing in DeepFlow Agent DeepFlow Agent Development Document Overview Code Guide Define a Protocol with a Constant Identifier Prepare Parsing Logic for the New Protocol Define the Struct Implement L7ProtocolParserInterface Extending DeepFlow Protocol Collection Using Wasm Plugins Kafka Protocol Analysis Kafka Header and Data Overview Kafka Fetch API Kafka Produce API Kafka Protocol DeepFlow Agent Native Decoding DeepFlow Agent Wasm Plugin Wasm Go SDK Framework Plugin Code Guide Conclusion Native Rust Extension Wasm Plugin Extension Appendix Overview MongoDB is widely used today, but lacks effective observability capabilities. DeepFlow is an excellent solution for observability, but it lacks support for the MongoDB protocol. This article extends DeepFlow with MongoDB protocol parsing, enhancing observability in the MongoDB ecosystem. It briefly describes the process from protocol document analysis to implementing code parsing within DeepFlow.
DeepFlow EBPF Protocol Parsing MongoDB Kafka
Continue reading →

Prompt Engineering: Learning to Talk to AI Is Lesson One

6 min read
What is Prompt Engineering? The core definition of Prompt Engineering is: Designing natural language inputs to guide Large Language Model outputs toward specific results. This concept seems simple, but it hides a profound assumption: The same model, different prompts → completely different outputs. Imagine you have an incredibly smart assistant with zero background knowledge. This assistant can perfectly understand and execute any instruction, but it lacks prior knowledge and has no memory. Prompt engineering is the art of learning how to converse with such an assistant.
AI Engineering Paradigm Evolution Prompt Engineering LLM
Continue reading →

Go P2P Development: From Basics to PubSub

10 min read
Go’s simple concurrency model and fast compilation make it a popular choice for P2P network development. go-libp2p is one of the most complete libp2p implementations and is widely used in large projects like IPFS (Kubo). Environment Setup bash 1 2 3 go get github.com/libp2p/go-libp2p go get github.com/libp2p/go-libp2p-kad-dht go get github.com/libp2p/go-libp2p-pubsub go.mod configuration:
P2P Golang Libp2p DHT PubSub Custom Protocol
Continue reading →

Applying VictoriaMetrics Stream Aggregation for Metrics

9 min read
Community VM Stream Aggregation Capability Analysis and Issues VictoriaMetrics Open-Source Project Native Capabilities Stream aggregation in the VictoriaMetrics project was integrated into vmagent starting from version 1.86. For details, refer to: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3460 From the source code analysis, the stream aggregation capability looks like this: The core computation code is described in the pushSample function: go 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 func (as *totalAggrState) pushSample(inputKey, outputKey string, value float64) { currentTime := fasttime.UnixTimestamp() deleteDeadline := currentTime + as.intervalSecs + (as.intervalSecs >> 1) again: v, ok := as.m.Load(outputKey) if !ok { v = &totalStateValue{ lastValues: make(map[string]*lastValueState), } vNew, loaded := as.m.LoadOrStore(outputKey, v) if loaded { v = vNew } } sv := v.(*totalStateValue) sv.mu.Lock() deleted := sv.deleted if !deleted { lv, ok := sv.lastValues[inputKey] if !ok { lv = &lastValueState{} sv.lastValues[inputKey] = lv } d := value if ok && lv.value <= value { d = value - lv.value } if ok || currentTime > as.ignoreInputDeadline { sv.total += d } lv.value = value lv.deleteDeadline = deleteDeadline sv.deleteDeadline = deleteDeadline } sv.mu.Unlock() if deleted { goto again } } General Application Analysis of Stream Aggregation First, let’s look at the time series chart after stream aggregation:
VictoriaMetrics Prometheus Metric Aggregation Vmagent
Continue reading →

eBPF Series: A Brief Analysis of Pixie

2 min read
Deployment process and instructions reference: pixie install Pixie Platform Main Components Pixie Edge Module (PEM): Pixie’s agent, installed per node. PEMs use eBPF to collect data, which is stored locally on the node. Vizier: Pixie’s collector, installed per cluster. Responsible for query execution and managing PEMs. Pixie Cloud: Used for user management, authentication, and data proxying. Can be hosted or self-hosted. Pixie CLI: Used to deploy Pixie. Can also be used to run queries and manage resources like API keys.
Pixie EBPF Kubernetes
Continue reading →

A Casual Talk About CPU Timing and Modern Operating Systems

17 min read
Time-Sharing Systems and Linux First, let’s review time-sharing systems. The time-sharing system is a very important operating system concept that maximizes computer utilization and is a crucial means of implementing multi-program concurrency. The Linux kernel we use daily also adopts the time-sharing system philosophy, mainly reflected in the following aspects: Time Slice: Linux uses a time slice mechanism to divide CPU time. Each process can only execute for one time slice before yielding the CPU to other processes. This achieves CPU time sharing and fair allocation.
CPU Linux Operating System
Continue reading →

Rust P2P Development: From Ping to Gossipsub

6 min read
Rust’s ownership model and zero-cost abstractions make it an ideal language for implementing P2P network protocols. The Rust implementation of libp2p (rust-libp2p) provides a complete protocol stack from transport to application layer. Environment Setup Configure dependencies in Cargo.toml: toml 1 2 3 4 5 6 7 8 9 [dependencies] libp2p = { version = "0.53", features = [ "tokio", "tcp", "quic", "noise", "yamux", "mplex", "ping", "identify", "kad", "gossipsub", "relay", "dcutr", "macros", ] } tokio = { version = "1.0", features = ["full"] } tokio-stream = "0.1" futures = "0.3" anyhow = "1.0" Create the project:
P2P Rust Libp2p Kademlia Gossipsub
Continue reading →

Eyes On You: The 2022 Productization Journey of a Multi-Cloud Heterogeneous Monitoring Platform

5 min read
This article reviews the 2022 productization evolution of a large-scale internet monitoring platform, covering the planning and implementation approach to move from large-scale coverage to productization, usability, and intelligence. The platform spans multi-cloud, multi-region, massive-metric collection and alerting; this is a record of its real evolution. Platform Status: Large-Scale Challenges of Multi-Cloud Heterogeneity As business expands globally, the monitoring platform has entered a phase of ultra-large scale, highly distributed, and heterogeneous operation. The current status is as follows:
Prometheus Monitoring Platform Productization Architecture
Continue reading →

Hybrid Cloud Cross-Region Monitoring System Governance: Autonomous + Unified Dual-Core Architecture Practice

5 min read
In the context of global business expansion and large-scale hybrid cloud deployment, cross-IDC, cross-border, multi-cloud heterogeneous monitoring governance has become a core challenge for stability assurance. Traditional monitoring solutions either rely on expensive dedicated line upgrades that intrude on business architecture, or cannot balance node autonomy with global unification. Meanwhile, as a non-revenue infrastructure, the monitoring system must strictly control resource usage without allowing capability degradation. This article breaks down a practical cross-region monitoring system governance solution from a real internet company, explaining how to achieve elastic scaling, cross-border coverage, node autonomy, and data unification for the monitoring system without modifying business architecture or incurring business cross-domain costs.
Hybrid Cloud Monitoring Architecture
Continue reading →