Skip to content

Commit

Permalink
Dockerize r3 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Superskyyy committed Jun 27, 2023
1 parent a8c5aeb commit acc3a3b
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 11 deletions.
8 changes: 7 additions & 1 deletion demo/Endpoint200_hard.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,10 @@ top1.abc.example.com.net.cn/api/v1/users/this-url-is-special-since-domain-hasdig
GET:/api/v2/users/1222222223/similar-to-these-single-occurrence-is-not-handled-correctly-will-be-handled-by-nltk!!!!!
/haha1
/haha2
/jdoia1
/jdoia1
HikariCP/Connection/getConnection
HikariCP/Connection/disconnect
HikariCP/Connection/close
ABC/123
ABC/456
ABC/789
67 changes: 67 additions & 0 deletions demo/crazy_endpoint_generator/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright 2023 SkyAPM org
#
# Licensed 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.

services:
oap:
container_name: oap
image: ghcr.io/apache/skywalking/oap
expose:
- 11800 # gRPC
- 12800 # HTTP
networks:
- manual
environment:
SW_CORE_ENABLE_ENDPOINT_NAME_GROUPING_BY_OPENAPI: "false"
SW_CORE_MAX_HTTP_URIS_NUMBER_PER_SVR: "3000"
SW_AI_PIPELINE_URI_RECOGNITION_SERVER_ADDR: "r3"
SW_AI_PIPELINE_URI_RECOGNITION_SERVER_PORT: "17128"
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/11800" ]
interval: 5s
timeout: 60s
retries: 120
ports:
- "12800:12800"
- "11800:11800"
depends_on:
r3:
condition: service_healthy

ui:
image: ghcr.io/apache/skywalking/ui
container_name: ui
depends_on:
oap:
condition: service_healthy
networks:
- manual
ports:
- "8080:8080"
environment:
SW_OAP_ADDRESS: "http://oap:12800"

r3:
build:
context: ../..
dockerfile: Dockerfile
image: r3:latest # Build from docker build . --tag r3 > docker run -d --name r3 -p 17128:17128 r3
container_name: r3
healthcheck:
test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/17128" ]
networks:
- manual
ports:
- "17128:17128"
networks:
manual:
9 changes: 6 additions & 3 deletions models/uri_drain/uri_drain.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ def get_template(self):
# or http(s)://user:password@www.domain.top_level_domain
# REASONING:: domain can only appear in the first two tokens, so whenever a dot appears, it must be a domain?
# Another part of domain handling is done in create_template when they are hiding behind http(s)://
if ':' in self.log_template_tokens[0]: # It's a URI scheme!
scheme = self.log_template_tokens[0]
first_token = self.log_template_tokens[0]
if ':' in first_token: # It's a URI scheme!
scheme = first_token
path = '/'.join(self.log_template_tokens[1:])
# TODO: put this into the config file
http_methods = ('OPTIONS', 'GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'TRACE', 'CONNECT')
Expand All @@ -40,9 +41,11 @@ def get_template(self):
template = f"{scheme}//{path}"

return template
elif first_token[0].isupper() or '.' in first_token: # It's something like HikariCP/Connection/getConnection
return '/'.join(self.log_template_tokens)
else:
template = '/'.join(self.log_template_tokens)
return f'{template}'
return f'/{template}'

def __str__(self):
# return f"ID={str(self.cluster_id).ljust(5)} : size={str(self.size).ljust(10)}: {self.get_template()}"
Expand Down
132 changes: 131 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ cachetools = "^5.3.1"
nltk = "^3.8.1"
inflect = "^6.0.4"
pytest = "^7.3.2"
apache-skywalking = "^1.0.1"
flask = "^2.3.2"




Expand Down
Loading

0 comments on commit acc3a3b

Please sign in to comment.