| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # This nginx.conf is designed and written for local dev environments |
| # It will use the blocking startup mode and console logging |
| worker_processes 1; |
| daemon off; |
| error_log /dev/stdout debug; |
| |
| events { |
| worker_connections 1024; |
| } |
| http { |
| lua_package_path "/usr/local/skywalking-nginx-lua/lib/?.lua;;"; |
| # Buffer represents the register inform and the queue of the finished segment |
| lua_shared_dict tracing_buffer 100m; |
| |
| # Init is the timer setter and keeper |
| # Setup an infinite loop timer to do register and trace report. |
| init_worker_by_lua_block { |
| local metadata_buffer = ngx.shared.tracing_buffer |
| |
| metadata_buffer:set('serviceName', 'e2e-test-with-mock-collector') |
| -- Instance means the number of Nginx deployment, does not mean the worker instances |
| metadata_buffer:set('serviceInstanceName', 'e2e-test-with-mock-collector-instanceA') |
| |
| require("skywalking.client"):startBackendTimer("http://${collector}:12800") |
| } |
| |
| server { |
| listen 8080; |
| |
| location /ingress { |
| default_type text/html; |
| |
| rewrite_by_lua_block { |
| require("skywalking.tracer"):start("e2e-test-with-mock-collector:upstream_ip:port") |
| } |
| |
| proxy_pass http://127.0.0.1:8080/tier2/lb; |
| |
| body_filter_by_lua_block { |
| require("skywalking.tracer"):finish() |
| } |
| |
| log_by_lua_block { |
| require("skywalking.tracer"):prepareForReport() |
| } |
| } |
| |
| location /tier2/lb { |
| default_type text/html; |
| |
| rewrite_by_lua_block { |
| require("skywalking.tracer"):start("e2e-test-with-mock-collector:upstream_ip2:port2") |
| } |
| |
| proxy_pass http://127.0.0.1:8080/backend; |
| |
| body_filter_by_lua_block { |
| require("skywalking.tracer"):finish() |
| } |
| |
| log_by_lua_block { |
| require("skywalking.tracer"):prepareForReport() |
| } |
| } |
| |
| location /backend { |
| proxy_pass http://${collector}:12800/receiveData; |
| } |
| } |
| } |