Skip to content

Commit

Permalink
OZ-726: Add Service ability to provide extra service metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
enyachoke committed Oct 31, 2024
1 parent fcc1c6f commit eac418c
Show file tree
Hide file tree
Showing 19 changed files with 409 additions and 249 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Container registration is an opt-in process. By default, Container-to-Consul wil
| `consul.port` | The port that the service will be discovered on| `none` |
| `consul.service` | The name of the service in Consul | `container name` |
| `consul.tags` | The tags that will be added to the service in Consul | `[]` |
| `consul.meta` | The service [meta](https://developer.hashicorp.com/consul/api-docs/catalog#meta) as `key=value,key=value` | empty |
| `consul.kv.<KEY>` | Key/Value pairs | `{}` |

### Registration
Expand Down
2 changes: 1 addition & 1 deletion coverage/coverage.json

Large diffs are not rendered by default.

46 changes: 23 additions & 23 deletions coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">92.7% </span>
<span class="strong">89.37% </span>
<span class="quiet">Statements</span>
<span class='fraction'>165/178</span>
<span class='fraction'>185/207</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">86.15% </span>
<span class="strong">77.27% </span>
<span class="quiet">Branches</span>
<span class='fraction'>56/65</span>
<span class='fraction'>68/88</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>29/29</span>
<span class='fraction'>31/31</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">92.61% </span>
<span class="strong">89.27% </span>
<span class="quiet">Lines</span>
<span class='fraction'>163/176</span>
<span class='fraction'>183/205</span>
</div>
</div>
</div>
Expand All @@ -60,28 +60,28 @@ <h1>
</thead>
<tbody><tr>
<td class="file high" data-value="lib/"><a href="lib/index.html">lib/</a></td>
<td data-value="94.85" class="pic high"><div class="chart"><div class="cover-fill" style="width: 94%;"></div><div class="cover-empty" style="width:6%;"></div></div></td>
<td data-value="94.85" class="pct high">94.85%</td>
<td data-value="136" class="abs high">129/136</td>
<td data-value="86.79" class="pct high">86.79%</td>
<td data-value="53" class="abs high">46/53</td>
<td data-value="91.41" class="pic high"><div class="chart"><div class="cover-fill" style="width: 91%;"></div><div class="cover-empty" style="width:9%;"></div></div></td>
<td data-value="91.41" class="pct high">91.41%</td>
<td data-value="163" class="abs high">149/163</td>
<td data-value="78.38" class="pct medium">78.38%</td>
<td data-value="74" class="abs medium">58/74</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="13" class="abs high">13/13</td>
<td data-value="94.78" class="pct high">94.78%</td>
<td data-value="134" class="abs high">127/134</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="91.3" class="pct high">91.3%</td>
<td data-value="161" class="abs high">147/161</td>
</tr>

<tr>
<td class="file high" data-value="lib/consul/"><a href="lib/consul/index.html">lib/consul/</a></td>
<td data-value="85" class="pic high"><div class="chart"><div class="cover-fill" style="width: 85%;"></div><div class="cover-empty" style="width:15%;"></div></div></td>
<td data-value="85" class="pct high">85%</td>
<td data-value="40" class="abs high">34/40</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="12" class="abs high">10/12</td>
<td data-value="80.95" class="pic high"><div class="chart"><div class="cover-fill" style="width: 80%;"></div><div class="cover-empty" style="width:20%;"></div></div></td>
<td data-value="80.95" class="pct high">80.95%</td>
<td data-value="42" class="abs high">34/42</td>
<td data-value="71.43" class="pct medium">71.43%</td>
<td data-value="14" class="abs medium">10/14</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="15" class="abs high">15/15</td>
<td data-value="85" class="pct high">85%</td>
<td data-value="40" class="abs high">34/40</td>
<td data-value="80.95" class="pct high">80.95%</td>
<td data-value="42" class="abs high">34/42</td>
</tr>

<tr>
Expand All @@ -103,7 +103,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/lib/consul/catalog.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
30 changes: 15 additions & 15 deletions coverage/lcov-report/lib/consul/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">85% </span>
<span class="strong">80.95% </span>
<span class="quiet">Statements</span>
<span class='fraction'>34/40</span>
<span class='fraction'>34/42</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">83.33% </span>
<span class="strong">71.43% </span>
<span class="quiet">Branches</span>
<span class='fraction'>10/12</span>
<span class='fraction'>10/14</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>15/15</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">85% </span>
<span class="strong">80.95% </span>
<span class="quiet">Lines</span>
<span class='fraction'>34/40</span>
<span class='fraction'>34/42</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -72,16 +72,16 @@ <h1>
</tr>

<tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="81.48" class="pic high"><div class="chart"><div class="cover-fill" style="width: 81%;"></div><div class="cover-empty" style="width:19%;"></div></div></td>
<td data-value="81.48" class="pct high">81.48%</td>
<td data-value="27" class="abs high">22/27</td>
<td data-value="90" class="pct high">90%</td>
<td data-value="10" class="abs high">9/10</td>
<td class="file medium" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="75.86" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75.86" class="pct medium">75.86%</td>
<td data-value="29" class="abs medium">22/29</td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="12" class="abs medium">9/12</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="7" class="abs high">7/7</td>
<td data-value="81.48" class="pct high">81.48%</td>
<td data-value="27" class="abs high">22/27</td>
<td data-value="75.86" class="pct medium">75.86%</td>
<td data-value="29" class="abs medium">22/29</td>
</tr>

<tr>
Expand All @@ -103,7 +103,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
27 changes: 18 additions & 9 deletions coverage/lcov-report/lib/consul/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">81.48% </span>
<span class="strong">75.86% </span>
<span class="quiet">Statements</span>
<span class='fraction'>22/27</span>
<span class='fraction'>22/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">90% </span>
<span class="strong">75% </span>
<span class="quiet">Branches</span>
<span class='fraction'>9/10</span>
<span class='fraction'>9/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>7/7</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">81.48% </span>
<span class="strong">75.86% </span>
<span class="quiet">Lines</span>
<span class='fraction'>22/27</span>
<span class='fraction'>22/29</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class='status-line medium'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
Expand Down Expand Up @@ -122,7 +122,10 @@ <h1>
77
78
79
80</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
80
81
82
83</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
Expand Down Expand Up @@ -152,6 +155,9 @@ <h1>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -227,6 +233,9 @@ <h1>
transformResponse: [
(data) =&gt; {
<span class="cstat-no" title="statement not covered" > let resp;</span>
<span class="cstat-no" title="statement not covered" > if (!data) {</span>
<span class="cstat-no" title="statement not covered" > return {};</span>
}
<span class="cstat-no" title="statement not covered" > try {</span>
<span class="cstat-no" title="statement not covered" > resp = JSON.parse(data);</span>
} catch (error) {
Expand Down Expand Up @@ -286,7 +295,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/lib/consul/kv.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
41 changes: 31 additions & 10 deletions coverage/lcov-report/lib/container-to-consul.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ <h1>
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">93.64% </span>
<span class="strong">93.81% </span>
<span class="quiet">Statements</span>
<span class='fraction'>103/110</span>
<span class='fraction'>106/113</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">86.27% </span>
<span class="strong">86.54% </span>
<span class="quiet">Branches</span>
<span class='fraction'>44/51</span>
<span class='fraction'>45/52</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>10/10</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">93.58% </span>
<span class="strong">93.75% </span>
<span class="quiet">Lines</span>
<span class='fraction'>102/109</span>
<span class='fraction'>105/112</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -318,13 +318,21 @@ <h1>
273
274
275
276</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
276
277
278
279
280
281
282
283</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-yes">22×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -499,6 +507,9 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -515,7 +526,7 @@ <h1>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes">9×</span>
<span class="cline-any cline-yes">10×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
Expand Down Expand Up @@ -543,6 +554,9 @@ <h1>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-yes"></span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -600,6 +614,7 @@ <h1>
const Docker = require('./docker');
const Promise = require('bluebird');
const SkipError = require('./errors/skipError');
const parse = require('./parse-key-pair');
&nbsp;
class ContainertoConsul {
constructor(config) {
Expand Down Expand Up @@ -771,7 +786,10 @@ <h1>
Node: this.containerServiceName(container),
Address: this.docker.docker0,
Service: {
Service: this.containerServiceName(container)
Service: this.containerServiceName(container),
Meta: {
redis_version: '4.0'
}
}
};
let containerIPAddress = container
Expand Down Expand Up @@ -817,6 +835,9 @@ <h1>
.split(',')
.map(tag =&gt; tag.trim());
break;
case 'consul.meta':
service.Service.Meta = parse(lbls[label]);
break;
}
});
}
Expand Down Expand Up @@ -874,7 +895,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/lib/docker.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/lib/errors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Mon Oct 07 2024 12:49:06 GMT+0300 (East Africa Time)
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Oct 31 2024 12:18:59 GMT+0300 (East Africa Time)
</div>
</div>
<script src="../../prettify.js"></script>
Expand Down
Loading

0 comments on commit eac418c

Please sign in to comment.