Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make separate measuresments for each telemetry #1016

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions ironfish/src/telemetry/interfaces/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ import { Tag } from './tag'
*/
export interface Metric {
/**
* A description for the container that the fields measure. Defaults to
* 'node' because all metrics are submitted from an Iron Fish node.
* A description for the container that the fields measure. This is equivilent
* to a SQL table.
*/
measurement: string

/**
* The name of whatever is being measured.
*/
name: string

/**
* The exact time at which the metric was recorded.
* JS gives us millisecond accuracy here.
Expand Down
2 changes: 0 additions & 2 deletions ironfish/src/telemetry/telemetry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Telemetry', () => {

const mockMetric: Metric = {
measurement: 'node',
name: 'memory',
fields: [
{
name: 'heap_used',
Expand Down Expand Up @@ -59,7 +58,6 @@ describe('Telemetry', () => {
it('throws an error', () => {
const metric: Metric = {
measurement: 'node',
name: 'memory',
fields: [],
}

Expand Down
21 changes: 8 additions & 13 deletions ironfish/src/telemetry/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,21 @@ export class Telemetry {

submitNodeStarted(): void {
this.submit({
measurement: 'node',
name: 'started',
measurement: 'node_started',
fields: [{ name: 'online', type: 'boolean', value: true }],
})
}

submitNodeStopped(): void {
this.submit({
measurement: 'node',
name: 'started',
measurement: 'node_started',
fields: [{ name: 'online', type: 'boolean', value: false }],
})
}

submitBlockMined(block: Block): void {
this.submit({
measurement: 'node',
name: 'block_mined',
measurement: 'block_mined',
fields: [
{
name: 'difficulty',
Expand All @@ -150,8 +147,7 @@ export class Telemetry {

submitMemoryUsage(heapUsed: number, heapTotal: number): void {
this.submit({
measurement: 'node',
name: 'memory',
measurement: 'node_memory',
fields: [
{
name: 'heap_used',
Expand All @@ -169,23 +165,22 @@ export class Telemetry {

submitNewBlockSeen(block: Block, seenAt: Date): void {
this.submit({
measurement: 'propagation',
name: 'propagation',
measurement: 'block_propagation',
timestamp: seenAt,
tags: [
{
name: 'block_hash',
name: 'hash',
value: block.header.hash.toString('hex'),
},
],
fields: [
{
name: 'block_timestamp',
name: 'timestamp',
type: 'integer',
value: block.header.timestamp.valueOf(),
},
{
name: 'block_sequence',
name: 'sequence',
type: 'integer',
value: block.header.sequence,
},
Expand Down