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

feat: Introducing Tracing with OpenTelemetry API #1537 #1576

Merged
merged 39 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4a480c9
feat: Adding TraceUtil interface and its implementation to enable Tra…
jimit-j-shah May 8, 2024
762d126
feat: Adding Lookup RPC OpenTelemetry Tracing (#1437)
jimit-j-shah May 15, 2024
052adf7
feat: Adding Commit RPC Trace Instrumentation (#1440)
jimit-j-shah May 20, 2024
f29a1cd
feat: RunQuery trace instrumentation (#1441)
jimit-j-shah May 23, 2024
931e69c
feat: RunAggregationQuery instrumentation (#1447)
jimit-j-shah May 23, 2024
d40e9e3
feat: RunQuery trace instrumentation
jimit-j-shah May 15, 2024
f981126
Formatting
jimit-j-shah May 15, 2024
c38420f
Formatting
jimit-j-shah May 15, 2024
43fb599
Refactor: s/RUNQUERY/RUN_QUERY
jimit-j-shah May 16, 2024
f2999de
feat: RunAggregationQuery Trace Instrumentation
jimit-j-shah May 16, 2024
e2ca649
Build: retiring test assertions for OpenCensus spans - will be replac…
jimit-j-shah May 16, 2024
6dec8c5
Formatting
jimit-j-shah May 17, 2024
b3a1506
Fixing @Test annotation missed after merge
jimit-j-shah May 20, 2024
67099d5
Formatting
jimit-j-shah May 20, 2024
895f615
feat: Add Transaction tracing
jimit-j-shah May 21, 2024
8c03ba6
test: Transaction test for RunInTransaction - need to fix trace instr…
jimit-j-shah May 21, 2024
20c1a54
Adding transaction span names
jimit-j-shah May 23, 2024
2ed509b
TransactionLookupTest
jimit-j-shah May 23, 2024
6e1a8cc
feat: support for transactional operations
jimit-j-shah May 30, 2024
5f56b06
Revert "feat: support for transactional operations"
jimit-j-shah May 30, 2024
5249bd9
feat: support for transactional operations (#1468)
jimit-j-shah Jun 7, 2024
0abf298
feat: Allocateid tracing (#1488)
jimit-j-shah Jun 19, 2024
6af5223
feat: Add tracing for ReserveIds operation (#1490)
jimit-j-shah Jun 25, 2024
d02d959
fix: Fixed Span nesting for `ReadWriteTransactionCallable` by using p…
jimit-j-shah Jun 27, 2024
45da20b
test: Additional Transaction Testing and cleanup OpenCensus usage (#1…
jimit-j-shah Jul 2, 2024
db41656
test: Adding ITTracingTest to verify events and span attributes (whic…
jimit-j-shah Jul 10, 2024
9672e7b
test: Additional Transaction tests and AggregationQuery test (#1518)
jimit-j-shah Jul 19, 2024
f13184e
fix: Undelete gRPC upgrade docs
jimit-j-shah Aug 5, 2024
520e351
fix: Undo merge mistakes
jimit-j-shah Aug 5, 2024
acf19d4
fix: Updating span event strings (#1539)
jimit-j-shah Aug 6, 2024
d903850
Fix: typo in test causing integration test failure (#1556)
jimit-j-shah Sep 4, 2024
83ce822
fix: opentelemetry-sdk should only be used as a Test Dependency
jimit-j-shah Sep 16, 2024
45541d3
fix: Update opentelemetry.version - this also fixes the tests failing…
jimit-j-shah Sep 16, 2024
da943a1
fix: Replacing attribute key values w/ constants
jimit-j-shah Sep 16, 2024
7b0b45c
fix: opentelemetry.version to fix RequireUpperBoundDeps check https:/…
jimit-j-shah Sep 16, 2024
e4b4af0
fix: Create Span hierarchy using parent Span (#1580)
jimit-j-shah Sep 19, 2024
d2e2680
fix: formatting and import refactoring
jimit-j-shah Sep 19, 2024
a1adb66
Merge branch 'main' into tracing-main-4
jimit-j-shah Sep 19, 2024
e0d3ba9
chore: generate libraries at Thu Sep 19 18:35:54 UTC 2024
cloud-java-bot Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.45.0</version>
<version>26.40.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -50,20 +50,20 @@ If you are using Maven without the BOM, add this to your dependencies:
If you are using Gradle 5.x or later, add this to your dependencies:

```Groovy
implementation platform('com.google.cloud:libraries-bom:26.45.0')
implementation platform('com.google.cloud:libraries-bom:26.40.0')

implementation 'com.google.cloud:google-cloud-datastore'
```
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-datastore:2.21.2'
implementation 'com.google.cloud:google-cloud-datastore:2.20.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.21.2"
libraryDependencies += "com.google.cloud" % "google-cloud-datastore" % "2.20.0"
```
<!-- {x-version-update-end} -->

Expand All @@ -80,7 +80,7 @@ The client application making API calls must be granted [authorization scopes][a
### Prerequisites

You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Datastore [API enabled][enable-api].
You will need to [enable billing][enable-billing] to use Google Cloud Datastore.

[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by
[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line:
`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`.
Expand All @@ -93,7 +93,11 @@ to add `google-cloud-datastore` as a dependency in your code.
## About Cloud Datastore


[Cloud Datastore][product-docs] is a fully managed, schemaless database for\nstoring non-relational data. Cloud Datastore automatically scales with\nyour users and supports ACID transactions, high availability of reads and\nwrites, strong consistency for reads and ancestor queries, and eventual\nconsistency for all other queries.
[Cloud Datastore][product-docs] is a fully managed, schemaless database for
storing non-relational data. Cloud Datastore automatically scales with
your users and supports ACID transactions, high availability of reads and
writes, strong consistency for reads and ancestor queries, and eventual
consistency for all other queries.

See the [Cloud Datastore client library docs][javadocs] to learn how to
use this Cloud Datastore Client Library.
Expand Down Expand Up @@ -282,7 +286,7 @@ boolean isHTTP = datastore.getOptions().getTransportOptions() instanceof HTTPTra
There are new gRPC specific features available to use in this update.

##### Channel Pooling
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
To customize the number of channels your client uses, you can update the channel provider in the DatastoreOptions.
See [ChannelPoolSettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.grpc.ChannelPoolSettings) and [Performance Best Practices](https://grpc.io/docs/guides/performance/) for more information on channel pools and best practices for performance.

Example:
Expand Down Expand Up @@ -352,6 +356,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-datastore/tre

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Native Image Datastore Sample | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/native-image-sample/src/main/java/com/example/datastore/NativeImageDatastoreSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/native-image-sample/src/main/java/com/example/datastore/NativeImageDatastoreSample.java) |
| Quickstart Sample | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/QuickstartSample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/QuickstartSample.java) |
| Avg Aggregation On Kind | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/aggregation/AvgAggregationOnKind.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/aggregation/AvgAggregationOnKind.java) |
| Avg Aggregation With Limit | [source code](https://github.com/googleapis/java-datastore/blob/main/samples/snippets/src/main/java/com/example/datastore/aggregation/AvgAggregationWithLimit.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-datastore&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/datastore/aggregation/AvgAggregationWithLimit.java) |
Expand Down Expand Up @@ -383,10 +388,6 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-datastore/tre

To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting].

## Transport

Cloud Datastore uses both gRPC and HTTP/JSON for the transport layer.

## Supported Java Versions

Java 8 or above is required for using this client.
Expand Down Expand Up @@ -479,7 +480,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-datastore/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datastore.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.21.2
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-datastore/2.20.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand All @@ -491,7 +492,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[contributing]: https://github.com/googleapis/java-datastore/blob/main/CONTRIBUTING.md
[code-of-conduct]: https://github.com/googleapis/java-datastore/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[license]: https://github.com/googleapis/java-datastore/blob/main/LICENSE
[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing

[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=datastore.googleapis.com
[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
Expand Down
12 changes: 12 additions & 0 deletions google-cloud-datastore/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,16 @@
<method>java.lang.Object execute(com.google.cloud.datastore.Query, com.google.cloud.datastore.ReadOption[])</method>
<differenceType>7004</differenceType>
</difference>
<difference>
<className>com/google/cloud/datastore/RetryAndTraceDatastoreRpcDecorator</className>
<method>RetryAndTraceDatastoreRpcDecorator(com.google.cloud.datastore.spi.v1.DatastoreRpc, com.google.cloud.datastore.TraceUtil, com.google.api.gax.retrying.RetrySettings, com.google.cloud.datastore.DatastoreOptions)</method>
<to>RetryAndTraceDatastoreRpcDecorator(com.google.cloud.datastore.spi.v1.DatastoreRpc, com.google.cloud.datastore.telemetry.TraceUtil, com.google.api.gax.retrying.RetrySettings, com.google.cloud.datastore.DatastoreOptions)</to>
<differenceType>7005</differenceType>
</difference>

<!-- Class removed -->
<difference>
<className>com/google/cloud/datastore/TraceUtil</className>
<differenceType>8001</differenceType>
</difference>
</differences>
86 changes: 85 additions & 1 deletion google-cloud-datastore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,20 @@
</parent>
<properties>
<site.installationModule>google-cloud-datastore</site.installationModule>
<opentelemetry.version>1.42.0</opentelemetry.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<!-- Artifacts from google-cloud-java monorepo -->
<groupId>com.google.cloud</groupId>
<artifactId>gapic-libraries-bom</artifactId>
<version>1.37.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.api.grpc</groupId>
Expand All @@ -38,6 +51,10 @@
<groupId>com.google.cloud.datastore</groupId>
<artifactId>datastore-v1-proto-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-credentials</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
Expand Down Expand Up @@ -111,14 +128,26 @@
<artifactId>jsr305</artifactId>
</dependency>

<!-- OpenTelemetry -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-context</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<!-- END OpenTelemetry -->

<!-- Test dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>google-cloud-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-testlib</artifactId>
Expand Down Expand Up @@ -160,6 +189,61 @@
<version>1.4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.testparameterinjector</groupId>
<artifactId>test-parameter-injector</artifactId>
<version>1.16</version>
<scope>test</scope>
</dependency>
<!-- OpenTelemetry -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-common</artifactId>
<version>${opentelemetry.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
<version>${opentelemetry.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-trace</artifactId>
<version>${opentelemetry.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-semconv</artifactId>
<version>1.1.0-alpha</version>
<scope>test</scope>
</dependency>
<!-- END OpenTelemetry -->
<!-- Cloud Ops -->
<dependency>
<groupId>com.google.cloud.opentelemetry</groupId>
<artifactId>exporter-trace</artifactId>
<version>0.15.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-trace</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-cloud-trace-v1</artifactId>
<scope>test</scope>
</dependency>
<!-- END Cloud Ops -->
</dependencies>

<build>
Expand Down
Loading
Loading