1# OpenCensus Examples 2 3## To build the examples use 4 5### Gradle 6``` 7$ ./gradlew installDist 8``` 9 10### Maven 11``` 12$ mvn package appassembler:assemble 13``` 14 15### Bazel 16``` 17$ bazel build :all 18``` 19 20## To run "TagContextExample" use 21 22### Gradle 23``` 24$ ./build/install/opencensus-examples/bin/TagContextExample 25``` 26 27### Maven 28``` 29$ ./target/appassembler/bin/TagContextExample 30``` 31 32### Bazel 33``` 34$ ./bazel-bin/TagContextExample 35``` 36 37## To run "ZPagesTester" 38 39### Gradle 40``` 41$ ./build/install/opencensus-examples/bin/ZPagesTester 42``` 43 44### Maven 45``` 46$ ./target/appassembler/bin/ZPagesTester 47``` 48 49### Bazel 50``` 51$ ./bazel-bin/ZPagesTester 52``` 53 54Available pages: 55* For tracing page go to [localhost:8080/tracez][ZPagesTraceZLink]. 56* For tracing config page go to [localhost:8080/traceconfigz][ZPagesTraceConfigZLink]. 57* For RPC stats page go to [localhost:8080/rpcz][ZPagesRpcZLink]. 58* For stats and measures on all registered views go to [localhost:8080/statsz][ZPagesStatsZLink]. 59 60[ZPagesTraceZLink]: http://localhost:8080/tracez 61[ZPagesTraceConfigZLink]: http://localhost:8080/traceconfigz 62[ZPagesRpcZLink]: http://localhost:8080/rpcz 63[ZPagesStatsZLink]: http://localhost:8080/statsz 64 65## To run "QuickStart" example use 66 67### Gradle 68``` 69$ ./build/install/opencensus-examples/bin/QuickStart 70``` 71 72### Maven 73``` 74$ ./target/appassembler/bin/QuickStart 75``` 76 77### Bazel 78``` 79$ ./bazel-bin/QuickStart 80``` 81 82## To run "gRPC Hello World" example use 83 84Please note all the arguments are optional. If you do not specify these arguments, default values 85will be used: 86 87* host and serverPort will be "localhost:50051" 88* user will be "world" 89* cloudProjectId will be null (which means no stats/spans will be exported to Stackdriver) 90* server zPagePort will be 3000 91* client zPagePort will be 3001 92* Prometheus port will be 9090 93 94 95However, if you want to specify any of these arguements, please make sure they are in order. 96 97### Gradle 98``` 99$ ./build/install/opencensus-examples/bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort 100$ ./build/install/opencensus-examples/bin/HelloWorldClient user host serverPort cloudProjectId zPagePort 101``` 102 103### Maven 104``` 105$ ./target/appassembler/bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort 106$ ./target/appassembler/bin/HelloWorldClient user host serverPort cloudProjectId zPagePort 107``` 108 109### Bazel 110``` 111$ ./bazel-bin/HelloWorldServer serverPort cloudProjectId zPagePort prometheusPort 112$ ./bazel-bin/HelloWorldClient user host serverPort cloudProjectId zPagePort 113``` 114