1+ /*
2+ * Copyright The OpenTelemetry Authors
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117'use strict' ;
218
319const api = require ( '@opentelemetry/api' ) ;
@@ -8,7 +24,10 @@ let tracer;
824if ( censusTracer ) {
925 tracer = require ( './tracer_census' ) ( ) ;
1026} else {
11- tracer = require ( './tracer' ) ( 'example-grpc-capitalize-client' , binaryPropagator ) ;
27+ tracer = require ( './tracer' ) (
28+ 'example-grpc-capitalize-client' ,
29+ binaryPropagator
30+ ) ;
1231}
1332
1433const path = require ( 'path' ) ;
@@ -27,7 +46,7 @@ const { Fetch } = grpc.load(PROTO_PATH).rpc;
2746function main ( ) {
2847 const client = new Fetch (
2948 'localhost:50051' ,
30- grpc . credentials . createInsecure ( ) ,
49+ grpc . credentials . createInsecure ( )
3150 ) ;
3251 const data = process . argv [ 2 ] || 'opentelemetry' ;
3352 console . log ( '> ' , data ) ;
@@ -41,15 +60,19 @@ function main() {
4160 // The process must live for at least the interval past any traces that
4261 // must be exported, or some risk being lost if they are recorded after the
4362 // last export.
44- console . log ( 'Sleeping 5 seconds before shutdown to ensure all records are flushed.' ) ;
45- setTimeout ( ( ) => { console . log ( 'Completed.' ) ; } , 5000 ) ;
63+ console . log (
64+ 'Sleeping 5 seconds before shutdown to ensure all records are flushed.'
65+ ) ;
66+ setTimeout ( ( ) => {
67+ console . log ( 'Completed.' ) ;
68+ } , 5000 ) ;
4669}
4770
4871/**
4972 * Makes the gRPC call wrapped in an OpenCensus-style span
5073 */
5174function capitalizeWithCensusTracing ( client , data ) {
52- tracer . startRootSpan ( { name : 'tutorialsClient.capitalize' } , ( rootSpan ) => {
75+ tracer . startRootSpan ( { name : 'tutorialsClient.capitalize' } , rootSpan => {
5376 client . capitalize ( { data : Buffer . from ( data ) } , ( err , response ) => {
5477 if ( err ) {
5578 console . log ( 'could not get grpc response' ) ;
0 commit comments