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

[BEAM-11994] Update ShortIdMap to check preconditions that the payload and startTime are not set, and add unit tests. #14804

Merged
merged 1 commit into from
Jul 1, 2021

Conversation

ajamato
Copy link

@ajamato ajamato commented May 13, 2021

[BEAM-11994] Update ShortIdMap to check preconditions that the payload and startTime are not set, and add unit tests.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status Build Status Build Status --- Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@ajamato ajamato force-pushed the bq_metrics_process_wide_short_ids branch from 40df4f5 to e056c82 Compare May 13, 2021 01:19
@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #14804 (40df4f5) into master (6009044) will increase coverage by 0.05%.
The diff coverage is n/a.

❗ Current head 40df4f5 differs from pull request most recent head 7cfd330. Consider uploading reports for the commit 7cfd330 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14804      +/-   ##
==========================================
+ Coverage   83.74%   83.79%   +0.05%     
==========================================
  Files         439      439              
  Lines       59041    59133      +92     
==========================================
+ Hits        49442    49551     +109     
+ Misses       9599     9582      -17     
Impacted Files Coverage Δ
...snippets/transforms/aggregation/combineglobally.py
sdks/python/apache_beam/io/tfrecordio.py
...on/apache_beam/runners/portability/flink_runner.py
sdks/python/apache_beam/internal/gcp/json_value.py
...dks/python/apache_beam/examples/cookbook/coders.py
sdks/python/apache_beam/transforms/stats.py
...e_beam/portability/api/beam_runner_api_pb2_grpc.py
...python/apache_beam/examples/wordcount_debugging.py
sdks/python/apache_beam/typehints/opcodes.py
sdks/python/apache_beam/io/iobase.py
... and 867 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6009044...7cfd330. Read the comment docs.

@ajamato
Copy link
Author

ajamato commented May 13, 2021

R: @robertwb @pabloem

Split from
#14490

@ajamato
Copy link
Author

ajamato commented May 13, 2021

Run Java PreCommit

@robertwb
Copy link
Contributor

To follow up from the question on the previous PR, why do we need per-metric (vs, say, per-process) start times? And if we don't perhaps we don't need this complexity at all.

@ajamato
Copy link
Author

ajamato commented May 14, 2021

I see, thinking about this more. I realize that we will hit bug that OpenCensus had when they tried to share a startTime

If you don't report a startTime near and prior to the reporting time of the first timeseries.create call, you can get weird issues in the way that stackdriver does precomputes, interpolation, etc.
Without the fix, we had flakey tests that would not be able to read back out the metric they had just written (it would be 0 in the first interval).

I actually had to fix this in their github in the past
https://github.com/census-instrumentation/opencensus-cpp/pull/444 

I think the best thing to do is to set the startTime for each MonitoringInfo, in the process_wide MetricContainer only. Then it can be added and stored in the ShortIdMap. This would require the process_wide MetricContainer to somehow know it's the first time it's encountered the MonitoringInfo. So I will make the process_wide MetricContainer reference the ShortIdMap and check if the MonitoringInfo exists first before generating the startTime.

What do you think of this approach?

@robertwb
Copy link
Contributor

Thanks for clarifying the motivation.

I don't think it makes sense to add complexity to Beam metrics to work around a bug in OpenCensus. Instead, whatever code is reporting to OpenCensus should have the hack to assign a reasonable start time value the first time it reports a metric.

@aaltay
Copy link
Member

aaltay commented May 27, 2021

What is the next step on this PR? Should we close it based on the comment thread?

@ajamato
Copy link
Author

ajamato commented May 28, 2021

Not waiting for review, discussed offline. Need to make some changes. Will get to it in in about 3 weeks.

@ajamato ajamato force-pushed the bq_metrics_process_wide_short_ids branch 2 times, most recently from f86b245 to 6553be4 Compare June 15, 2021 22:56
@ajamato ajamato force-pushed the bq_metrics_process_wide_short_ids branch from 6553be4 to 7cfd330 Compare June 15, 2021 22:59
@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

Failing test doesn't looks like it is due to this PR

@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

https://ci-beam.apache.org/job/beam_PreCommit_Java_Commit/18041/#showFailuresLink

Test Result (21 failures / +21)

org.apache.beam.runners.flink.FlinkSavepointTest.testSavepointRestoreLegacy
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteScriptedUpsert
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteRetry
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteFullAddressing
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteRetryValidRequest
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWritePartialUpdate
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testSplit
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testDefaultRetryPredicate
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithIndexFn
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testMaxParallelRequestsPerWindow
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testReadWithQueryValueProvider
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testReadWithQueryString
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testReadWithMetadata
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithDocVersion
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithIdFn
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testRead
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithIsDeleteFn
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithRouting
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testSizes
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithMaxBatchSizeBytes
org.apache.beam.sdk.io.elasticsearch.ElasticsearchIOTest.testWriteWithErrors

@ajamato ajamato changed the title [BEAM-11994] Update ShortIdMap's maps to only use valid keyable fields in the MonitoringInfo (urn and labels). [BEAM-11994] Update ShortIdMap to check preconditions that the payload and startTime are not set, and add unit tests. Jun 16, 2021
@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

R: @robertwb I revised the PR,
Now it just adds unit tests and preconditions for the ShortID map, to help make sure it doesn't regress in the future.

Let's pick up and complete this review again.
Thanks for your help so far

@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

Run Java PreCommit

6 similar comments
@ajamato
Copy link
Author

ajamato commented Jun 16, 2021

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 17, 2021

Run Java PreCommit

@robertwb
Copy link
Contributor

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 23, 2021

Run Java PreCommit

@aaltay
Copy link
Member

aaltay commented Jun 29, 2021

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 30, 2021

Run Java PreCommit

@ajamato
Copy link
Author

ajamato commented Jun 30, 2021

Looks like it finally passed. Would one of you please merge?

@robertwb @aaltay

@aaltay aaltay merged commit e4d27c1 into apache:master Jul 1, 2021
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.

3 participants