skywalking 0.0.0.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. checksums.yaml +7 -0
  2. data/.asf.yaml +40 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +236 -0
  5. data/CHANGELOG.md +15 -0
  6. data/CODE_OF_CONDUCT.md +132 -0
  7. data/LICENSE +201 -0
  8. data/NOTICE +5 -0
  9. data/README.md +18 -0
  10. data/Rakefile +23 -0
  11. data/docs/How-to-release.md +179 -0
  12. data/examples/rails-demo/.dockerignore +47 -0
  13. data/examples/rails-demo/.gitattributes +9 -0
  14. data/examples/rails-demo/.gitignore +34 -0
  15. data/examples/rails-demo/.kamal/hooks/docker-setup.sample +3 -0
  16. data/examples/rails-demo/.kamal/hooks/post-deploy.sample +14 -0
  17. data/examples/rails-demo/.kamal/hooks/post-proxy-reboot.sample +3 -0
  18. data/examples/rails-demo/.kamal/hooks/pre-build.sample +51 -0
  19. data/examples/rails-demo/.kamal/hooks/pre-connect.sample +47 -0
  20. data/examples/rails-demo/.kamal/hooks/pre-deploy.sample +109 -0
  21. data/examples/rails-demo/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  22. data/examples/rails-demo/.kamal/secrets +17 -0
  23. data/examples/rails-demo/.rubocop.yml +8 -0
  24. data/examples/rails-demo/.ruby-version +1 -0
  25. data/examples/rails-demo/Dockerfile +72 -0
  26. data/examples/rails-demo/Gemfile +64 -0
  27. data/examples/rails-demo/README.md +24 -0
  28. data/examples/rails-demo/Rakefile +6 -0
  29. data/examples/rails-demo/app/assets/images/.keep +0 -0
  30. data/examples/rails-demo/app/assets/stylesheets/application.css +10 -0
  31. data/examples/rails-demo/app/controllers/application_controller.rb +4 -0
  32. data/examples/rails-demo/app/controllers/concerns/.keep +0 -0
  33. data/examples/rails-demo/app/helpers/application_helper.rb +2 -0
  34. data/examples/rails-demo/app/javascript/application.js +3 -0
  35. data/examples/rails-demo/app/javascript/controllers/application.js +9 -0
  36. data/examples/rails-demo/app/javascript/controllers/hello_controller.js +7 -0
  37. data/examples/rails-demo/app/javascript/controllers/index.js +4 -0
  38. data/examples/rails-demo/app/jobs/application_job.rb +7 -0
  39. data/examples/rails-demo/app/mailers/application_mailer.rb +4 -0
  40. data/examples/rails-demo/app/models/application_record.rb +3 -0
  41. data/examples/rails-demo/app/models/concerns/.keep +0 -0
  42. data/examples/rails-demo/app/views/layouts/application.html.erb +28 -0
  43. data/examples/rails-demo/app/views/layouts/mailer.html.erb +13 -0
  44. data/examples/rails-demo/app/views/layouts/mailer.text.erb +1 -0
  45. data/examples/rails-demo/app/views/pwa/manifest.json.erb +22 -0
  46. data/examples/rails-demo/app/views/pwa/service-worker.js +26 -0
  47. data/examples/rails-demo/bin/brakeman +7 -0
  48. data/examples/rails-demo/bin/bundle +109 -0
  49. data/examples/rails-demo/bin/dev +2 -0
  50. data/examples/rails-demo/bin/docker-entrypoint +14 -0
  51. data/examples/rails-demo/bin/importmap +4 -0
  52. data/examples/rails-demo/bin/jobs +6 -0
  53. data/examples/rails-demo/bin/kamal +27 -0
  54. data/examples/rails-demo/bin/rails +4 -0
  55. data/examples/rails-demo/bin/rake +4 -0
  56. data/examples/rails-demo/bin/rubocop +8 -0
  57. data/examples/rails-demo/bin/setup +34 -0
  58. data/examples/rails-demo/bin/thrust +5 -0
  59. data/examples/rails-demo/config/application.rb +27 -0
  60. data/examples/rails-demo/config/boot.rb +4 -0
  61. data/examples/rails-demo/config/cable.yml +17 -0
  62. data/examples/rails-demo/config/cache.yml +16 -0
  63. data/examples/rails-demo/config/credentials.yml.enc +1 -0
  64. data/examples/rails-demo/config/database.yml +41 -0
  65. data/examples/rails-demo/config/deploy.yml +116 -0
  66. data/examples/rails-demo/config/environment.rb +5 -0
  67. data/examples/rails-demo/config/environments/development.rb +72 -0
  68. data/examples/rails-demo/config/environments/production.rb +90 -0
  69. data/examples/rails-demo/config/environments/test.rb +53 -0
  70. data/examples/rails-demo/config/importmap.rb +7 -0
  71. data/examples/rails-demo/config/initializers/assets.rb +7 -0
  72. data/examples/rails-demo/config/initializers/content_security_policy.rb +25 -0
  73. data/examples/rails-demo/config/initializers/filter_parameter_logging.rb +8 -0
  74. data/examples/rails-demo/config/initializers/inflections.rb +16 -0
  75. data/examples/rails-demo/config/initializers/skywalking_ruby.rb +18 -0
  76. data/examples/rails-demo/config/locales/en.yml +31 -0
  77. data/examples/rails-demo/config/puma.rb +41 -0
  78. data/examples/rails-demo/config/queue.yml +18 -0
  79. data/examples/rails-demo/config/recurring.yml +10 -0
  80. data/examples/rails-demo/config/routes.rb +14 -0
  81. data/examples/rails-demo/config/storage.yml +34 -0
  82. data/examples/rails-demo/config.ru +6 -0
  83. data/examples/rails-demo/db/cable_schema.rb +11 -0
  84. data/examples/rails-demo/db/cache_schema.rb +14 -0
  85. data/examples/rails-demo/db/queue_schema.rb +129 -0
  86. data/examples/rails-demo/db/seeds.rb +9 -0
  87. data/examples/rails-demo/lib/tasks/.keep +0 -0
  88. data/examples/rails-demo/log/.keep +0 -0
  89. data/examples/rails-demo/public/400.html +114 -0
  90. data/examples/rails-demo/public/404.html +114 -0
  91. data/examples/rails-demo/public/406-unsupported-browser.html +114 -0
  92. data/examples/rails-demo/public/422.html +114 -0
  93. data/examples/rails-demo/public/500.html +114 -0
  94. data/examples/rails-demo/public/icon.png +0 -0
  95. data/examples/rails-demo/public/icon.svg +3 -0
  96. data/examples/rails-demo/public/robots.txt +1 -0
  97. data/examples/rails-demo/script/.keep +0 -0
  98. data/examples/rails-demo/storage/.keep +0 -0
  99. data/examples/rails-demo/test/application_system_test_case.rb +5 -0
  100. data/examples/rails-demo/test/controllers/.keep +0 -0
  101. data/examples/rails-demo/test/fixtures/files/.keep +0 -0
  102. data/examples/rails-demo/test/helpers/.keep +0 -0
  103. data/examples/rails-demo/test/integration/.keep +0 -0
  104. data/examples/rails-demo/test/mailers/.keep +0 -0
  105. data/examples/rails-demo/test/models/.keep +0 -0
  106. data/examples/rails-demo/test/system/.keep +0 -0
  107. data/examples/rails-demo/test/test_helper.rb +15 -0
  108. data/examples/rails-demo/tmp/.keep +0 -0
  109. data/examples/rails-demo/tmp/pids/.keep +0 -0
  110. data/examples/rails-demo/tmp/storage/.keep +0 -0
  111. data/examples/rails-demo/vendor/.keep +0 -0
  112. data/examples/rails-demo/vendor/javascript/.keep +0 -0
  113. data/examples/sinatra-demo/sinatra-demo.rb +32 -0
  114. data/lib/skywalking/agent.rb +98 -0
  115. data/lib/skywalking/configuration.rb +255 -0
  116. data/lib/skywalking/environment.rb +50 -0
  117. data/lib/skywalking/log/logger.rb +53 -0
  118. data/lib/skywalking/plugins/redis5.rb +70 -0
  119. data/lib/skywalking/plugins/sinatra.rb +55 -0
  120. data/lib/skywalking/plugins_manager.rb +84 -0
  121. data/lib/skywalking/proto/asyncprofiler/AsyncProfiler_pb.rb +23 -0
  122. data/lib/skywalking/proto/asyncprofiler/AsyncProfiler_services_pb.rb +45 -0
  123. data/lib/skywalking/proto/browser/BrowserPerfCompat_pb.rb +15 -0
  124. data/lib/skywalking/proto/browser/BrowserPerfCompat_services_pb.rb +42 -0
  125. data/lib/skywalking/proto/browser/BrowserPerf_pb.rb +21 -0
  126. data/lib/skywalking/proto/browser/BrowserPerf_services_pb.rb +46 -0
  127. data/lib/skywalking/proto/common/Command_pb.rb +20 -0
  128. data/lib/skywalking/proto/common/Common_pb.rb +21 -0
  129. data/lib/skywalking/proto/ebpf/accesslog_pb.rb +58 -0
  130. data/lib/skywalking/proto/ebpf/accesslog_services_pb.rb +42 -0
  131. data/lib/skywalking/proto/event/Event_pb.rb +21 -0
  132. data/lib/skywalking/proto/event/Event_services_pb.rb +45 -0
  133. data/lib/skywalking/proto/language-agent/CLRMetricCompat_pb.rb +15 -0
  134. data/lib/skywalking/proto/language-agent/CLRMetricCompat_services_pb.rb +38 -0
  135. data/lib/skywalking/proto/language-agent/CLRMetric_pb.rb +23 -0
  136. data/lib/skywalking/proto/language-agent/CLRMetric_services_pb.rb +42 -0
  137. data/lib/skywalking/proto/language-agent/ConfigurationDiscoveryService_pb.rb +19 -0
  138. data/lib/skywalking/proto/language-agent/ConfigurationDiscoveryService_services_pb.rb +51 -0
  139. data/lib/skywalking/proto/language-agent/JVMMetricCompat_pb.rb +15 -0
  140. data/lib/skywalking/proto/language-agent/JVMMetricCompat_services_pb.rb +39 -0
  141. data/lib/skywalking/proto/language-agent/JVMMetric_pb.rb +28 -0
  142. data/lib/skywalking/proto/language-agent/JVMMetric_services_pb.rb +43 -0
  143. data/lib/skywalking/proto/language-agent/MeterCompat_pb.rb +15 -0
  144. data/lib/skywalking/proto/language-agent/MeterCompat_services_pb.rb +39 -0
  145. data/lib/skywalking/proto/language-agent/Meter_pb.rb +24 -0
  146. data/lib/skywalking/proto/language-agent/Meter_services_pb.rb +48 -0
  147. data/lib/skywalking/proto/language-agent/TracingCompat_pb.rb +15 -0
  148. data/lib/skywalking/proto/language-agent/TracingCompat_services_pb.rb +48 -0
  149. data/lib/skywalking/proto/language-agent/Tracing_pb.rb +31 -0
  150. data/lib/skywalking/proto/language-agent/Tracing_services_pb.rb +71 -0
  151. data/lib/skywalking/proto/logging/Logging_pb.rb +26 -0
  152. data/lib/skywalking/proto/logging/Logging_services_pb.rb +46 -0
  153. data/lib/skywalking/proto/management/ManagementCompat_pb.rb +15 -0
  154. data/lib/skywalking/proto/management/ManagementCompat_services_pb.rb +44 -0
  155. data/lib/skywalking/proto/management/Management_pb.rb +21 -0
  156. data/lib/skywalking/proto/management/Management_services_pb.rb +48 -0
  157. data/lib/skywalking/proto/profile/ProfileCompat_pb.rb +15 -0
  158. data/lib/skywalking/proto/profile/ProfileCompat_services_pb.rb +43 -0
  159. data/lib/skywalking/proto/profile/Profile_pb.rb +22 -0
  160. data/lib/skywalking/proto/profile/Profile_services_pb.rb +47 -0
  161. data/lib/skywalking/proto/service-mesh-probe/service-mesh_pb.rb +25 -0
  162. data/lib/skywalking/proto/service-mesh-probe/service-mesh_services_pb.rb +43 -0
  163. data/lib/skywalking/reporter/buffer_trigger.rb +108 -0
  164. data/lib/skywalking/reporter/client/grpc_client.rb +114 -0
  165. data/lib/skywalking/reporter/client/proto.rb +29 -0
  166. data/lib/skywalking/reporter/grpc.rb +46 -0
  167. data/lib/skywalking/reporter/protocol.rb +28 -0
  168. data/lib/skywalking/reporter/report.rb +82 -0
  169. data/lib/skywalking/reporter/scheduler.rb +158 -0
  170. data/lib/skywalking/tracing/carrier.rb +121 -0
  171. data/lib/skywalking/tracing/carrier_item.rb +27 -0
  172. data/lib/skywalking/tracing/constants.rb +49 -0
  173. data/lib/skywalking/tracing/entry_span.rb +48 -0
  174. data/lib/skywalking/tracing/exit_span.rb +53 -0
  175. data/lib/skywalking/tracing/ignored_context.rb +34 -0
  176. data/lib/skywalking/tracing/noop_span.rb +32 -0
  177. data/lib/skywalking/tracing/segment.rb +57 -0
  178. data/lib/skywalking/tracing/span.rb +111 -0
  179. data/lib/skywalking/tracing/span_context.rb +242 -0
  180. data/lib/skywalking/tracing/tag.rb +49 -0
  181. data/lib/skywalking/utils/id_gen.rb +30 -0
  182. data/lib/skywalking/version.rb +18 -0
  183. data/lib/skywalking.rb +36 -0
  184. metadata +340 -0
@@ -0,0 +1,114 @@
1
+ <!doctype html>
2
+
3
+ <html lang="en">
4
+
5
+ <head>
6
+
7
+ <title>We’re sorry, but something went wrong (500 Internal Server Error)</title>
8
+
9
+ <meta charset="utf-8">
10
+ <meta name="viewport" content="initial-scale=1, width=device-width">
11
+ <meta name="robots" content="noindex, nofollow">
12
+
13
+ <style>
14
+
15
+ *, *::before, *::after {
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ * {
20
+ margin: 0;
21
+ }
22
+
23
+ html {
24
+ font-size: 16px;
25
+ }
26
+
27
+ body {
28
+ background: #FFF;
29
+ color: #261B23;
30
+ display: grid;
31
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
+ font-size: clamp(1rem, 2.5vw, 2rem);
33
+ -webkit-font-smoothing: antialiased;
34
+ font-style: normal;
35
+ font-weight: 400;
36
+ letter-spacing: -0.0025em;
37
+ line-height: 1.4;
38
+ min-height: 100vh;
39
+ place-items: center;
40
+ text-rendering: optimizeLegibility;
41
+ -webkit-text-size-adjust: 100%;
42
+ }
43
+
44
+ a {
45
+ color: inherit;
46
+ font-weight: 700;
47
+ text-decoration: underline;
48
+ text-underline-offset: 0.0925em;
49
+ }
50
+
51
+ b, strong {
52
+ font-weight: 700;
53
+ }
54
+
55
+ i, em {
56
+ font-style: italic;
57
+ }
58
+
59
+ main {
60
+ display: grid;
61
+ gap: 1em;
62
+ padding: 2em;
63
+ place-items: center;
64
+ text-align: center;
65
+ }
66
+
67
+ main header {
68
+ width: min(100%, 12em);
69
+ }
70
+
71
+ main header svg {
72
+ height: auto;
73
+ max-width: 100%;
74
+ width: 100%;
75
+ }
76
+
77
+ main article {
78
+ width: min(100%, 30em);
79
+ }
80
+
81
+ main article p {
82
+ font-size: 75%;
83
+ }
84
+
85
+ main article br {
86
+
87
+ display: none;
88
+
89
+ @media(min-width: 48em) {
90
+ display: inline;
91
+ }
92
+
93
+ }
94
+
95
+ </style>
96
+
97
+ </head>
98
+
99
+ <body>
100
+
101
+ <!-- This file lives in public/500.html -->
102
+
103
+ <main>
104
+ <header>
105
+ <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m101.23 93.8427c-8.1103 0-15.4098 3.7849-19.7354 8.3813h-36.2269v-99.21891h103.8143v37.03791h-68.3984v24.8722c5.1366-2.7035 15.1396-5.9477 24.6014-5.9477 35.146 0 56.233 22.7094 56.233 55.4215 0 34.605-23.791 57.315-60.558 57.315-37.8492 0-61.64-22.169-63.8028-55.963h42.9857c1.0814 10.814 9.1919 19.195 21.6281 19.195 11.355 0 19.465-8.381 19.465-20.547 0-11.625-7.299-20.5463-20.006-20.5463zm138.833 77.8613c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m23.1377 68.9967v34.0033h-8.9162v-34.0033zm4.3157 34.0033v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm29.9913-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.5839v6.8671h5.2058v6.7564h-5.2058v8.307c0 1.9383.9415 2.769 2.6583 2.769.9414 0 1.9937-.2216 2.769-.5538v7.3654c-.9969.443-2.8798.775-4.8181.775-5.8703 0-9.1931-2.769-9.1931-9.0819zm32.3666-.1108h8.0301c-.8861 5.7597-5.2057 9.2487-11.6852 9.2487-7.6424 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.3165-13.0143 12.5159-13.0143 7.6424 0 11.9621 5.095 11.9621 12.5159v2.1598h-16.1156c.2769 2.9905 1.8275 4.5965 4.3196 4.5965 1.7722 0 3.1567-.7753 3.6551-2.4921zm-3.8212-10.0237c-2.0491 0-3.4336 1.2737-3.9874 3.5997h7.5317c-.1107-2.0491-1.3845-3.5997-3.5443-3.5997zm31.4299-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.599-.7753-2.382 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.381.443zm2.949 25.0318v-24.921h8.694v2.1598c1.385-1.5506 3.821-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.64v-14.2327c0-2.049-1.052-3.5443-3.267-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm50.371 0h-8.363v-1.274c-.83.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.433.7199-3.433 2.3813 0 1.7168 1.716 2.4367 3.433 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742-29.0191v35.997h-8.694v-35.997zm13.036 25.9178h9.248c.72 2.326 2.714 3.489 5.483 3.489 2.713 0 4.596-1.163 4.596-3.2674 0-1.6061-1.052-2.326-3.212-2.8244l-6.534-1.3845c-4.985-1.1076-8.751-3.7105-8.751-9.47 0-6.6456 5.538-11.0206 13.07-11.0206 8.307 0 13.014 4.5411 13.956 10.4114h-8.695c-.72-1.8829-2.27-3.3228-5.205-3.3228-2.548 0-4.265 1.1076-4.265 2.9905 0 1.4953 1.052 2.326 2.825 2.7137l6.645 1.5506c5.815 1.3845 9.027 4.5412 9.027 9.8023 0 6.9778-5.87 10.9654-13.291 10.9654-8.141 0-13.679-3.9322-14.897-10.6332zm46.509 1.3845h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm31.431-6.3134v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.382.443zm18.288 25.0318h-7.809l-9.47-24.921h8.861l4.763 14.288 4.652-14.288h8.528zm25.614-8.6947h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997zm31.43-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443zm13.703-8.9715h24.312v7.6424h-15.562v5.3165h14.232v7.4763h-14.232v5.8703h15.562v7.6978h-24.312zm44.667 8.9715v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm19.673 0v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm28.082-12.5713v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443z" fill="#d30001"/></svg>
106
+ </header>
107
+ <article>
108
+ <p><strong>We’re sorry, but something went wrong.</strong><br> If you’re the application owner check the logs for more information.</p>
109
+ </article>
110
+ </main>
111
+
112
+ </body>
113
+
114
+ </html>
Binary file
@@ -0,0 +1,3 @@
1
+ <svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="256" cy="256" r="256" fill="red"/>
3
+ </svg>
@@ -0,0 +1 @@
1
+ # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
5
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require_relative "../config/environment"
3
+ require "rails/test_help"
4
+
5
+ module ActiveSupport
6
+ class TestCase
7
+ # Run tests in parallel with specified workers
8
+ parallelize(workers: :number_of_processors)
9
+
10
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
11
+ fixtures :all
12
+
13
+ # Add more helper methods to be used by all tests here...
14
+ end
15
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,32 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://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
+ require 'sinatra'
17
+ require 'redis'
18
+
19
+ require_relative '../../lib/skywalking'
20
+ Skywalking.start
21
+
22
+ get '/sw' do
23
+ "Hello, SkyWalking!"
24
+ end
25
+
26
+ get '/hello/:name' do
27
+ redis = Redis.new(host: 'localhost', port: 6379)
28
+ redis.set('hello', 'world')
29
+ value = redis.get("hello")
30
+ puts "Value of 'hello': #{value}"
31
+ "Hello #{params[:name]}!"
32
+ end
@@ -0,0 +1,98 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://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
+ require_relative 'configuration'
17
+ require_relative 'environment'
18
+ require_relative 'plugins_manager'
19
+ require_relative 'reporter/report'
20
+ require_relative 'tracing/span_context'
21
+ require_relative 'tracing/carrier_item'
22
+ require_relative 'tracing/segment'
23
+ require_relative 'tracing/tag'
24
+
25
+ module Skywalking
26
+ # @api private
27
+ class Agent
28
+ LOCK = Mutex.new
29
+
30
+ class << self
31
+ def agent
32
+ defined?(@agent) && @agent
33
+ end
34
+
35
+ def start(config)
36
+ return @agent if @agent
37
+
38
+ LOCK.synchronize do
39
+ return @agent if @agent
40
+
41
+ config ||= {}
42
+ config = Configuration.new(config) unless config.is_a?(Configuration)
43
+
44
+ @agent = new(config.agent_config).start!
45
+ config.freeze
46
+ end
47
+ end
48
+
49
+ def stop
50
+ LOCK.synchronize do
51
+ return unless @agent
52
+
53
+ @agent&.shutdown
54
+ @agent = nil
55
+ end
56
+ end
57
+
58
+ def started?
59
+ !!(defined?(@agent) && @agent)
60
+ end
61
+
62
+ def config
63
+ @config ||= Configuration.new.agent_config
64
+ end
65
+ end
66
+
67
+ attr_reader :plugins, :logger, :reporter
68
+
69
+ def initialize(config)
70
+ @plugins = Plugins::PluginsManager.new(config)
71
+ @reporter = Reporter::Report.new(config)
72
+
73
+ add_shutdown_hook
74
+ end
75
+
76
+ def environment
77
+ @environment ||= Skywalking::Environment.instance
78
+ end
79
+
80
+ def start!
81
+ @plugins.init_plugins
82
+ @reporter.init_reporter
83
+ self
84
+ end
85
+
86
+ def shutdown
87
+ @reporter.stop
88
+ end
89
+
90
+ def add_shutdown_hook
91
+ return unless environment.shutdown_handler_supported?
92
+
93
+ at_exit do
94
+ shutdown
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,255 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://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
+ require 'yaml'
17
+ require 'logger'
18
+
19
+ module Skywalking
20
+ class Configuration
21
+ DEFAULTS = {
22
+ :service_name => {
23
+ type: :string,
24
+ default: 'Your_ApplicationName',
25
+ desc: 'The name of your awesome Ruby service'
26
+ },
27
+ :instance_name => {
28
+ type: :string,
29
+ default: 'Your_InstanceName',
30
+ desc: 'The name of this particular awesome Ruby service instance'
31
+ },
32
+ :collector_backend_service => {
33
+ type: :string,
34
+ default: '127.0.0.1:11800',
35
+ desc: 'Backend service addresses'
36
+ },
37
+ :config_file => {
38
+ type: :string,
39
+ default: '',
40
+ desc: 'The path to the config file'
41
+ },
42
+ :log_file => {
43
+ type: :string,
44
+ default: 'skywalking.log',
45
+ desc: 'The name of the log file'
46
+ },
47
+ :log_file_path => {
48
+ type: :string,
49
+ default: 'STDOUT',
50
+ desc: 'The path to the log file'
51
+ },
52
+ :log_level => {
53
+ type: :string,
54
+ default: 'info',
55
+ desc: 'The log level'
56
+ },
57
+ :disable_plugins => {
58
+ type: :string,
59
+ default: '',
60
+ desc: 'The plugins to disable'
61
+ },
62
+ :report_protocol => {
63
+ type: :string,
64
+ default: 'grpc',
65
+ desc: 'The protocol to use for reporting'
66
+ },
67
+ :re_ignore_operation => {
68
+ type: :string,
69
+ default: '',
70
+ desc: 'Ignore specific URL paths'
71
+ },
72
+ :namespace => {
73
+ type: :string,
74
+ default: '',
75
+ desc: 'The namespace of the service'
76
+ },
77
+ :instance_properties_json => {
78
+ type: :string,
79
+ default: '',
80
+ desc: 'A custom JSON string to be reported as service instance properties, e.g. `{"key": "value"}`'
81
+ },
82
+ :collector_heartbeat_period => {
83
+ type: :int,
84
+ default: 30,
85
+ desc: 'The agent will send heartbeat to OAP every `collector_heartbeat_period` seconds'
86
+ },
87
+ :properties_report_period_factor => {
88
+ type: :int,
89
+ default: 10,
90
+ desc: 'The agent will report service instance properties every
91
+ `collector_heartbeat_period * properties_report_period_factor` seconds'
92
+ },
93
+ :max_queue_size => {
94
+ type: :int,
95
+ default: 10000,
96
+ desc: 'The maximum queue size for reporting data'
97
+ },
98
+ }.freeze
99
+
100
+ # @api private
101
+ attr_reader :agent_config
102
+
103
+ def initialize(opts = {})
104
+ @agent_config = {}
105
+ initialize_config(opts)
106
+ end
107
+
108
+ def initialize_config(opts)
109
+ # from the default value
110
+ merge_config(DEFAULTS.transform_values { |v| v[:default] })
111
+ merge_config(opts)
112
+ # from the custom config file
113
+ merge_config(override_config_by_file)
114
+ merge_config(override_config_by_env)
115
+ end
116
+
117
+ def merge_config(new_config)
118
+ return if new_config.nil?
119
+
120
+ new_config.each do |k, v|
121
+ @agent_config[k.to_sym] = v
122
+ end
123
+ end
124
+
125
+ def override_config_by_file
126
+ config_yaml = @agent_config[:config_file]
127
+ return if config_yaml.nil? || config_yaml.empty?
128
+
129
+ unless File.exist?(config_yaml)
130
+ logger.warn "No config file found at #{config_yaml}"
131
+ return
132
+ end
133
+
134
+ error = nil
135
+ begin
136
+ raw_file = File.read(config_yaml)
137
+ erb_file = ERB.new(raw_file).result(binding)
138
+ loaded_yaml = if YAML.respond_to?(:unsafe_load)
139
+ YAML.unsafe_load(erb_file)
140
+ else
141
+ YAML.safe_load(erb_file, permitted_classes: [], permitted_symbols: [], aliases: true)
142
+ end
143
+ error = "Invalid format in config file" if loaded_yaml && !loaded_yaml.is_a?(Hash)
144
+ rescue Exception => e
145
+ error = e.message
146
+ logger.error "override config by file failed, error=%s", e.message
147
+ nil
148
+ end
149
+ raise StandardError, "Error loading config file: #{config_yaml} - #{error}" if error
150
+
151
+ loaded_yaml
152
+ end
153
+
154
+ def override_config_by_env
155
+ new_config = {}
156
+ DEFAULTS.each do |env_key, env_schema|
157
+ env_value = ENV.fetch(key_to_env_key(env_key), nil)
158
+ next if env_value.nil?
159
+
160
+ type = env_schema[:type]
161
+ case type
162
+ when :string
163
+ new_config[env_key] = env_value.to_s
164
+ when :bool
165
+ # rubocop:disable Performance/CollectionLiteralInLoop
166
+ new_config[env_key] = !%w[0 false].include?(env_value.strip.downcase)
167
+ # rubocop:enable Performance/CollectionLiteralInLoop
168
+ when :int
169
+ new_config[env_key] = env_value.to_s
170
+ else
171
+ env_value
172
+ end
173
+ end
174
+
175
+ new_config
176
+ end
177
+
178
+ def key_to_env_key(key)
179
+ 'SW_AGENT_' + key.to_s.upcase
180
+ end
181
+
182
+ def freeze
183
+ super
184
+ @agent_config.freeze
185
+ @agent_config.transform_values(&:freeze)
186
+
187
+ self
188
+ end
189
+
190
+ #####
191
+ # LOAD LOG
192
+ #####
193
+ def logger
194
+ @logger ||= Mutex.new.synchronize { get_logger }
195
+ end
196
+
197
+ def get_logger
198
+ return @logger if @logger
199
+
200
+ log_dest = log_destination
201
+ create_log(log_dest, get_log_level)
202
+ end
203
+
204
+ def create_log(log_dest, level)
205
+ if log_dest.is_a?(String)
206
+ log_dest = File.expand_path(out, Pathname.new(Dir.pwd).realpath)
207
+ FileUtils.mkdir_p(File.dirname(log_dest))
208
+ end
209
+
210
+ begin
211
+ logger = ::Logger.new(log_dest, progname: "Skywalking-Ruby", level: level)
212
+ logger.formatter = log_formatter
213
+
214
+ logger
215
+ rescue => e
216
+ logger = ::Logger.new($stdout, progname: "Skywalking-Ruby", level: level)
217
+ logger.warn "Create logger for file #{log_dest} failed, using standard out for logging error=#{e.message}"
218
+ end
219
+ end
220
+
221
+ def log_formatter
222
+ ->(severity, datetime, program, message) do
223
+ datetime = datetime.strftime("%Y-%m-%dT%H:%M:%S")
224
+ "[#{datetime}] - #{severity} - [#{program}] #{message}\n"
225
+ end
226
+ end
227
+
228
+ def log_destination
229
+ if stdout?
230
+ $stdout
231
+ elsif !agent_config[:log_file].nil?
232
+ agent_config[:log_file]
233
+ elsif !agent_config[:log_file_path].nil?
234
+ "#{agent_config[:log_file_path]}/skywalking.log"
235
+ else
236
+ $stdout
237
+ end
238
+ end
239
+
240
+ def get_log_level
241
+ case @agent_config[:log_level]
242
+ when "debug" then ::Logger::DEBUG
243
+ when "info" then ::Logger::INFO
244
+ when "warn" then ::Logger::WARN
245
+ when "error" then ::Logger::ERROR
246
+ when "fatal" then ::Logger::FATAL
247
+ else ::Logger::INFO
248
+ end
249
+ end
250
+
251
+ def stdout?
252
+ @agent_config[:log_file_path] == "STDOUT"
253
+ end
254
+ end
255
+ end
@@ -0,0 +1,50 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://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
+ require 'singleton'
17
+
18
+ module Skywalking
19
+ class Environment
20
+ include Singleton
21
+ include Log::Logging
22
+
23
+ def framework_info
24
+ @framework_info ||= generate_framework_info
25
+ end
26
+
27
+ def generate_framework_info
28
+ if defined?(::Rails::Application)
29
+ :rails
30
+ elsif defined?(::Sinatra::Base)
31
+ :sinatra
32
+ else
33
+ :ruby
34
+ end
35
+ end
36
+
37
+ def sinatra?
38
+ @framework_info = :sinatra
39
+ end
40
+
41
+ def shutdown_handler_supported?
42
+ if sinatra?
43
+ info "Shutdown handler not supported for Sinatra"
44
+ false
45
+ else
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,53 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://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
+ module Skywalking
17
+ module Log
18
+ module Logging
19
+ def info(msg, *args)
20
+ log(:info, msg, *args)
21
+ end
22
+
23
+ def debug(msg, *args)
24
+ log(:debug, msg, *args)
25
+ end
26
+
27
+ def warn(msg, *args)
28
+ log(:warn, msg, *args)
29
+ end
30
+
31
+ def error(msg, *args)
32
+ log(:error, msg, *args)
33
+ end
34
+
35
+ def log(level, msg, *args)
36
+ logger = Configuration.new.logger
37
+ if logger
38
+ if logger.respond_to?(level)
39
+ if args.empty?
40
+ logger.send(level, msg)
41
+ else
42
+ logger.send(level, format(msg, *args))
43
+ end
44
+ else
45
+ Kernel.warn("Unknown log level: #{level}")
46
+ end
47
+ end
48
+ rescue Exception => e
49
+ puts "log exception: #{e.message}"
50
+ end
51
+ end
52
+ end
53
+ end