Skip to content
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

Remove Orphaned Constants #1130

Closed
fallwith opened this issue Apr 30, 2022 · 3 comments
Closed

Remove Orphaned Constants #1130

fallwith opened this issue Apr 30, 2022 · 3 comments

Comments

@fallwith
Copy link
Contributor

fallwith commented Apr 30, 2022

The following is a list of constants that appear to be defined but never referenced. This list is thought to be conservative because it was produced without being concerned by module namespaces. So if ClassOne::CONSTANT is defined, but ClassTwo::CONSTANT is all that is ever referenced, ClassOne::CONSTANT would be left off of this list because of the reference even though it does not belong to the right namespace.

We should:

  • Remove all of these constants from the code base
  • Refactor the unit test(s) that reference NEWRELIC_ID_HEADER to either have the test class define the constant or remove the tests if they only pertain to the constant
  • Run CI checks to verify everything still works

Constants

  • MYSQL_EXPLAIN_COLUMNS
    • ./lib/new_relic/agent/database.rb:10
  • WEB_ROLLUP_METRIC
    • ./lib/new_relic/agent/datastores/metric_helper.rb:9
  • OTHER_ROLLUP_METRIC
    • ./lib/new_relic/agent/datastores/metric_helper.rb:10
  • MONGO_PRODUCT_NAME
    • ./lib/new_relic/agent/datastores/mongo/metric_translator.rb:59
  • POUND
    • ./lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb:21
  • ALL_QUEUE_METRIC
    • ./lib/new_relic/agent/instrumentation/queue_time.rb:14
  • NEWRELIC_ID_HEADER (NOTE: used, but only by tests)
    • ./lib/new_relic/agent/monitors/cross_app_monitor.rb:14
  • VALID_PREFIX_SEGMENT_COUNT is possibly orphaned.
    • ./lib/new_relic/agent/rules_engine/segment_terms_rule.rb:13
  • GRANDPARENT_ID_KEY
    • ./lib/new_relic/agent/span_event_primitive.rb:23
  • NO_SAMPLES
    • ./lib/new_relic/agent/transaction/transaction_sample_buffer.rb:11
  • TRANSACTION_NAMING_SOURCES
    • ./lib/new_relic/agent/transaction.rb:39
  • DEFAULT_PRODUCT_NAME
    • lib/new_relic/agent/datastores/metric_helper.rb:12
@workato-integration
Copy link

@fallwith
Copy link
Contributor Author

fallwith commented Sep 13, 2022

#1408 has taken care of the lion's share of these. Here's an updated list:

  • MYSQL_EXPLAIN_COLUMNS: Remove orphaned constant MYSQL_EXPLAIN_COLUMNS #1793
    ./lib/new_relic/agent/database.rb:10
  • WEB_ROLLUP_METRIC
    ./lib/new_relic/agent/datastores/metric_helper.rb:9
  • OTHER_ROLLUP_METRIC
    ./lib/new_relic/agent/datastores/metric_helper.rb:10
  • MONGO_PRODUCT_NAME
    ./lib/new_relic/agent/datastores/mongo/metric_translator.rb:59
  • POUND
    ./lib/new_relic/agent/distributed_tracing/distributed_trace_payload.rb:21
  • ALL_QUEUE_METRIC
    ./lib/new_relic/agent/instrumentation/queue_time.rb:14
  • NEWRELIC_ID_HEADER (NOTE: used, but only by tests) - Remove NEW_RELIC_ID_HEADER #1808
    ./lib/new_relic/agent/monitors/cross_app_monitor.rb:14
  • VALID_PREFIX_SEGMENT_COUNT is possibly orphaned - Remove orphaned constant VALID_PREFIXED_SEGMENT_COUNT #1794
    ./lib/new_relic/agent/rules_engine/segment_terms_rule.rb:13
  • GRANDPARENT_ID_KEY
    ./lib/new_relic/agent/span_event_primitive.rb:23
  • NO_SAMPLES
    ./lib/new_relic/agent/transaction/transaction_sample_buffer.rb:11
  • TRANSACTION_NAMING_SOURCES
    ./lib/new_relic/agent/transaction.rb:39
  • DEFAULT_PRODUCT_NAME
    lib/new_relic/agent/datastores/metric_helper.rb:12

@hannahramadan
Copy link
Contributor

All orphaned constants references in this ticket have been completed! Thanks to @esquith for wrapping this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants