Skip to content
This repository was archived by the owner on Sep 25, 2019. It is now read-only.

Commit a1ec77a

Browse files
committed
remove curves: these were taken care of already, add 'version' field to Runtime, send version along with prometheus
1 parent 7e6b39b commit a1ec77a

File tree

13 files changed

+34
-35
lines changed

13 files changed

+34
-35
lines changed

Cargo.lock

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

distributed-fly/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ config = "0.9"
2929
sha2 = "0.8"
3030
bytes = "*"
3131
prometheus = "0.4"
32-
floating-duration = "0.1"

distributed-fly/src/main.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ use tokio_openssl::SslAcceptorExt;
4848
#[macro_use]
4949
extern crate prometheus;
5050

51-
use floating_duration::TimeAsFloat;
52-
5351
mod cert;
5452
mod metrics;
5553
mod proxy;
@@ -70,10 +68,6 @@ lazy_static! {
7068
.unwrap();
7169
}
7270

73-
static CURVES: &str = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256";
74-
75-
use std::time;
76-
7771
fn main() {
7872
let env = Env::default().filter_or("LOG_LEVEL", "info");
7973
env_logger::init_from_env(env);
@@ -133,7 +127,6 @@ fn main() {
133127
openssl::ssl::select_next_proto(b"\x02h2\x08http/1.1", client)
134128
.ok_or(openssl::ssl::AlpnError::NOACK)
135129
});
136-
tls_builder.set_cipher_list(CURVES).unwrap();
137130

138131
let certs_path = {
139132
match GLOBAL_SETTINGS.read().unwrap().certs_path {
@@ -175,12 +168,12 @@ fn main() {
175168
.map_err(|e| error!("error in stream: {}", e))
176169
.for_each(move |stream| {
177170
let remote_addr = stream.peer_addr().unwrap();
178-
let start = time::Instant::now();
171+
let timer = TLS_HANDSHAKE_TIME_HISTOGRAM.start_timer();
179172
tls_acceptor
180173
.accept_async(stream)
181174
.map_err(|e| error!("error handshake conn: {}", e))
182175
.and_then(move |stream| {
183-
TLS_HANDSHAKE_TIME_HISTOGRAM.observe(start.elapsed().as_fractional_secs());
176+
timer.observe_duration();
184177
let h = hyper::server::conn::Http::new();
185178
h.serve_connection(
186179
stream,

distributed-fly/src/runtime_selector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ impl RuntimeSelector for DistributedRuntimeSelector {
7575
})),
7676
}
7777
};
78-
let mut rt = Runtime::new(Some(rel.app.clone()), &settings);
78+
let mut rt = Runtime::new(Some(rel.app_id.to_string()), Some(rel.version.to_string()), &settings);
7979
let merged_conf = rel.clone().parsed_config().unwrap();
80-
rt.eval(
80+
rt.eval(
8181
"<app config>",
8282
&format!("window.app = {{ config: {} }};", merged_conf),
8383
);

src/bin/dns/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn main() {
5050
.get_matches();
5151

5252
let entry_file = matches.value_of("input").unwrap();
53-
let mut runtime = Runtime::new(None, &SETTINGS.read().unwrap());
53+
let mut runtime = Runtime::new(None, None, &SETTINGS.read().unwrap());
5454

5555
debug!("Loading dev tools");
5656
runtime.eval_file("v8env/dist/dev-tools.js");

src/bin/eval/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn main() {
2929
.index(1),
3030
).get_matches();
3131

32-
let mut runtime = Runtime::new(None, &SETTINGS.read().unwrap());
32+
let mut runtime = Runtime::new(None, None, &SETTINGS.read().unwrap());
3333
debug!("Loading dev tools");
3434
runtime.eval_file("v8env/dist/dev-tools.js");
3535
runtime.eval("<installDevTools>", "installDevTools();");

src/bin/http/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn main() {
5959
info!("V8 version: {}", libfly::version());
6060

6161
let entry_file = matches.value_of("input").unwrap();
62-
let mut runtime = Runtime::new(None, &SETTINGS.read().unwrap());
62+
let mut runtime = Runtime::new(None, None, &SETTINGS.read().unwrap());
6363

6464
debug!("Loading dev tools");
6565
runtime.eval_file("v8env/dist/dev-tools.js");

src/bin/test/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434
let env = Env::default().filter_or("LOG_LEVEL", "info");
3535
env_logger::init_from_env(env);
3636

37-
let mut rt = Runtime::new(None, &SETTINGS.read().unwrap());
37+
let mut rt = Runtime::new(None, None, &SETTINGS.read().unwrap());
3838
rt.eval("mocha.js", str::from_utf8(MOCHA_SOURCE).unwrap());
3939
rt.eval("chai.js", str::from_utf8(CHAI_SOURCE).unwrap());
4040
rt.eval("testing.js", str::from_utf8(FLY_TESTING_SOURCE).unwrap());

src/http_server.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub fn serve_http(
9494
.status(StatusCode::SERVICE_UNAVAILABLE)
9595
.body(Body::empty())
9696
.unwrap(),
97-
Some(rt.name.clone()),
97+
Some((rt.name.clone(), rt.version.clone())),
9898
);
9999
}
100100

@@ -138,7 +138,7 @@ pub fn serve_http(
138138
.status(StatusCode::INTERNAL_SERVER_ERROR)
139139
.body(Body::empty())
140140
.unwrap(),
141-
Some(rt.name.clone()),
141+
Some((rt.name.clone(), rt.version.clone())),
142142
);
143143
}
144144

@@ -166,31 +166,31 @@ pub fn serve_http(
166166

167167
Ok(Response::from_parts(parts, body))
168168
}),
169-
Some(rt.name.clone()),
169+
Some((rt.name.clone(), rt.version.clone())),
170170
)
171171
} else {
172172
future_response(
173173
Response::builder()
174174
.status(StatusCode::SERVICE_UNAVAILABLE)
175175
.body(Body::empty())
176176
.unwrap(),
177-
Some(rt.name.clone()),
177+
Some((rt.name.clone(), rt.version.clone())),
178178
)
179179
}
180180
}
181181

182-
fn future_response(res: Response<Body>, name: Option<String>) -> BoxedResponseFuture {
183-
wrap_future(future::ok(res), name)
182+
fn future_response(res: Response<Body>, namever: Option<(String, String)>) -> BoxedResponseFuture {
183+
wrap_future(future::ok(res), namever)
184184
}
185185

186-
fn wrap_future<F>(fut: F, maybe_name: Option<String>) -> BoxedResponseFuture
186+
fn wrap_future<F>(fut: F, namever: Option<(String, String)>) -> BoxedResponseFuture
187187
where
188188
F: Future<Item = Response<Body>, Error = futures::Canceled> + Send + 'static,
189189
{
190190
Box::new(fut.and_then(move |res| {
191-
let rt_name = maybe_name.unwrap_or(String::new());
191+
let (name, ver) = namever.unwrap_or((String::new(), String::new()));
192192
metrics::HTTP_RESPONSE_COUNTER
193-
.with_label_values(&[rt_name.as_str(), res.status().as_str()])
193+
.with_label_values(&[name.as_str(), ver.as_str(), res.status().as_str()])
194194
.inc();
195195
Ok(res)
196196
}))

src/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ lazy_static! {
3131
pub static ref HTTP_RESPONSE_COUNTER: IntCounterVec = register_int_counter_vec!(
3232
"fly_http_responses_total",
3333
"Total number of HTTP responses made.",
34-
&["runtime", "status"]
34+
&["runtime", "version", "status"]
3535
)
3636
.unwrap();
3737
pub static ref HTTP_RESPONSE_TIME_HISTOGRAM: HistogramVec = register_histogram_vec!(
3838
"fly_http_response_time_histogram_seconds",
3939
"HTTP response times by runtime, in seconds.",
40-
&["runtime"],
40+
&["runtime", "version"],
4141
vec![0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 1.0, 5.0, 10.0, 60.0]
4242
)
4343
.unwrap();

0 commit comments

Comments
 (0)