-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live metrics support #62
Comments
I haven't tried, but I don't think it's supported. We're talking about this, right? https://learn.microsoft.com/en-us/azure/azure-monitor/app/live-stream?tabs=dotnet6 I'd definitely like to explore if this is possible using open telemetry. |
Yes, that. I tried just pushing some random metrics, and they shoed up in the |
Yeah, it has its own special counters, and endpoints. Likely possible, but also likely a lot of work. |
Just curious, what are you using App Insights for? A website? What framework? I am working on a library to leverage your library and It would look something like this to get the layer, and then you just pass the layer into axum. let telemetry_layer = AppInsights::default()
.with_connection_string(config.analytics_api_key.clone())
.with_service_config("rtz", name)
.with_catch_panic(true)
.with_field_mapper(|p| {
let fly_alloc_id = FLY_ALLOC_ID.get().unwrap().to_owned();
let fly_public_ip = FLY_PUBLIC_IP.get().unwrap().to_owned();
let fly_region = FLY_REGION.get().unwrap().to_owned();
let fly_accept_region = p.headers.get("Fly-Region").map(|v| v.to_str().unwrap_or("unknown").to_owned()).unwrap_or("unknown".to_owned());
HashMap::from([
("fly.alloc_id".to_string(), fly_alloc_id),
("fly.public_ip".to_string(), fly_public_ip),
("fly.server_region".to_string(), fly_region),
("fly.accept_region".to_string(), fly_accept_region),
])
})
.with_panic_mapper(|e| {
(500, WebError {
status: 500,
message: format!("A panic occurred: {:?}", e),
backtrace: None,
})
})
.with_error_type::<WebError>()
.build_and_set_global_default()
.unwrap()
.layer(); |
Good find. I might give this a go on the weekend. Though, yeah. This might be a bit of work.
I created this crate when I was working on a website. We used
This looks really nice and easy to setup. I like it. And I can see how live metrics would be useful for this. |
Yeah, let me know if I can help out with the live metrics. Just released the library here: https://github.com/twitchax/axum-insights. |
I played around with this today. The experiment is working: #63 🎉 I do wonder a bit if this belongs in this crate. I don't think it can use much of the OpenTelemetry SDK to make this work. It seems like almost an entirely different thing. Though it would be weird if you had to install 2 metric collecting crates. So maybe it should go in here? |
Whoa, that's awesome; I think it would fit well here, but that's just my opinion. :) |
I gave it a bit more thought and I think I agree now. I need to read more, but it seems live metrics may also include traces. Having it in this crate might make it easier to automatically include relevant traces. |
Yeah, it would be cool if |
Let me know if I can help out at all. 😄 |
I'm likely not going to do any work on this until the weekend. As far as I can tell, we need to:
Feel free to work on any one of those things if you have time. I can merge that with what I have when I find the time. |
Sounds good. I will be freed up more next week. Likely best area for me would be configuration options. Aren't you already doing the CPU / memory piece? |
Yeah, I added CPU metrics. But they are incomplete and I'm not sure they're correct, either. Definitely needs a second look. |
Made some good progress. But interestingly documents don't want to work. The Portal says "Not supported by this Agent/SDK version" in the "Sample telemetry" panel. I wonder if it detects that based on the SDK version included in the request. I tried faking the Node.js SDK by sending the same value, but it didn't work. This needs some more investigation. |
Very cool! What do you mean by |
Hi. Quick update: I haven't found any time to work on this recently but I think I should find time again next weekend. With "documents" I meant the sample telemetry panel on the right side as in https://learn.microsoft.com/de-de/azure/azure-monitor/app/media/live-stream/filter.png. My plan for now is to finish live metrics without sample telemetry and release that. We can always add sample telemetry later. |
Ahhh, nice. Yeah, I think that would be secondary, for sure.
|
Released with version 0.28.0. The PR #63 shows an updated screenshot for how that look like for me now. It also includes a new example. Let me know if this does/doesn't work for you. I'm pretty sure lots can be improved. But this seems like a good start. Thanks for suggesting that. |
Ha, awesome! Integrated into |
No description provided.
The text was updated successfully, but these errors were encountered: