go-duck-cli 1.4.5 → 1.4.8

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.
@@ -109,11 +109,9 @@ service:
109
109
  package telemetry
110
110
 
111
111
  import (
112
- "runtime"
113
112
  "sync"
114
113
  "time"
115
114
  "github.com/gin-gonic/gin"
116
- "net/http"
117
115
  "{{app_name}}/config"
118
116
  )
119
117
 
@@ -132,7 +130,7 @@ type StatusStats struct {
132
130
  }
133
131
 
134
132
  type AppMetrics struct {
135
- mu sync.RWMutex
133
+ Mu sync.RWMutex
136
134
  StartTime time.Time
137
135
  Endpoints map[string]*EndpointStats
138
136
  StatusCodes map[int]*StatusStats
@@ -159,8 +157,8 @@ func MetricsTrackingMiddleware(cfg *config.Config) gin.HandlerFunc {
159
157
  }
160
158
  endpointKey := method + " " + path
161
159
 
162
- globalMetrics.mu.Lock()
163
- defer globalMetrics.mu.Unlock()
160
+ globalMetrics.Mu.Lock()
161
+ defer globalMetrics.Mu.Unlock()
164
162
 
165
163
  // Status Code tracking
166
164
  if _, exists := globalMetrics.StatusCodes[status]; !exists {
@@ -204,7 +202,6 @@ import (
204
202
  "runtime"
205
203
  "time"
206
204
  "github.com/shirou/gopsutil/v3/cpu"
207
- "github.com/shirou/gopsutil/v3/mem"
208
205
  "github.com/shirou/gopsutil/v3/process"
209
206
  "os"
210
207
  "fmt"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "go-duck-cli",
3
- "version": "1.4.5",
3
+ "version": "1.4.8",
4
4
  "description": "The Ultimate Evolutionary Go Microservice Scaffolder.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -185,8 +185,8 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
185
185
  sysMetrics := telemetry.CollectSystemMetrics()
186
186
  appMetrics := telemetry.GetGlobalMetrics()
187
187
 
188
- appMetrics.mu.RLock()
189
- defer appMetrics.mu.RUnlock()
188
+ appMetrics.Mu.RLock()
189
+ defer appMetrics.Mu.RUnlock()
190
190
 
191
191
  c.JSON(http.StatusOK, gin.H{
192
192
  "system": sysMetrics,
@@ -831,7 +831,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
831
831
  } else {
832
832
  viewSub.style.display = 'block';
833
833
  viewPub.style.display = 'none';
834
- mqttConsole.innerHTML = `Waiting for messages on ${topic}...\\n`;
834
+ mqttConsole.innerHTML = 'Waiting for messages on ' + topic + '...\\n';
835
835
  }
836
836
 
837
837
  actionModal.style.display = 'flex';
@@ -918,12 +918,12 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
918
918
  tbody.innerHTML = '<tr><td colspan="4" style="text-align: center; color: #888;">No data available</td></tr>';
919
919
  } else {
920
920
  endpoints.forEach(([path, stats]) => {
921
- tbody.innerHTML += `<tr>
922
- <td style="font-family: monospace; font-weight: bold;">${path}</td>
923
- <td>${stats.count}</td>
924
- <td>${stats.mean_time_ms.toFixed(2)} ms</td>
925
- <td>${stats.max_time_ms.toFixed(2)} ms</td>
926
- </tr>`;
921
+ tbody.innerHTML += '<tr>' +
922
+ '<td style="font-family: monospace; font-weight: bold;">' + path + '</td>' +
923
+ '<td>' + stats.count + '</td>' +
924
+ '<td>' + stats.mean_time_ms.toFixed(2) + ' ms</td>' +
925
+ '<td>' + stats.max_time_ms.toFixed(2) + ' ms</td>' +
926
+ '</tr>';
927
927
  });
928
928
  }
929
929
 
@@ -993,7 +993,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
993
993
  brokerStatus.style.color = "#2ecc71";
994
994
  if (actionTitle.innerText === 'SUBSCRIBE') {
995
995
  mqttClient.subscribe(currentTopic, (err) => {
996
- if(!err) mqttConsole.innerHTML += `Subscribed to ${currentTopic}\\n`;
996
+ if(!err) mqttConsole.innerHTML += 'Subscribed to ' + currentTopic + '\\n';
997
997
  });
998
998
  }
999
999
  });
@@ -1003,7 +1003,7 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
1003
1003
  const time = new Date().toLocaleTimeString();
1004
1004
  let msgStr = message.toString();
1005
1005
  try { msgStr = JSON.stringify(JSON.parse(msgStr), null, 2); } catch(e){}
1006
- mqttConsole.innerHTML += `\\n<span style="color:#888">[${time}]</span>\\n${msgStr}\\n`;
1006
+ mqttConsole.innerHTML += '\\n<span style="color:#888">[' + time + ']</span>\\n' + msgStr + '\\n';
1007
1007
  mqttConsole.scrollTop = mqttConsole.scrollHeight;
1008
1008
  }
1009
1009
  });
@@ -1053,16 +1053,16 @@ func SetupRouter(appConfig *config.Config) *gin.Engine {
1053
1053
  .replace(/([{}[\]:,])/g, '<span class="syntax-punct">$1</span>');
1054
1054
 
1055
1055
  // Inject buttons next to topics (Only if authenticated)
1056
- highlighted = highlighted.replace(/"([^"]+)"(<span class="syntax-punct">.*?<\\/span>)/g, (match, topic, punct) => {
1056
+ highlighted = highlighted.replace(/"([^"]+)"(<span class="syntax-punct">.*?<\/span>)/g, (match, topic, punct) => {
1057
1057
  if (topic.includes('/')) {
1058
1058
  let btnHtml = "";
1059
1059
  if (keycloak && keycloak.authenticated) {
1060
1060
  const isSend = /patch|put|post|create|update/i.test(topic);
1061
1061
  const btnLabel = isSend ? "SEND" : "SUBSCRIBE";
1062
1062
  const btnColor = isSend ? "#e74c3c" : "#3498db";
1063
- btnHtml = ` <button class="mqtt-action-btn" style="background:${btnColor}" onclick="openMqttAction('${topic}', '${btnLabel}')">${btnLabel}</button>`;
1063
+ btnHtml = " <button class=\"mqtt-action-btn\" style=\"background:" + btnColor + "\" onclick=\"openMqttAction('" + topic + "', '" + btnLabel + "')\">" + btnLabel + "</button>";
1064
1064
  }
1065
- return `"${topic}"${punct}${btnHtml}`;
1065
+ return '"' + topic + '"' + punct + btnHtml;
1066
1066
  }
1067
1067
  return match;
1068
1068
  });