Skip to content

Added config parameter to configure app name … #44

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

Closed

Conversation

stefanhorning
Copy link
Contributor

used for tagging the rails metrics to be able to distinguish between multiple apps.

…ls metrics to be able to distinguish between multiple apps.
Copy link
Collaborator

@dmke dmke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for app_name should not be my-rails-app. Existing users of this gem, who haven't set this, shouldn't start to wonder where this might have came from.

I'd suggest either to re-use the application class name, or default to a blank value.

@@ -65,6 +67,8 @@ class Configuration
:series_name_for_view_runtimes => "rails.view",
:series_name_for_db_runtimes => "rails.db",

:rails_app_name => 'my-rails-app',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should either be nil, or something like Rails.application.class.parent_name.

server: hostname,
method: method,
server: hostname,
app_name: app_name
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app_name might be blank, so you'll need a .compact on the hash

server: hostname,
method: method,
server: hostname,
app_name: app_name
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

server: hostname,
method: method,
server: hostname,
app_name: app_name
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@stefanhorning
Copy link
Contributor Author

Yes, was thinking the same thing. Just wanted to quickly check first if this change flies. Will implement the rest tomorrow.

@stefanhorning
Copy link
Contributor Author

Now done, complete with specs.

@dmke
Copy link
Collaborator

dmke commented Feb 2, 2018

LGTM, will merge it later, when I'm back home.

@stefanhorning
Copy link
Contributor Author

Perfect, thanks!

@stefanhorning
Copy link
Contributor Author

stefanhorning commented Feb 12, 2018

Tests seem to fail for some Ruby versions, not sure why as those are unrelated to my changes.

@dmke
Copy link
Collaborator

dmke commented Feb 12, 2018

Hm, usually restarting the Travis job helps, but in this case it didn't...

(btw. I totally forgot about this, but I'm on it now :-))

@dmke
Copy link
Collaborator

dmke commented Feb 12, 2018

Interestingly, with the exact same gemset from the last succeeding spec run, your changes still fail locally... I'm not sure, why this happens (and only for Ruby < 2.4 for Rails 4.0), but I agree, these failures should be unrelated to your changes.

@dmke
Copy link
Collaborator

dmke commented Feb 12, 2018

Got it. Hash#compact is undefined. Could've sworn, that existed in Rails 4.0...

…d make metrics sending code a little more DRY.
@stefanhorning
Copy link
Contributor Author

stefanhorning commented Feb 12, 2018

Fixed now, by no longer relying on #compact.

@dmke
Copy link
Collaborator

dmke commented Feb 12, 2018

This is now merged in fae86f0 and c1f144d. The workaround for Hash#compact can be found in 6234e1c.

I've not yet released a new gem version, since I started a major refactoring and want to include #22 and #43 as well. Since 055a952 introduced some breaking changes and at least #43 requires more of them, I'm going for a 1.0 release.

@dmke dmke closed this Feb 12, 2018
@dmke
Copy link
Collaborator

dmke commented Feb 18, 2018

After some cleanup, I've discovered config.application_name, which actually gets already set to Rails.application.class.parent_name in the Railtie.

I'm going to remove rails_app_name from the configuration and use the value of application_name instead.

dmke added a commit that referenced this pull request Feb 18, 2018
Introduced in #44, `rails_app_name` is actually redundant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants