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

Wip fix for trace 1.0 #70

Merged
merged 10 commits into from
Jan 25, 2021
Merged

Wip fix for trace 1.0 #70

merged 10 commits into from
Jan 25, 2021

Conversation

jsuereth
Copy link
Collaborator

- Create an absurdly named exception to help gradle test failures tell users how to fix issues.
- Add better `--info` output on test failure for mock server
- Update README to show how to build the project.

Note: The best errors we get out of gradle by default look like this now:

```
> Task :exporter-metrics:test

com.google.cloud.opentelemetry.metric.EndToEndTest > testExportEmptyMetricsList FAILED
    com.google.cloud.opentelemetry.metric.MockServerStartupFailedPleaseReadmeException at EndToEndTest.java:58
        Caused by: java.io.IOException at EndToEndTest.java:42
            Caused by: java.io.IOException at EndToEndTest.java:42
    java.lang.NullPointerException at EndToEndTest.java:64
```
- Start of a refactor to improve handling of multiple-items-in-a-timeseries (see #64)
  - Add new aggregation tactic to look at ALL timeseries before generating MetricDescriptors
  - Lazy-create metric descriptors and TimeSeries as we see new metrics
  - Post-synthesis of time-series, check sanity and push to GCM.
  - Attempt to leverage new "less casting" interfaces in 0.14
- Update API/build for re-arranged 0.14.1 artifacts and metrics "alpha" stage.
@jsuereth jsuereth requested a review from aabmass January 23, 2021 14:39
Copy link
Contributor

@aabmass aabmass left a comment

Choose a reason for hiding this comment

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

LGTM just left some nits/questions

Comment on lines 126 to 127
"Metric type {} not supported. Only gauge and cumulative types are supported.",
metricData.getType());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit inconsistent indent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

// Extract all the underlying points.
switch(metricData.getType()) {
case LONG_GAUGE:
for(LongPoint point : metricData.getLongGaugeData().getPoints()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not too familiar with the Java SDK – in practice, is there always just one point?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, that's one of the issues we're fixing here.

List<TimeSeries> series = builder.getTimeSeries();
createTimeSeriesBatch(metricServiceClient, ProjectName.of(projectId), series);
// TODO: better error reporting.
if (series.size() < metrics.size()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Re above comment about each MetricData having a list of points; if that's not the case, this would report failure. Should we just remove the check for now if its not adding anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm trying to not change the behavior right before 1.0. I agree this needs to get fixed, but I'd rather spend some time on it.

Given metrics is alpha, I think the TODO and a bug to fix is the right way to go for now.

// }
}
List<TimeSeries> series = builder.getTimeSeries();
createTimeSeriesBatch(metricServiceClient, ProjectName.of(projectId), series);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do GCM API errors get surfaced? It doesn't look like createTimeSeriesBatch() throws. API errors seem like the most reasonable case to return CompletableResultCode.ofFailure()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to refactor all of that code. I opened up an issue to track it, but yeah... it's not clear what happens right now.

Even more, we may want to use an asynchronous client to avoid blocking, as we return a completable result (i.e an async observable). We'll fix this up more post-1.0 as it won't break existing usage, just make it better.

Comment on lines +37 to +38
// Start the mock server. This assumes the binary is present and in $PATH.
// Typically, the CI will be the one that curls the binary and adds it to $PATH.
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to assume it's in $PATH? Is the comment outdated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'm going to fix this up in a follow-on. I want to use test-containers here, maybe we discuss that more offline.

Comment on lines +59 to +60
// Start the mock server. This assumes the binary is present and in $PATH.
// Typically, the CI will be the one that curls the binary and adds it to $PATH.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same comment as above, also I'd like to share this in a test-util library component that's not released.

@jsuereth jsuereth merged commit e2ad6d1 into master Jan 25, 2021
@jsuereth jsuereth deleted the wip-fix-for-trace-1.0 branch January 25, 2021 22:28
@jsuereth jsuereth restored the wip-fix-for-trace-1.0 branch January 26, 2021 15:18
@jsuereth jsuereth deleted the wip-fix-for-trace-1.0 branch January 26, 2021 15:20
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