mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2024-12-20 05:37:56 +00:00
attempt to lower opensearch usage
This commit is contained in:
parent
4e950ec12f
commit
7ba60bf4eb
@ -85,14 +85,14 @@ def get_sondes(event, context):
|
||||
def get_telem(event, context):
|
||||
|
||||
durations = { # ideally we shouldn't need to predefine these, but it's a shit load of data and we don't need want to overload ES
|
||||
"3d": (259200, 1200), # 3d, 20m
|
||||
"1d": (86400, 600), # 1d, 10m
|
||||
"12h": (43200, 600), # 1d, 10m
|
||||
"6h": (21600, 120), # 6h, 1m
|
||||
"3h": (10800, 60), # 3h, 10s
|
||||
"1h": (3600, 40),
|
||||
"30m": (1800, 20),
|
||||
"1m": (60, 1),
|
||||
"3d": (259200, 1200),
|
||||
"1d": (86400, 600),
|
||||
"12h": (43200, 600),
|
||||
"6h": (21600, 240),
|
||||
"3h": (10800, 120),
|
||||
"1h": (3600, 60),
|
||||
"30m": (1800, 30),
|
||||
"1m": (60, 5),
|
||||
"15s": (15, 1),
|
||||
"0": (0, 1) # for getting a single time point
|
||||
}
|
||||
@ -130,7 +130,6 @@ def get_telem(event, context):
|
||||
"2": {
|
||||
"terms": {
|
||||
"field": "serial.keyword",
|
||||
"order": {"_key": "desc"},
|
||||
"size": 10000,
|
||||
},
|
||||
"aggs": {
|
||||
@ -143,12 +142,6 @@ def get_telem(event, context):
|
||||
"aggs": {
|
||||
"1": {
|
||||
"top_hits": {
|
||||
# "docvalue_fields": [
|
||||
# {"field": "position"},
|
||||
# {"field": "alt"},
|
||||
# {"field": "datetime"},
|
||||
# ],
|
||||
# "_source": "position",
|
||||
"size": 10 if (duration == 0 ) else 1,
|
||||
"sort": [
|
||||
{"datetime": {"order": "desc"}},
|
||||
@ -163,7 +156,6 @@ def get_telem(event, context):
|
||||
},
|
||||
"query": {
|
||||
"bool": {
|
||||
"must_not": [{"match_phrase": {"software_name": "SondehubV1"}}, {"match_phrase": {"serial": "xxxxxxxx"}}],
|
||||
"filter": [
|
||||
{"match_all": {}},
|
||||
{
|
||||
|
@ -1,49 +1,49 @@
|
||||
from . import *
|
||||
|
||||
#print(get_listener_telemetry({"queryStringParameters":{}}, {}))
|
||||
print(telm_stats({
|
||||
"version": "2.0",
|
||||
"routeKey": "GET /sondes",
|
||||
"rawPath": "/sondes",
|
||||
"rawQueryString": "lat=49.827648&lon=6.106842&distance=400000&last=-60",
|
||||
"headers": {
|
||||
"cache-control": "no-cache",
|
||||
"content-length": "0",
|
||||
"host": "api-raw.v2.sondehub.org",
|
||||
"user-agent": "Amazon CloudFront",
|
||||
"via": "1.1 ee4db0d243ceb0d1993e5f46ad6c0f01.cloudfront.net (CloudFront)",
|
||||
"x-amz-cf-id": "KF68O6r-OP5oTosFLdix7-RWM6xeW08ZF48fgvwLkj9f3s4fJuCFKg==",
|
||||
"x-amzn-trace-id": "Root=1-61d14df5-0f9dbfe563e89f170e65a3bf",
|
||||
"x-forwarded-for": "94.252.35.58, 64.252.86.150",
|
||||
"x-forwarded-port": "443",
|
||||
"x-forwarded-proto": "https"
|
||||
},
|
||||
"queryStringParameters": {
|
||||
"distance": "400000",
|
||||
"last": "-60",
|
||||
"lat": "49.827648",
|
||||
"lon": "6.106842"
|
||||
},
|
||||
"requestContext": {
|
||||
"accountId": "143841941773",
|
||||
"apiId": "r03szwwq41",
|
||||
"domainName": "api-raw.v2.sondehub.org",
|
||||
"domainPrefix": "api-raw",
|
||||
"http": {
|
||||
"method": "GET",
|
||||
"path": "/sondes",
|
||||
"protocol": "HTTP/1.1",
|
||||
"sourceIp": "94.252.35.58",
|
||||
"userAgent": "Amazon CloudFront"
|
||||
},
|
||||
"requestId": "LTkeXjgXIAMEVzw=",
|
||||
"routeKey": "GET /sondes",
|
||||
"stage": "$default",
|
||||
"time": "02/Jan/2022:07:02:13 +0000",
|
||||
"timeEpoch": 1641106933368
|
||||
},
|
||||
"isBase64Encoded": False
|
||||
}, None))
|
||||
# print(telm_stats({
|
||||
# "version": "2.0",
|
||||
# "routeKey": "GET /sondes",
|
||||
# "rawPath": "/sondes",
|
||||
# "rawQueryString": "lat=49.827648&lon=6.106842&distance=400000&last=-60",
|
||||
# "headers": {
|
||||
# "cache-control": "no-cache",
|
||||
# "content-length": "0",
|
||||
# "host": "api-raw.v2.sondehub.org",
|
||||
# "user-agent": "Amazon CloudFront",
|
||||
# "via": "1.1 ee4db0d243ceb0d1993e5f46ad6c0f01.cloudfront.net (CloudFront)",
|
||||
# "x-amz-cf-id": "KF68O6r-OP5oTosFLdix7-RWM6xeW08ZF48fgvwLkj9f3s4fJuCFKg==",
|
||||
# "x-amzn-trace-id": "Root=1-61d14df5-0f9dbfe563e89f170e65a3bf",
|
||||
# "x-forwarded-for": "94.252.35.58, 64.252.86.150",
|
||||
# "x-forwarded-port": "443",
|
||||
# "x-forwarded-proto": "https"
|
||||
# },
|
||||
# "queryStringParameters": {
|
||||
# "distance": "400000",
|
||||
# "last": "-60",
|
||||
# "lat": "49.827648",
|
||||
# "lon": "6.106842"
|
||||
# },
|
||||
# "requestContext": {
|
||||
# "accountId": "143841941773",
|
||||
# "apiId": "r03szwwq41",
|
||||
# "domainName": "api-raw.v2.sondehub.org",
|
||||
# "domainPrefix": "api-raw",
|
||||
# "http": {
|
||||
# "method": "GET",
|
||||
# "path": "/sondes",
|
||||
# "protocol": "HTTP/1.1",
|
||||
# "sourceIp": "94.252.35.58",
|
||||
# "userAgent": "Amazon CloudFront"
|
||||
# },
|
||||
# "requestId": "LTkeXjgXIAMEVzw=",
|
||||
# "routeKey": "GET /sondes",
|
||||
# "stage": "$default",
|
||||
# "time": "02/Jan/2022:07:02:13 +0000",
|
||||
# "timeEpoch": 1641106933368
|
||||
# },
|
||||
# "isBase64Encoded": False
|
||||
# }, None))
|
||||
# mode: 6hours
|
||||
# type: positions
|
||||
# format: json
|
||||
@ -63,16 +63,23 @@ print(telm_stats({
|
||||
# )
|
||||
# )
|
||||
# print(get_sites({},{}))
|
||||
# print(
|
||||
# get_telem(
|
||||
# {
|
||||
# "queryStringParameters": {
|
||||
# "duration": "1d",
|
||||
# # "serial": "S4430086"
|
||||
# }},{}
|
||||
|
||||
# )
|
||||
# )
|
||||
a=get_telem(
|
||||
{
|
||||
"queryStringParameters": {
|
||||
"duration": "3h",
|
||||
# "serial": "S4430086"
|
||||
}},{}
|
||||
|
||||
)
|
||||
b=get_telem(
|
||||
{
|
||||
"queryStringParameters": {
|
||||
"duration": "3h",
|
||||
"serial": "5C3A7D72"
|
||||
}},{}
|
||||
|
||||
)
|
||||
# print (
|
||||
# get_chase(
|
||||
# {"queryStringParameters": {
|
||||
|
@ -343,9 +343,9 @@ resource "aws_ecs_task_definition" "ws_reader_ec2" {
|
||||
},
|
||||
]
|
||||
)
|
||||
cpu = "512"
|
||||
cpu = "768"
|
||||
execution_role_arn = aws_iam_role.ecs_execution.arn
|
||||
memory = "400"
|
||||
memory = "800"
|
||||
network_mode = "bridge"
|
||||
requires_compatibilities = [
|
||||
"EC2",
|
||||
|
Loading…
Reference in New Issue
Block a user