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

refactor(ironfish): Clean up existing Telemetry into single service #966

Merged
merged 1 commit into from Feb 10, 2022

Conversation

rohanjadvani
Copy link
Member

@rohanjadvani rohanjadvani commented Feb 8, 2022

Summary

The existing telemetry implementation wasn't designed very intuitively. There was an existing Telemetry interface which was implemented by NodeTelemetry and DisabledTelemetry, each of which had a lot of side effects and returned new instances.

This code change:

  • Refactors telemetry into a single service
  • Adds a worker job for submitting telemetry to the API
  • Convert Metric and Field from types to interfaces (inspired by TS docs)

Testing Plan

Added unit tests and verified manually in InfluxDB for my node_id.

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes
[x] No

@rohanjadvani rohanjadvani self-assigned this Feb 8, 2022
@rohanjadvani rohanjadvani requested a review from a team as a code owner February 8, 2022 00:08
@linear
Copy link

linear bot commented Feb 8, 2022


if (points.length < this.MAX_QUEUE_SIZE) {
this.logger.debug('Retrying telemetry submission')
this.points = points
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be concatted or else you'll wipe out queued points while the request is pending

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later, we should dump points if we fail after a certain amount of times.

export async function submitTelemetry({
points,
}: SubmitTelemetryRequest): Promise<SubmitTelemetryResponse> {
const api = new WebApi()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed we don't consistency configure this from somewhere to let us test against staging, or let other users point at their own endpoint.

Copy link
Contributor

@NullSoldier NullSoldier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good PR, we can continue working on it after.

@NullSoldier NullSoldier enabled auto-merge (squash) February 10, 2022 01:46
@NullSoldier NullSoldier merged commit 1ee07b3 into staging Feb 10, 2022
@NullSoldier NullSoldier deleted the feature/iro-1505 branch February 10, 2022 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants