Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
opentracing: add timeout tag to fragment spans (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshshanmugam committed Nov 14, 2018
1 parent 22608d3 commit ab689b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/fragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ module.exports = class Fragment extends EventEmitter {
id,
primary,
async: isAsync,
public: isPublic
public: isPublic,
timeout
} = this.attributes;

span.addTags({
Expand All @@ -134,7 +135,8 @@ module.exports = class Fragment extends EventEmitter {
public: isPublic,
async: isAsync,
id: id || 'unnamed',
primary
primary,
timeout
});

this.requestFragment(url, this.attributes, request, span).then(
Expand Down
8 changes: 5 additions & 3 deletions tests/tailor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,8 @@ describe('Tailor', () => {
fallback: false,
public: false,
async: false,
id: 'unnamed'
id: 'unnamed',
timeout: 3000
});
})
.then(done, done);
Expand All @@ -1387,7 +1388,7 @@ describe('Tailor', () => {
.reply(500);

mockTemplate.returns(
'<fragment id="test" src="https://fragment/1" fallback-src="http://localhost:9000/2"></fragment>'
'<fragment id="test" src="https://fragment/1" timeout="200" fallback-src="http://localhost:9000/2"></fragment>'
);

getResponse('http://localhost:8080/test')
Expand All @@ -1400,7 +1401,8 @@ describe('Tailor', () => {
fallback: false,
primary: false,
async: false,
public: false
public: false,
timeout: 200
});
})
.then(done, done);
Expand Down

0 comments on commit ab689b3

Please sign in to comment.