Skip to content

Refactor for otel.#824

Open
FrancesTwisk wants to merge 13 commits into
wearefrank:masterfrom
FrancesTwisk:refactor-for-otel
Open

Refactor for otel.#824
FrancesTwisk wants to merge 13 commits into
wearefrank:masterfrom
FrancesTwisk:refactor-for-otel

Conversation

@FrancesTwisk

Copy link
Copy Markdown

General refactor to prepare Ladybug for OpenTelemetry:

  1. Rename Collector to Tracing, per OTLP specification.
  2. Refactor endpoint to be conform OTLP specification.
  3. Replace Ladybug.Span with OTel Span from library.
  4. Small fix for exporting reports as spans/traces.

@mhdirkse mhdirkse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not my complete review yet, but here are a few comments already.

Comment thread ladybug-common/pom.xml
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.proto</groupId>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would like these dependencies to be in the top-level pom.xml. There they should appear in <dependencyManagement>. This way the versions of the dependencies are forced to be the same for each subproject. Then the version can be omitted in ladybug-common/pom.xml.

Comment thread ladybug-frontend/src/app/shared/interfaces/report.ts
}
case 'copyReport': {
this.copyReport();
if (this.rerunnable) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two comments:

  • You are implementing here that non-rerunnable reports cannot be copied to the test tab. I am not sure whether this is the restriction we need. An alternative could be that copying to the test tab is allowed but rerunning is not.
  • Class ReportComponent implements only the report component for separate tabs. It does not apply to the report component within the debug tab. Please work with class ReportSharedStrategy. This is common code for handling reports both in separate report tabs and in the debug tab.
  • Please work with HierarchicalReport here. I intend to replace Report by HierarchicalReport.

# Conflicts:
#	ladybug-frontend/src/app/report/checkpoint-metadata-table/checkpoint-metadata-table.spec.ts
#	ladybug-frontend/src/app/report/checkpoint-value/checkpoint-value.component.spec.ts
#	ladybug-frontend/src/app/report/report-metadata-table/report-metadata-table.spec.ts
#	ladybug-frontend/src/app/report/report-value/report-value.component.spec.ts
#	ladybug-frontend/src/app/report/report.component.ts
}

private copyReport(): void {
if (!this.nodeValueState?.rerunnable) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This hides the option that rerunnable is undefined. If rerunnable is undefined I would like to see an error in the browser console to indicate a programming error. This is different from the case that rerunnable is false.


private rerunReport(): void {
if (!this.nodeValueState?.rerunnable) {
this.toastService.showWarning('This report cannot be rerun');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same point as for copyReport(). I would like an error in the browser console when rerunnable is undefined - that would be a programming error that would be relevant for testers of Ladybug.

stubStrategy: string;
transformation: string;
variables: string;
rerunnable: boolean;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When non-rerunnable reports cannot be copied to the test tab, then it is probably sufficient to have the rerunnable boolean in HierarchicalReport. Can you investigate?

testTool.endpoint(correlationId, null, reportName, "\r");
}
reportNames.add(reportName = "OpenTelemetry report");
if (reportName.equals(createReportAction)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good to have this. Now I can test without the test environment with Docker and Kubernetes that you used for realistic OpenTelemetry data.

Comment thread pom.xml
<artifactId>opentelemetry-api</artifactId>
<version>1.62.0</version>
</dependency>
<dependency>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good that these dependencies are in the parent pom.xml

<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good. The versions are inherited from the parent pom.xml.

private @Setter @Getter long estimatedMemoryUsage;
private @Setter @Getter String correlationId;
private @Setter @Getter Map<String, String> variables;
private @Setter @Getter boolean rerunnable;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good. Not nullable because it is a primitive type. It is also not nullable in the frontend.

@@ -1,110 +0,0 @@
/*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good that this class is gone. I understood from your thesis that having this custom class violated the OpenTelemetry standard.

return checkpoint(correlationId, childThreadId, sourceClassName, name,
message, null, stubableCode, stubableCodeThrowsException,
matchingStubStrategies, checkpointType, levelChangeNextCheckpoint);
matchingStubStrategies, checkpointType, levelChangeNextCheckpoint, true);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewing your changes in class TestTool requires a bit more effort than reviewing the other changes. When a bug is introduced here it has more impact then bugs in other code. I also would like Jaco to review this before merging this PR.

<void property="path">
<string>path</string>
</void>
<void property="rerunnable">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are many files in src/test/resources for expected values of reports. Only one of them changes. This indicates that importing and exporting non-rerunnable reports is not properly covered by the tests. Please improve the tests.

Doing this introduces a conflict with a PR needed by one of our customers. The time needed for that other PR was billed to NN, suggesting it has precedence over the present PR. I will contact Jaco and our service manager Vivienne about this conflict.

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.

2 participants