Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

75 рядки
1.9 KiB

  1. // Copyright 2018, OpenCensus Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package jaeger_test
  15. import (
  16. "log"
  17. "go.opencensus.io/exporter/jaeger"
  18. "go.opencensus.io/trace"
  19. )
  20. func ExampleNewExporter_collector() {
  21. // Register the Jaeger exporter to be able to retrieve
  22. // the collected spans.
  23. exporter, err := jaeger.NewExporter(jaeger.Options{
  24. Endpoint: "http://localhost:14268",
  25. Process: jaeger.Process{
  26. ServiceName: "trace-demo",
  27. },
  28. })
  29. if err != nil {
  30. log.Fatal(err)
  31. }
  32. trace.RegisterExporter(exporter)
  33. }
  34. func ExampleNewExporter_agent() {
  35. // Register the Jaeger exporter to be able to retrieve
  36. // the collected spans.
  37. exporter, err := jaeger.NewExporter(jaeger.Options{
  38. AgentEndpoint: "localhost:6831",
  39. Process: jaeger.Process{
  40. ServiceName: "trace-demo",
  41. },
  42. })
  43. if err != nil {
  44. log.Fatal(err)
  45. }
  46. trace.RegisterExporter(exporter)
  47. }
  48. // ExampleNewExporter_processTags shows how to set ProcessTags
  49. // on a Jaeger exporter. These tags will be added to the exported
  50. // Jaeger process.
  51. func ExampleNewExporter_processTags() {
  52. // Register the Jaeger exporter to be able to retrieve
  53. // the collected spans.
  54. exporter, err := jaeger.NewExporter(jaeger.Options{
  55. AgentEndpoint: "localhost:6831",
  56. Process: jaeger.Process{
  57. ServiceName: "trace-demo",
  58. Tags: []jaeger.Tag{
  59. jaeger.StringTag("ip", "127.0.0.1"),
  60. jaeger.BoolTag("demo", true),
  61. },
  62. },
  63. })
  64. if err != nil {
  65. log.Fatal(err)
  66. }
  67. trace.RegisterExporter(exporter)
  68. }