1

Google App Engine上でJavaアプリケーションを実行しており、Google Stackdriverで収集したエラーを処理する必要があります。Google Stackdriverのデータを消費してGAEのJavaクライアントでエラー報告

質問を私たちは、次のMaven依存関係として

<dependency> 
    <groupId>com.google.cloud</groupId> 
    <artifactId>google-cloud-errorreporting</artifactId> 
    <version>0.9.3-alpha</version> 
</dependency> 

を取得したAPI Java Client Library報告のStackdriverエラーを使用していくつかのコードを書きましたが、それはそう

Caused by: java.lang.SecurityException: Google App Engine does not support Runtime.addShutdownHook 
    at com.google.appengine.runtime.Request.process-d6bb19ff7906421f(Request.java) 
    at java.lang.Runtime.addShutdownHook(Runtime.java:45) 
    at com.google.common.util.concurrent.MoreExecutors$Application.addShutdownHook(MoreExecutors.java:223) 
    at com.google.common.util.concurrent.MoreExecutors$Application.addDelayedShutdownHook(MoreExecutors.java:195) 
    at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:187) 
    at com.google.common.util.concurrent.MoreExecutors$Application.getExitingScheduledExecutorService(MoreExecutors.java:219) 
    at com.google.common.util.concurrent.MoreExecutors.getExitingScheduledExecutorService(MoreExecutors.java:169) 
    at com.google.api.gax.grpc.InstantiatingExecutorProvider.getExecutor(InstantiatingExecutorProvider.java:51) 
    at com.google.api.gax.grpc.ChannelAndExecutor.create(ChannelAndExecutor.java:62) 
    at com.google.api.gax.grpc.ClientSettings.getChannelAndExecutor(ClientSettings.java:81) 
    at com.google.cloud.errorreporting.spi.v1beta1.ErrorStatsServiceClient.<init>(ErrorStatsServiceClient.java:133) 
    at com.google.cloud.errorreporting.spi.v1beta1.ErrorStatsServiceClient.create(ErrorStatsServiceClient.java:123) 
    at com.google.cloud.errorreporting.spi.v1beta1.ErrorStatsServiceClient.create(ErrorStatsServiceClient.java:114) 
    at com.acme.gcp.errors.App.processErrorStats(App.java:39) 

のために文句を言うようでは、GAEに対応していないようです:Google HTTPクライアント経由でREST APIからデータを取得する以外に、GAEのGoogle Stackdriverエラーを使用する方法はありますか?

UPDATE

エラーにかかわらず、これまで試みserviceClient構成生じます。このすなわち

はエラーにつながるの設定の試みの一つである:https://github.com/GoogleCloudPlatform/google-cloud-java/issues/1490#issuecomment-283597294

+0

このドキュメントによれば、https://cloud.google.com/error-reporting/docs/ Google App Engine標準環境と柔軟な環境の両方でStackdriverエラーレポートを使用できます。 –

+0

@BravinBalasubramaniam実際にはうまくいくはずです...おそらく、適切なエグゼキュータ(GAE互換性)を設定するだけの問題かもしれません。 –

答えて

0

私たちは、スタック、ドライバのエラー報告のためのJava APIを提供するGoogleからの別のライブラリを使用して終了:

<dependency> 
    <groupId>com.google.apis</groupId> 
    <artifactId>google-api-services-clouderrorreporting</artifactId> 
    <version>v1beta1-rev260-1.22.0</version> 
</dependency> 

それが適切に認証資格情報を設定する必要があります。 実際、GAEの外部で実行されるように、RESTサービス(gRPCなし)へのHTTPコールは実際に発行されます。

0

のJava gRPCクライアントでのJava gRPC GAEの互換性のために問題があり

ErrorStatsServiceSettings errorStatsServiceSettings = ErrorStatsServiceSettings 
    .defaultBuilder() 
    .deleteEventsSettings() 
    .getRetrySettingsBuilder() 
    .setTotalTimeout(Duration.standardSeconds(30)) 
    .build(); 
ErrorStatsServiceClient.create(errorStatsServiceSettings); //error arising here 

アップデート2

行いますApp Engine標準環境ではまだ動作していません。もちろんこれは最終的には修正する必要があります。

一方、RESTベースのAPIを使用するか、Javaに拘束されていない場合は、(同じクラウドプロジェクト内にある)小さなGoベースのアプリケーションを実装してエラーを取得しますレポートを作成したり、保存したり、タスクキューを介してJavaアプリに渡したりすることができます。

+0

go-basedアプリがエラーレポートデータにアクセスできることを意味しますか?それでもgRPCを使用していますか? (おそらくサポートはhttps://github.com/grpc/grpc-go/issues/216で追跡されているかもしれません) とにかく、別のプロジェクトからのエラー報告データを取得できますか? –

関連する問題