skywalking agent

nodejs

https://github.com/apache/skywalking-nodejs

1
2
3
$ npm install --save skywalking-backend-js


client-js

1
2
npm install skywalking-client-js --save

import ClientMonitor from ‘skywalking-client-js’;

ClientMonitor.register({
collector: ‘https://oap.local.org',
service: ‘banyandb_ui’,
serviceVersion: ‘1.0.0’,
pagePath: location.pathname,
useFmp: true,
});

cors

Type Description Required Default Value
collector String In default, the collected data would be reported to current domain(/browser/perfData. Then, typically, we recommend you use a Gateway/proxy to redirect the data to the OAP(resthost:restport). If you set this, the data could be reported to another domain, NOTE the Cross-Origin Resource Sharing (CORS) issuse and solution. false -

nginx

1
2
3
4
5
http {
include conf.d/http/*.conf;
....

}
oap.conf
conf.d/http/oap.conf
server {
       listen       443 ssl;
       server_name  local.org  ~^([\w-]+)\.local\.org$;

ssl_certificate conf.d/ssl/local.org/local.org.server.crt; ssl_certificate_key conf.d/ssl/local.org/local.org.server.key;
ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on;

#允许请求域名 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CORS set $cors_origin $http_origin;

location / {

#preflight 预检 if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $cors_origin; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'X-Requested-With,Content-Type,Accept,Origin,Authorization'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Content-Type' 'text/plain charset=UTF-8'; add_header 'Content-Length' 0; return 204; }
proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#####server oap if ($http_host = 'oap.local.org') { add_header 'Access-Control-Allow-Origin' $cors_origin; add_header 'Access-Control-Allow-Credentials' "true"; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'X-Requested-With,Content-Type,Accept,Origin,Authorization'; proxy_pass http://localhost:12800; }
proxy_pass http://localhost;
} }

java

https://skywalking.apache.org/docs/skywalking-java/next/en/setup/service-agent/java-agent/readme/

1
2
3
java -javaagent:/path/to/skywalking-agent/skywalking-agent.jar -jar yourApp.jar

java -javaagent:/path/to/skywalking-agent/skywalking-agent.jar -cp org.xx.bootstrap.xx

docker

java.yaml
java.yaml
x-common: &common
  volumes:
    - /opt/java-agent:/java-agent

#environment 挂在common下面不行 x-env: &env JAVA_TOOL_OPTIONS: "-javaagent:/java-agent/skywalking-agent.jar" SW_AGENT_COLLECTOR_BACKEND_SERVICES: "local.org:11800"
services: ruoyi-gateway: container_name: ruoyi-gateway build: context: ./ruoyi/gateway dockerfile: dockerfile ports: - "8080:8080" <<: *common environment: <<: *env SW_AGENT_NAME: "ruoyi-gateway"
ruoyi-auth: container_name: ruoyi-auth build: context: ./ruoyi/auth dockerfile: dockerfile ports: - "9200:9200" <<: *common environment: <<: *env SW_AGENT_NAME: "ruoyi-auth"
ruoyi-modules-system: container_name: ruoyi-modules-system build: context: ./ruoyi/modules/system dockerfile: dockerfile ports: - "9201:9201" <<: *common environment: <<: *env SW_AGENT_NAME: "ruoyi-modules-system"

ruoyi-visual-monitor: container_name: ruoyi-visual-monitor build: context: ./ruoyi/visual/monitor dockerfile: dockerfile ports: - "9100:9100" <<: *common environment: <<: *env SW_AGENT_NAME: "ruoyi-visual-monitor"

sentinel-dashboard: container_name: sentinel-dashboard build: context: ./sentinel dockerfile: dockerfile ports: - "8718:8080" <<: *common environment: <<: *env SW_AGENT_NAME: ruoyi-sentinel-dashboard SERVER_PORT: 8080 CSP_SENTINEL_DASHBOARD_SERVER: localhost:8080 PROJECT_NAME: sentinel-dashboard command: ["--auth.username=admin", "--auth.password=cs123456"]

php

https://skywalking.apache.org/docs/skywalking-python/next/en/setup/cli/

点击打赏
文章目录
  1. 1. nodejs
  2. 2. client-js
    1. 2.1. cors
    2. 2.2. nginx
  3. 3. java
    1. 3.1. docker
  4. 4. php
载入天数...载入时分秒... ,