go-duck-cli 1.3.372 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/generators/config.js +8 -0
- package/generators/devops.js +25 -18
- package/generators/logger.js +50 -1
- package/generators/mqtt-topics.js +54 -0
- package/generators/postman.js +2 -1
- package/generators/swagger.js +16 -16
- package/generators/telemetry.js +164 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/templates/docs/pages/configuration.hbs +46 -5
- package/templates/docs/pages/mosquitto.hbs +6 -0
- package/templates/docs/pages/observability.hbs +55 -0
- package/templates/go/router.go.hbs +808 -0
|
@@ -32,3 +32,58 @@ go-duck:
|
|
|
32
32
|
<h3 class="font-semibold mb-2 mt-6">3. System Infrastructure Metrics (Statsd)</h3>
|
|
33
33
|
<p class="mb-4 text-gray-700">The <code>logger</code> package has a sidecar implementation for Datadog's <code>statsd</code>. A developer can quickly drop custom <code>logger.Count("api.hit")</code> or <code>logger.Histogram("db.latency")</code> functions into their services to populate dashboard charts.</p>
|
|
34
34
|
</section>
|
|
35
|
+
|
|
36
|
+
<section class="mb-10">
|
|
37
|
+
<h2 class="text-2xl font-bold text-gray-800 mb-4 border-b pb-2">4. Prometheus & Kubernetes Autoscaling (HPA)</h2>
|
|
38
|
+
<p class="mb-4">For Kubernetes environments, the generated microservices automatically expose a standard <code>GET /metrics</code> Prometheus scraping endpoint powered by <code>github.com/prometheus/client_golang</code>. This allows the Kubernetes Metrics Server or Prometheus Adapter to constantly poll your API and scale up your Pod Replicas horizontally when traffic increases.</p>
|
|
39
|
+
</section>
|
|
40
|
+
|
|
41
|
+
<section class="mb-10">
|
|
42
|
+
<h2 class="text-2xl font-bold text-gray-800 mb-4 border-b pb-2">5. Real-Time System Streams (SSE)</h2>
|
|
43
|
+
<p class="mb-4">Need to see exactly how much your server is "holding up" in real time without refreshing a dashboard? GO-DUCK injects a Server-Sent Events (SSE) streaming endpoint at <code>GET /api/system/stream</code>.</p>
|
|
44
|
+
<p class="mb-4">Powered by <code>github.com/shirou/gopsutil</code>, this endpoint streams live JSON payloads directly to your browser containing CPU utilization, Memory consumption, and an aggregated Load Percentage metric at a configurable interval (defaults to 1 second).</p>
|
|
45
|
+
|
|
46
|
+
<pre><code class="language-json">{
|
|
47
|
+
"timestamp": "2026-05-28T19:30:01Z",
|
|
48
|
+
"cpu_percent": 45.2,
|
|
49
|
+
"mem_percent": 68.4,
|
|
50
|
+
"mem_used_mb": 1024,
|
|
51
|
+
"mem_total_mb": 4096,
|
|
52
|
+
"load_percentage": 56.8
|
|
53
|
+
}</code></pre>
|
|
54
|
+
</section>
|
|
55
|
+
|
|
56
|
+
<section class="mb-10">
|
|
57
|
+
<h2 class="text-2xl font-bold text-gray-800 mb-4 border-b pb-2">6. Full JHipster-Style System Metrics JSON</h2>
|
|
58
|
+
<p class="mb-4">For developers who prefer a deep dive into the JVM-style metrics (Go equivalents), a massive, rich telemetry JSON payload is natively exposed at <code>GET /api/system/metrics</code>.</p>
|
|
59
|
+
<p class="mb-4">This endpoint acts identically to the classic JHipster <code>/management/jhimetrics</code> endpoint, and will output:</p>
|
|
60
|
+
<ul class="list-disc pl-6 mb-4 text-gray-700">
|
|
61
|
+
<li><strong>System/Go Stats:</strong> Process Uptime, GC Pauses, Goroutine counts, Heap allocations, and Open Files.</li>
|
|
62
|
+
<li><strong>HTTP Tracking Middleware:</strong> Live request counts, mean execution times, and max execution times grouped by both HTTP Status Codes and specific API Endpoints.</li>
|
|
63
|
+
</ul>
|
|
64
|
+
|
|
65
|
+
<pre><code class="language-json">{
|
|
66
|
+
"system": {
|
|
67
|
+
"uptime": "10 days 4 hours 7 minutes 35 seconds",
|
|
68
|
+
"process_cpu_usage": 1.76,
|
|
69
|
+
"system_cpu_usage": 1.76,
|
|
70
|
+
"process_files_open": 359,
|
|
71
|
+
"heap_alloc_mb": 104,
|
|
72
|
+
"heap_sys_mb": 629,
|
|
73
|
+
"num_gc": 12,
|
|
74
|
+
"gc_pause_total_ms": 45,
|
|
75
|
+
"goroutines": 52
|
|
76
|
+
},
|
|
77
|
+
"endpoints": {
|
|
78
|
+
"GET /api/account": {
|
|
79
|
+
"count": 1733,
|
|
80
|
+
"mean_time_ms": 338.208,
|
|
81
|
+
"max_time_ms": 1050.2
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"status_codes": {
|
|
85
|
+
"200": { "count": 546626, "mean_time_ms": 487.64, "max_time_ms": 3.45 }
|
|
86
|
+
},
|
|
87
|
+
"failed_calls": 284
|
|
88
|
+
}</code></pre>
|
|
89
|
+
</section>
|