@ SuppressWarnings ( "nullness" ) public static void createAndRegister ( ElasticsearchTraceConfiguration elasticsearchTraceConfiguration ) throws MalformedURLException { synchronized ( monitor ) { Preconditions . checkState ( handler == null , "Elasticsearch exporter already registered." ) ; Preconditions . checkArgument ( elasticsearchTraceConfiguration != null , "Elasticsearch " + "configuration not set." ) ; Preconditions . checkArgument ( elasticsearchTraceConfiguration . getElasticsearchIndex ( ) != null , "Elasticsearch index not specified" ) ; Preconditions . checkArgument ( elasticsearchTraceConfiguration . getElasticsearchType ( ) != null , "Elasticsearch type not specified" ) ; Preconditions . checkArgument ( elasticsearchTraceConfiguration . getElasticsearchUrl ( ) != null , "Elasticsearch URL not specified" ) ; handler = new ElasticsearchTraceHandler ( elasticsearchTraceConfiguration ) ; register ( Tracing . getExportComponent ( ) . getSpanExporter ( ) , handler ) ; } }
Creates and registers the ElasticsearchTraceExporter to the OpenCensus .