Skip to content

Commit

Permalink
Merge pull request #436 from xmidt-org/denopink/patch/otel-feat
Browse files Browse the repository at this point in the history
bug: otel update assumed device and sat api receives wrp body
  • Loading branch information
schmidtw authored Jul 27, 2023
2 parents 06c3c97 + 802ebf4 commit d82eda2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ keys/*.private
# VSCode
*.code-workspace
.vscode/*
.dev/*

# Vim
*.swp
Expand Down
20 changes: 5 additions & 15 deletions translation/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
"github.com/xmidt-org/sallust"
"github.com/xmidt-org/tr1d1um/transaction"
"github.com/xmidt-org/wrp-go/v3"
"github.com/xmidt-org/wrp-go/v3/wrpcontext"
"github.com/xmidt-org/wrp-go/v3/wrphttp"
)

Expand Down Expand Up @@ -76,10 +75,10 @@ func ConfigHandler(c *Options) {
opts...,
)

c.APIRouter.Handle("/device/{deviceid}/{service}", c.Authenticate.Then(candlelight.EchoFirstTraceNodeInfo(candlelight.Tracing{}.Propagator(), true)(transaction.Welcome(WRPHandler)))).
c.APIRouter.Handle("/device/{deviceid}/{service}", c.Authenticate.Then(candlelight.EchoFirstTraceNodeInfo(candlelight.Tracing{}.Propagator(), false)(transaction.Welcome(WRPHandler)))).
Methods(http.MethodGet, http.MethodPatch)

c.APIRouter.Handle("/device/{deviceid}/{service}/{parameter}", c.Authenticate.Then(candlelight.EchoFirstTraceNodeInfo(candlelight.Tracing{}.Propagator(), true)(transaction.Welcome(WRPHandler)))).
c.APIRouter.Handle("/device/{deviceid}/{service}/{parameter}", c.Authenticate.Then(candlelight.EchoFirstTraceNodeInfo(candlelight.Tracing{}.Propagator(), false)(transaction.Welcome(WRPHandler)))).
Methods(http.MethodDelete, http.MethodPut, http.MethodPost)
}

Expand Down Expand Up @@ -147,18 +146,9 @@ func decodeRequest(ctx context.Context, r *http.Request) (decodedRequest interfa
partnerIDs []string
)

m, ok := wrpcontext.Get[wrp.Message](ctx)

if !ok {
if payload, err = requestPayload(r); err == nil {
tid = getTID(ctx)
partnerIDs = getPartnerIDsDecodeRequest(ctx, r)

}
} else {
payload = m.Payload
partnerIDs = m.PartnerIDs
tid = m.TransactionUUID
if payload, err = requestPayload(r); err == nil {
tid = getTID(ctx)
partnerIDs = getPartnerIDsDecodeRequest(ctx, r)
}

if err == nil {
Expand Down

0 comments on commit d82eda2

Please sign in to comment.