Feat : Update PR as comment

This commit is contained in:
Manendra Pal Singh
2026-02-26 14:45:35 +05:30
parent 18303eb1b5
commit 9d57d3b8f1
31 changed files with 1212 additions and 478 deletions

View File

@@ -17,7 +17,7 @@ type HTTPMetrics struct {
}
var (
httlMetricsInstance *HTTPMetrics
httpMetricsInstance *HTTPMetrics
httpMetricsOnce sync.Once
httpMetricsErr error
)
@@ -31,7 +31,7 @@ func newHTTPMetrics() (*HTTPMetrics, error) {
if m.HttpRequestCount, err = meter.Int64Counter(
"onix_http_request_count",
metric.WithDescription("Total HTTP requests by status, route, method, role and calle "),
metric.WithDescription("Total HTTP requests by status, route, method, role and caller"),
metric.WithUnit("1"),
); err != nil {
return nil, fmt.Errorf("onix_http_request_count: %w", err)
@@ -42,9 +42,9 @@ func newHTTPMetrics() (*HTTPMetrics, error) {
func GetHTTPMetrics(ctx context.Context) (*HTTPMetrics, error) {
httpMetricsOnce.Do(func() {
httlMetricsInstance, httpMetricsErr = newHTTPMetrics()
httpMetricsInstance, httpMetricsErr = newHTTPMetrics()
})
return httlMetricsInstance, httpMetricsErr
return httpMetricsInstance, httpMetricsErr
}
// StatusClass returns the HTTP status class string (e.g. 200 -> "2xx").

View File

@@ -124,7 +124,7 @@ func (h *stdHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
selfID := h.SubscriberID
remoteID := ""
if v, ok := r.Context().Value(model.ContextKeyCallerID).(string); ok {
if v, ok := r.Context().Value(model.ContextKeyRemoteID).(string); ok {
remoteID = v
}
var senderID, receiverID string
@@ -176,7 +176,7 @@ func (h *stdHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Restore request body before forwarding or publishing.
r.Body = io.NopCloser(bytes.NewReader(stepCtx.Body))
if stepCtx.Route == nil {
response.SendAck(w)
response.SendAck(wrapped)
return
}
@@ -388,7 +388,7 @@ func (h *stdHandler) initSteps(ctx context.Context, mgr PluginManager, cfg *Conf
func setBecknAttr(span trace.Span, r *http.Request, h *stdHandler) {
selfID := h.SubscriberID
remoteID := ""
if v, ok := r.Context().Value(model.ContextKeyCallerID).(string); ok {
if v, ok := r.Context().Value(model.ContextKeyRemoteID).(string); ok {
remoteID = v
}

View File

@@ -100,5 +100,6 @@ func (is *InstrumentedStep) Run(ctx *model.StepContext) error {
if stepCtx.Route != nil {
ctx.Route = stepCtx.Route
}
ctx.WithContext(stepCtx.Context)
return err
}