@@ -172,8 +172,6 @@ pub async fn metrics(
172172 writeln ! ( response, "online_players {online_players}" ) ;
173173 let data_container = global_data. read ( ) . await ;
174174 let request_agents = data_container. data . request_user_agents . clone ( ) ;
175- let request_agents_count = request_agents. len ( ) ;
176- writeln ! ( response, "request_agents_count {request_agents_count}" ) ;
177175 for ( agent, count) in request_agents {
178176 if let Some ( ( mod_ver, minecraft_ver, note) ) = parse_user_agent ( agent) {
179177 writeln ! ( response, "request_count{{mod_version=\" {mod_ver}\" , minecraft_version=\" {minecraft_ver}\" , mod=\" {note}\" }} {count}" ) ;
@@ -204,17 +202,18 @@ static MCVER_REGEX: LazyLock<Regex> = LazyLock::new(|| {
204202 . unwrap ( )
205203} ) ;
206204static OLD_1_UA : LazyLock < Regex > =
207- LazyLock :: new ( || Regex :: new ( r".*\((?:(AxolotlClient)/)(.+)(?:\+mc)?(.+)\) .*" ) . unwrap ( ) ) ;
208- static OLD_2_UA : LazyLock < Regex > =
209- LazyLock :: new ( || Regex :: new ( r".*\((?:(AxolotlClient)/)(.+) \(Minecraft .+\).*" ) . unwrap ( ) ) ;
205+ LazyLock :: new ( || Regex :: new ( r".*(?:(AxolotlClient)/.* )\((.+)(?:\+mc)(.+)\).*" ) . unwrap ( ) ) ;
206+ static OLD_2_UA : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r".*(?:(AxolotlClient)/.* )\((.+)\+(.+)\).*" ) . unwrap ( ) ) ;
207+ static OLD_3_UA : LazyLock < Regex > =
208+ LazyLock :: new ( || Regex :: new ( r".*\((?:(AxolotlClient)/)(.+) \(Minecraft (.+)\)\).*" ) . unwrap ( ) ) ;
210209static CURRENT_UA : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r"(AxolotlClient)/(.+) Minecraft/(.+)" ) . unwrap ( ) ) ;
211210static SNAPPER_UA : LazyLock < Regex > = LazyLock :: new ( || Regex :: new ( r"(Snapper)/(.+)\+(.+)" ) . unwrap ( ) ) ;
212211
213212fn parse_user_agent ( agent : String ) -> Option < ( String , String , String ) > {
214213 if agent. starts_with ( "Java-http-client" ) {
215214 return None ;
216215 }
217- for regex in [ & OLD_1_UA , & OLD_2_UA , & CURRENT_UA , & SNAPPER_UA ] {
216+ for regex in [ & OLD_1_UA , & OLD_2_UA , & OLD_3_UA , & CURRENT_UA , & SNAPPER_UA ] {
218217 if regex. is_match ( & agent) {
219218 let captures = regex. captures ( & agent) . unwrap ( ) ;
220219 let mod_name_capture = captures. get ( 1 ) ;
0 commit comments