-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Firstore Async Instrumentation (#882)
* Remove unnecessary instrumentation * Simplify existing instrumentation * Remove unnecessary settings lookups * Client instrumentation * Add query and aggregation query instrumentation * Fix deprecation warning * Simplify collection lookup * Combine query test files * Rename methods for clarity * Instrument Firestore batching * Add transaction instrumentation * Consumer iterators on <=Py38 * Add async generator wrapper * Allow better parallelization in firestore tests * Fix issue in async generator wrapper * Add async client instrumentation * Squashed commit of the following: commit 9d411e0 Author: Tim Pansino <[email protected]> Date: Wed Jul 26 15:57:39 2023 -0700 Clean out unnecessary code commit cb550ba Author: Tim Pansino <[email protected]> Date: Wed Jul 26 14:27:01 2023 -0700 Allow better parallelization in firestore tests * Add async collection instrumentation * Add async document instrumentation * Async Query instrumentation * Add async batch instrumentation * Add instrumentation for AsyncTransaction * Squashed commit of the following: commit c836f8f Author: TimPansino <[email protected]> Date: Thu Jul 27 19:54:35 2023 +0000 [Mega-Linter] Apply linters fixes commit 02a55a1 Author: Tim Pansino <[email protected]> Date: Thu Jul 27 12:46:46 2023 -0700 Add collection group instrumentation commit ab1f4ff Author: Tim Pansino <[email protected]> Date: Thu Jul 27 12:00:33 2023 -0700 Better parallelization safeguards commit fa5f39a Author: TimPansino <[email protected]> Date: Wed Jul 26 22:59:11 2023 +0000 [Mega-Linter] Apply linters fixes commit 9d411e0 Author: Tim Pansino <[email protected]> Date: Wed Jul 26 15:57:39 2023 -0700 Clean out unnecessary code commit cb550ba Author: Tim Pansino <[email protected]> Date: Wed Jul 26 14:27:01 2023 -0700 Allow better parallelization in firestore tests * Remove reset_firestore * Re-merge of test_query * Use public API imports * Add async collection group instrumentation * Refactor exercise functions to fixtures * Squashed commit of the following: commit 09c5e11 Author: Tim Pansino <[email protected]> Date: Wed Aug 2 14:33:24 2023 -0700 Add testing for automatic and manual asyncwrappers commit fc3ef6b Author: Tim Pansino <[email protected]> Date: Wed Aug 2 14:33:05 2023 -0700 Add async wrapper argument to all trace APIs commit 479f9e2 Merge: faf3ccc edd1f94 Author: Tim Pansino <[email protected]> Date: Wed Aug 2 13:44:24 2023 -0700 Merge remote-tracking branch 'origin/develop-google-firestore-instrumentation' into feature-async-wrapper-argument commit edd1f94 Author: Timothy Pansino <[email protected]> Date: Wed Aug 2 13:40:51 2023 -0700 Async Generator Wrapper (#884) * Add async generator wrapper * Add no harm test * Remove anext calls * Add graphql traces to decorator testing * Remove pypy generator gc logic --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> commit faf3ccc Author: Tim Pansino <[email protected]> Date: Mon Jul 31 15:10:56 2023 -0700 Add async_wrapper to datastore_trace api * Remove custom wrapper code from firestore * Undo wrapper edits --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
adcee3f
commit e835758
Showing
11 changed files
with
788 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright 2010 New Relic, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import pytest | ||
|
||
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics | ||
from newrelic.api.background_task import background_task | ||
from testing_support.validators.validate_database_duration import ( | ||
validate_database_duration, | ||
) | ||
|
||
|
||
@pytest.fixture() | ||
def exercise_async_write_batch(async_client, async_collection): | ||
async def _exercise_async_write_batch(): | ||
docs = [async_collection.document(str(x)) for x in range(1, 4)] | ||
async_batch = async_client.batch() | ||
for doc in docs: | ||
async_batch.set(doc, {}) | ||
|
||
await async_batch.commit() | ||
return _exercise_async_write_batch | ||
|
||
|
||
def test_firestore_async_write_batch(loop, exercise_async_write_batch): | ||
_test_scoped_metrics = [ | ||
("Datastore/operation/Firestore/commit", 1), | ||
] | ||
|
||
_test_rollup_metrics = [ | ||
("Datastore/all", 1), | ||
("Datastore/allOther", 1), | ||
] | ||
@validate_database_duration() | ||
@validate_transaction_metrics( | ||
"test_firestore_async_write_batch", | ||
scoped_metrics=_test_scoped_metrics, | ||
rollup_metrics=_test_rollup_metrics, | ||
background_task=True, | ||
) | ||
@background_task(name="test_firestore_async_write_batch") | ||
def _test(): | ||
loop.run_until_complete(exercise_async_write_batch()) | ||
|
||
_test() |
Oops, something went wrong.