1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<template>
<status-section title="Overview">
<card>
<div class="row py-2 no-gutters">
<div class="col-12 col-md-3 py-2 px-3">
<div class="text-uppercase text-label pb-1">Instrumentation</div>
<h5>{{instrumentationStatusMessage}}</h5>
</div>
<div class="col-12 col-md-3 py-2 px-3">
<div class="text-uppercase text-label pb-1">Reporters</div>
<h5>{{ activeReporters.length }} Started</h5>
</div>
<div class="col-12 col-md-3 py-2 px-3">
<div class="text-uppercase text-label pb-1">Metrics</div>
<h5>{{metricsStatusMessage}}</h5>
</div>
</div>
</card>
</status-section>
</template>
<script lang="ts">
import { Component, Vue, Prop } from 'vue-property-decorator'
import {Option, none, some} from 'ts-option'
import Card from '../components/Card.vue'
import StatusSection from '../components/StatusSection.vue'
import {StatusApi, ModuleRegistry, ModuleKind, MetricRegistry, Module, Metric, Instrumentation} from '../api/StatusApi'
@Component({
components: {
'card': Card,
'status-section': StatusSection
},
})
export default class OverviewCard extends Vue {
@Prop() private moduleRegistry: Option<ModuleRegistry> = none
@Prop() private metricRegistry: Option<MetricRegistry> = none
@Prop() private instrumentation: Option<Instrumentation> = none
get reporterModules(): Module[] {
return this.moduleRegistry
.map(moduleRegistry => moduleRegistry.modules.filter(this.isReporter))
.getOrElse([])
}
get activeReporters(): Module[] {
return this.reporterModules.filter(this.isStarted)
}
get trackedMetrics(): Option<number> {
return this.metricRegistry.map(metricRegistry => metricRegistry.metrics.length)
}
get instrumentationStatusMessage(): string {
return this.instrumentation.map(i => (i.active ? 'Active' : 'Disabled') as string).getOrElse('Unknown')
}
get metricsStatusMessage(): string {
return this.trackedMetrics.map(mc => mc + ' Series').getOrElse('Unknown')
}
private isReporter(module: Module): boolean {
return [ModuleKind.Combined, ModuleKind.Span, ModuleKind.Metric].indexOf(module.kind) > 0
}
private isStarted(module: Module): boolean {
return module.started
}
}
</script>
|