Skip to content

Commit

Permalink
176756565 fix event link hit (go-delve#139)
Browse files Browse the repository at this point in the history
* fix null pointer issue

* fix environment variable wrong port
  • Loading branch information
pjserol committed Feb 3, 2021
1 parent 64dfd3b commit 182961d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
4 changes: 2 additions & 2 deletions backend/optout/rpc/infra/optout-rpc-service/values.yaml
Expand Up @@ -72,7 +72,7 @@ k8sServiceChart:
NR_NAME: "${env.name}"
NR_LICENSE: "3289b893db560c39096d3c222d4a33037c24f943"
NR_TRACING: "true"
WEBHOOK_RPC_ADDRESS: "webhook-rpc-service:10002"
OPTOUTLINK_DOMAIN: "optout.${environmentVariable.dns}"
SMS_RPC_ADDRESS: "sms-rpc-service:10009"
WEBHOOK_RPC_ADDRESS: "webhook-rpc-service:10002"
MMS_RPC_ADDRESS: "mms-rpc-service:10007"
SMS_RPC_ADDRESS: "sms-rpc-service:10009"
Expand Up @@ -80,5 +80,5 @@ k8sServiceChart:
NR_NAME: "${env.name}"
NR_LICENSE: "3289b893db560c39096d3c222d4a33037c24f943"
NR_TRACING: "true"
TRACK_LINK_RPC_ADDRESS: "track-link-rpc-service"
TRACK_LINK_RPC_ADDRESS: "track-link-rpc-service:10010"
INBOUND_PORT: "10013"
Expand Up @@ -73,6 +73,6 @@ k8sServiceChart:
NR_LICENSE: "3289b893db560c39096d3c222d4a33037c24f943"
NR_TRACING: "true"
TRACKLINK_DOMAIN: "track.${environmentVariable.dns}"
WEBHOOK_RPC_ADDRESS: "webhook-rpc-service:10002"
MMS_RPC_ADDRESS: "mms-rpc-service:10007"
SMS_RPC_ADDRESS: "sms-rpc-service:10009"
WEBHOOK_RPC_ADDRESS: "webhook-rpc-service:10002"
37 changes: 22 additions & 15 deletions backend/webhook/rpc/service/track_link.go
Expand Up @@ -15,26 +15,33 @@ func (s *webhookImpl) PublishLinkHit(ctx context.Context, p *webhookpb.PublishLi
}

for _, w := range webhooks {
err = s.queue.PostWebhook(ctx, msg.WebhookMessageSpec{
sourceMessage := PublishMessageData{}
if p.SourceMessage != nil {
sourceMessage = PublishMessageData{
Type: p.SourceMessage.Type,
Id: p.SourceMessage.Id,
Recipient: p.SourceMessage.Recipient,
Sender: p.SourceMessage.Sender,
Subject: p.SourceMessage.Subject,
Message: p.SourceMessage.Message,
Content_urls: p.SourceMessage.ContentURLs,
Message_ref: p.SourceMessage.MessageRef,
}
}

if err := s.queue.PostWebhook(ctx, msg.WebhookMessageSpec{
URL: w.URL,
RateLimit: int(w.RateLimit),
Payload: msg.WebhookBody{
Event: EventLinkHitStatus,
Data: PublishLinkHitData{
URL: p.URL,
Hits: int(p.Hits),
Timestamp: p.Timestamp.AsTime().Format(time.RFC3339),
Source_message: PublishMessageData{
Type: p.SourceMessage.Type,
Id: p.SourceMessage.Id,
Recipient: p.SourceMessage.Recipient,
Sender: p.SourceMessage.Sender,
Subject: p.SourceMessage.Subject,
Message: p.SourceMessage.Message,
Content_urls: p.SourceMessage.ContentURLs,
Message_ref: p.SourceMessage.MessageRef,
}}}})
if err != nil {
URL: p.URL,
Hits: int(p.Hits),
Timestamp: p.Timestamp.AsTime().Format(time.RFC3339),
Source_message: sourceMessage,
},
},
}); err != nil {
return &webhookpb.NoReply{}, err
}
}
Expand Down
9 changes: 4 additions & 5 deletions docker-compose.yml
Expand Up @@ -15,7 +15,8 @@ services:
- "10004:10004"
- "10005:10005"
- "10006:10006"
- "10012:10012"
- "10012:10012"
- "10013:10013"
- "10014:10014"
environment:
- DISABLE_NEW_RELIC=true
Expand Down Expand Up @@ -91,19 +92,17 @@ services:
- SMS_OPTOUT_RPC_ADDRESS=backend:10011
- SMS_SENDER_RPC_ADDRESS=sender-rpc-service:10015

- OPTOUTLINK_DOMAIN=localhost:10010
- TRACKLINK_DOMAIN=localhost:10010
- OPTOUT_INBOUND_PORT=10012
- OPTOUT_RPC_ADDRESS=backend:10011
- OPTOUT_POSTGRES_URL=postgresql://postgres:example@postgres/optout
- OPTOUT_REDIS_URL=redis:6379
- OPTOUT_OPTOUTLINK_DOMAIN=localhost:10012
- OPTOUT_WEBHOOK_RPC_ADDRESS=webhook-rpc-service:10002

- TRACK_LINK_RPC_ADDRESS=backend:10010
- TRACK_LINK_INBOUND_PORT=10013
- TRACK_LINK_RPC_ADDRESS=backend:10010
- TRACK_LINK_POSTGRES_URL=postgresql://postgres:example@postgres/track_link
- TRACK_LINK_TRACKLINK_DOMAIN=localhost:10010
- TRACK_LINK_TRACKLINK_DOMAIN=localhost:10013
- TRACK_LINK_WEBHOOK_RPC_ADDRESS=webhook-rpc-service:10002

- JAEGER_AGENT_HOST=jaeger
Expand Down

0 comments on commit 182961d

Please sign in to comment.