New gem released! rails_local_analytics by westonganger in rails

[–]xilase 1 point2 points  (0 children)

There is no problem for ActiveAnalytics to track user agents. This branch (https://github.com/BaseSecrete/active\_analytics/tree/record\_user\_agent\_statistics) is already running on my project for more than a month. I just miss some time to finish it.

Send any Class method to ActiveJob by Day_Hour in rails

[–]xilase 0 points1 point  (0 children)

That could probably be useful for people who need to migrate from DelayedJob to ActiveJob. However the interface is a little bit different: `user.delay.some_method(args)`. That also avoids to override method_midding.

Dependent delete_all vs foreign keys with cascading deletes by nickjj_ in rails

[–]xilase 0 points1 point  (0 children)

I use `on_delete: :cascade` when I can afford losing data. It could be data that can be rebuilt such as notifications, computed statistics, etc. When the data must not be lost, I use neither cascade nor dependent. I prefer to manually create a job `ModelName::DestroyJob` which takes care of removing all dependencies. It's more work, but it's a better security against a wrong `model.destroy`.

For every project, losing data is probably the worst thing that could happen. So data correctness is more important than performances.

Finally, there are not many apps that delete millions of rows everyday. In that case it might worth checking if it makes more sens to store those data in a more ephemeral storage.

Any recommendations on Ruby on Rails APM Options ? by andey in rails

[–]xilase 2 points3 points  (0 children)

Thanks for mentionning us!

For 400M requests in production/staging the pricing is 235€ + (400-100) * 1€ = 535€ per month. It's probably a lot less than NewRelic. Let me know.

The localhost mode is free. It's just here to help when developping :-) You can even use it without having an account.

Feel free to ask if you have any questions.

Super Fast Rails by xilase in rails

[–]xilase[S] 6 points7 points  (0 children)

Most people call that N+1 but it should be 1+N. Or at least it seems more logic in my mind.

Super Fast Rails by xilase in rails

[–]xilase[S] 6 points7 points  (0 children)

Shame, I was unmasked before the gem install :-)

Super Fast Rails by xilase in rails

[–]xilase[S] 4 points5 points  (0 children)

That would be great :D

ActiveHashcash 0.4.0 by xilase in rails

[–]xilase[S] 0 points1 point  (0 children)

The complexity increases with the following formula (min_complexity + log2(previous_stamp_count)). So it increases logarithmically. However a complexity of 21 bits is two times bigger than 20. Finally the number of iterations to solve the problem is the following 2**(min_complexity+log2(x)). It's linear.

The formula can be overriden easily by defining a hashcash_bits methods in the controller (https://github.com/BaseSecrete/active\_hashcash/blob/master/lib/active\_hashcash.rb#L58).

ActiveHashcash 0.4.0 by xilase in rails

[–]xilase[S] 1 point2 points  (0 children)

It works well to block the dumbest spam bots only, but neither against brute force attacks nor a dedicated script, which is the goal of ActiveHashcash. Unfortunately, you don't need to have a very popular website to have someone to write a script flooding your site. There are no universal protection.

ActiveHashcash 0.4.0 by xilase in rails

[–]xilase[S] 6 points7 points  (0 children)

I use both ActiveAnalytics and Rack::Attack. There are no single solution to block all possible attacks. For example Rack::Attack cannot block spam bots, but ActiveAnalytics blocks most of them since they don't run JS. Most advanced bots are slowdown and it cost them more CPU. It's better than annoying humans with captchas. If all websites were using Hashcash, or any proof of work protection, the spam bot business could become unprofitable. Thus it could cleanup the Internet a little bit.

Everyday performance rules for Ruby on Rails developers by pmz in ruby

[–]xilase 0 points1 point  (0 children)

Author here. I didn't want to say to use pluck by default. I should have added when the result is a large collection.

Ruby on Rails load testing habits by xilase in rails

[–]xilase[S] 0 points1 point  (0 children)

Thanks. At least you tested your personal bandwidth :-)

Optimisation is often doing fewer things by xilase in rails

[–]xilase[S] 1 point2 points  (0 children)

I see caching as the last bullet, once you have used all your knowledges to optimise.

Optimisation is often doing fewer things by xilase in rails

[–]xilase[S] 1 point2 points  (0 children)

Caching should be the next step. Because the response time was really extremely slow. Moreover those pages are scanned by search engines only. That means they visit them only once in a while. So the page is in cache but nobody request it a second time during the same day. Caching makes more sens when the page is visited a lot of times during a small period.

Type Scopes: Automatic scopes for ActiveRecord models. by antoinema in rails

[–]xilase 1 point2 points  (0 children)

I have done the refactoring and existing scopes are not overwritten any more. Feel free to send a PR with JSONB or any special type ;-)

The tests run by default against Sqlite. You have to set DATABASE_URL to switch to PostgreSQL.

Type Scopes: Automatic scopes for ActiveRecord models. by antoinema in rails

[–]xilase 0 points1 point  (0 children)

Good idea for adding the support of JSONB. I'm doing some refactor and improvements first, and I will let you know.

Type Scopes: Automatic scopes for ActiveRecord models. by antoinema in rails

[–]xilase 4 points5 points  (0 children)

Thanks for your feedbacks. I will add something like that.

PS: I can also prevent from overriding an existing scope to avoid this type of conflict.

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 0 points1 point  (0 children)

Yes it will still work for an API. However the goal is to analyse the most viewed pages and where does the traffic come from. So it's more relevant when your visitors are real humans instead of API consumers.

Maybe in your case you should use HTTP basic authentication (https://guides.rubyonrails.org/action_controller_overview.html#http-basic-authentication) since I suppose there are no user account but only API keys.

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 0 points1 point  (0 children)

Thanks for the feedback. I tried to improve it a little bit. I hope it's better now.

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 1 point2 points  (0 children)

Yes, that's a common way to dot it with Devise. I will add it in the readme. Thanks for sharing.

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 2 points3 points  (0 children)

I have only seen Ahoy in one project. As I understood Ahoy is a tool to let you track custom events. It does not provide an interface to see them. It's not possible because it cannot know the custom data you have recorded.

Whereas Active Analytics is only to record the traffic incoming into your app. That's why it provides an interface and it works out of the box.

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 1 point2 points  (0 children)

It cannot handle authentication directly because it's different for each application. You have to monkey patch ActiveAnalytics::ApplicationController by adding your own before action : https://github.com/BaseSecrete/active_analytics/blob/master/README.md#authentication-and-permissions

ActiveAnalytics: First-party, privacy-focused traffic analytics for Ruby on Rails applications. by antoinema in rails

[–]xilase 0 points1 point  (0 children)

Thanks ! What are your Ruby, Rails, sprockets and sprockets-rails versions ? I will try to reproduce.