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

Update Metrics Exporter README #352

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ See [Tracing Readme](exporters/trace/README.md) for installation and usage instr

## Google Cloud Monitoring Exporter

*Note: This is an alpha-release.*

See [Metrics Readme](exporters/metrics/README.md) for installation and usage instructions.

## Google Cloud Autoconfigure module
Expand Down
19 changes: 13 additions & 6 deletions exporters/metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

[![Maven Central][maven-image]][maven-url]

*NOTE: While Opentelemetry Metrics API is stable, the SDK is still Alpha in OpenTelemetry, and this exporter is not guaranteed to work across versions.*

Opentelemetry Google Monitoring Metrics Exporter allows users to send collected metrics
to Google Cloud.

Expand All @@ -15,13 +13,21 @@ Google Cloud Monitoring is a managed service provided by Google Cloud Platform.

## Usage

TODO(jsuereth): Write this.

See [the code example](../../examples/metrics) for details.

## Authentication

TODO(jsuereth): Write this section.
If you are running in a GCP environment, the exporter will automatically authenticate using the environment's service account. If not, you will need to follow the instructions in Authentication.

This exporter uses [google-cloud-java](https://github.com/googleapis/google-cloud-java), which uses the [google-auth-library-java](https://github.com/googleapis/google-auth-library-java) for authentication. For details about how to configure the authentication see [here](https://github.com/googleapis/google-cloud-java#authentication).

If you prefer to manually set the credentials, they can be passed to the exporter using the [`setCredentials`](https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/blob/7a8dcf420f5551bf0df969f83928b18c443da5aa/exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricConfiguration.java) method:
```java
MetricConfiguration.builder()
.setCredentials(new GoogleCredentials(new AccessToken(accessToken, expirationTime)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something users might do? The access token is different from credential.

If they just want to point at an exported JSON service account cred, the client google auth lib should work with GOOGLE_APPLICATION_CREDENTIALS env

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is certainly a rare use-case. I'm documenting it here since it was also documented for trace exporter.

.setProjectId("MyProjectId")
.build();
```

## Configuration

Expand Down Expand Up @@ -73,7 +79,8 @@ MeterProvider provider = SdkMeterProvider.builder()
| deadline | ??? | ??? | The deadline limit on export calls to Cloud Monitoring API | 12 seconds |
| metricDescriptorStrategy | ??? | ??? | How to adapt OpenTelemetry metric definition into google cloud. `ALWAYS_SEND` will try to create metric descriptors on every export. `SEND_ONCE` will try to create metric descriptors once per Java instance/classloader. `NEVER_SEND` will rely on Cloud Monitoring's auto-generated MetricDescriptors from time series. | `SEND_ONCE` |


## Java Versions
Java 8 or above is required for using this exporter.

[maven-image]: https://img.shields.io/maven-central/v/com.google.cloud.opentelemetry/exporter-metrics?color=dark-green
[maven-url]: https://maven-badges.herokuapp.com/maven-central/com.google.cloud.opentelemetry/exporter-metrics
Loading