RisingStack / trace-nodejs

Trace is a visualised distributed tracing platform designed for microservices.
https://trace.risingstack.com
Other
471 stars 90 forks source link

Trace deployment hook no longer working #136

Closed devilleweppenaar closed 7 years ago

devilleweppenaar commented 7 years ago

We've noticed that the Trace Deployment Hook we have set up in our CI (wercker) no longer works.

It used to display deployments on metrics charts on the dashboard, but that is no longer the case.

Here is an example screenshot where we did a deploy 11:40 and 11:45am:

screen shot 2017-04-25 at 12 10 44 pm

Here is the configuration that our CI executes:

#!/bin/sh

curl "https://api.trace.risingstack.com/service/${TRACE_SERVICE_NAME}/deployment" \
            -X POST \
            -H "Content-Type: application/json" \
            -H "Authorization: Bearer ${TRACE_API_KEY}" \
            -d "{
                \"revision\": \"$IMAGE_TAG\",
                \"description\": \"CI deployment via wercker\",
                \"user\": \"$WERCKER_STARTED_BY\"
              }"

We set IMAGE_TAG to the git commit hash for development, and the package.json version for master, and the WERCKER_STARTED_BY is set to our wercker username.

The POST request to Trace succeeds, but doesn't result in the deployment showing up on the dashboard.

gergelyke commented 7 years ago

Let's continue in our support system! :)

devilleweppenaar commented 7 years ago

Thanks @gergelyke. :)

For anyone else running into a similar issue. The problem was that our TRACE_SERVICE_NAME variable contained spaces.

To fix that we updated the script to encode the URL, as follows:

#!/bin/sh

URL_RAW="https://api.trace.risingstack.com/service/${TRACE_SERVICE_NAME}/deployment"
URL_ENCODED="$(echo $URL_RAW | sed 's/ /%20/g')"

echo Deployment hook URL:\\n"$URL_ENCODED"

curl "$URL_ENCODED" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${TRACE_API_KEY}" \
  -d "{
    \"revision\": \"$IMAGE_TAG\",
    \"description\": \"CI deployment via wercker\",
    \"user\": \"$WERCKER_STARTED_BY\"
  }"