Skip to content

Commit

Permalink
Merge pull request #459 from newrelic/vince/bump-line-length
Browse files Browse the repository at this point in the history
Bump line length to 120
  • Loading branch information
tpitale authored Jan 7, 2025
2 parents aa70bde + 11fde5e commit c940d45
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 44 deletions.
1 change: 1 addition & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
line_length: 120,
inputs: [
"{lib,config,test}/**/*.{ex,exs}",
"{mix,.formatter}.exs"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
otp: '26'
- elixir: '1.15'
otp: '26'
- elixir: '1.14'
otp: '25'

steps:
- name: Checkout
Expand Down
3 changes: 1 addition & 2 deletions lib/new_relic/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ defmodule NewRelic.Config do
def event_harvest_config() do
%{
harvest_limits: %{
analytic_event_data:
Application.get_env(:new_relic_agent, :analytic_event_per_minute, 1000),
analytic_event_data: Application.get_env(:new_relic_agent, :analytic_event_per_minute, 1000),
custom_event_data: Application.get_env(:new_relic_agent, :custom_event_per_minute, 1000),
error_event_data: Application.get_env(:new_relic_agent, :error_event_per_minute, 100),
span_event_data: Application.get_env(:new_relic_agent, :span_event_per_minute, 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ defmodule NewRelic.DistributedTrace.W3CTraceContext.TraceParent do
def decode(<<_::binary-size(@version), "-", "00000000000000000000000000000000", _::binary>>),
do: invalid()

def decode(
<<_::binary-size(@version), "-", _::binary-size(@trace_id), "-", "0000000000000000",
_::binary>>
),
do: invalid()
def decode(<<_::binary-size(@version), "-", _::binary-size(@trace_id), "-", "0000000000000000", _::binary>>),
do: invalid()

def decode(
<<version::binary-size(@version), "-", trace_id::binary-size(@trace_id), "-",
Expand Down
3 changes: 1 addition & 2 deletions lib/new_relic/harvest/collector/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ defmodule NewRelic.Harvest.Collector.Supervisor do

def data_supervisor(namespace, key) do
Supervisor.child_spec(
{Harvest.DataSupervisor,
[namespace: namespace, key: key, lookup_module: Collector.AgentRun]},
{Harvest.DataSupervisor, [namespace: namespace, key: key, lookup_module: Collector.AgentRun]},
id: make_ref()
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ defmodule NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.Harvester do
%{type: type, name: name, value: new_value, attributes: attributes} = metric,
metrics_acc
),
do:
Map.update(metrics_acc, {type, name, attributes}, metric, &update_metric(&1, new_value))
do: Map.update(metrics_acc, {type, name, attributes}, metric, &update_metric(&1, new_value))

defp update_metric(
%{type: :count, value: value} = current_metric,
Expand Down
3 changes: 1 addition & 2 deletions lib/new_relic/harvest/telemetry_sdk/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ defmodule NewRelic.Harvest.TelemetrySdk.Supervisor do

def data_supervisor(namespace, key) do
Supervisor.child_spec(
{Harvest.DataSupervisor,
[namespace: namespace, key: key, lookup_module: TelemetrySdk.Config]},
{Harvest.DataSupervisor, [namespace: namespace, key: key, lookup_module: TelemetrySdk.Config]},
id: make_ref()
)
end
Expand Down
4 changes: 1 addition & 3 deletions lib/new_relic/instrumented/mix/task.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ defmodule NewRelic.Instrumented.Mix.Task do
_ ->
require Logger

Logger.error(
"[New Relic] Unable to instrument #{inspect(__MODULE__)} since it isn't a Mix.Task"
)
Logger.error("[New Relic] Unable to instrument #{inspect(__MODULE__)} since it isn't a Mix.Task")
end
end
end
Expand Down
3 changes: 1 addition & 2 deletions lib/new_relic/sampler/beam.ex
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ defmodule NewRelic.Sampler.Beam do
input_kb: current.input_kb - previous.input_kb,
output_kb: current.output_kb - previous.output_kb,
reductions: current.reductions - previous.reductions,
scheduler_utilization:
delta(:util, previous.scheduler_utilization, current.scheduler_utilization)
scheduler_utilization: delta(:util, previous.scheduler_utilization, current.scheduler_utilization)
}
end

Expand Down
16 changes: 4 additions & 12 deletions test/dimensional_metric_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ defmodule DimensionalMetricTest do
use ExUnit.Case

test "reports dimensional metrics" do
TestHelper.restart_harvest_cycle(
NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle
)
TestHelper.restart_harvest_cycle(NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle)

NewRelic.report_dimensional_metric(:count, "memory.foo_baz", 100, %{cpu: 1000})
NewRelic.report_dimensional_metric(:summary, "memory.foo_bar", 50, %{cpu: 2000})
Expand All @@ -28,9 +26,7 @@ defmodule DimensionalMetricTest do
end

test "gauge dimensional metric is updated" do
TestHelper.restart_harvest_cycle(
NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle
)
TestHelper.restart_harvest_cycle(NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle)

NewRelic.report_dimensional_metric(:gauge, "mem_percent.foo_baz", 10, %{cpu: 1000})
NewRelic.report_dimensional_metric(:gauge, "mem_percent.foo_baz", 40, %{cpu: 1000})
Expand All @@ -51,9 +47,7 @@ defmodule DimensionalMetricTest do
end

test "count dimensional metric is updated" do
TestHelper.restart_harvest_cycle(
NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle
)
TestHelper.restart_harvest_cycle(NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle)

NewRelic.report_dimensional_metric(:count, "OOM", 1, %{cpu: 1000})
NewRelic.report_dimensional_metric(:count, "OOM", 1, %{cpu: 1000})
Expand All @@ -74,9 +68,7 @@ defmodule DimensionalMetricTest do
end

test "summary dimensional metric is updated" do
TestHelper.restart_harvest_cycle(
NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle
)
TestHelper.restart_harvest_cycle(NewRelic.Harvest.TelemetrySdk.DimensionalMetrics.HarvestCycle)

NewRelic.report_dimensional_metric(:summary, "duration", 40.5, %{cpu: 1000})
NewRelic.report_dimensional_metric(:summary, "duration", 20.5, %{cpu: 1000})
Expand Down
4 changes: 1 addition & 3 deletions test/instrumented/task_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,7 @@ defmodule InstrumentedTaskTest do
Task.Supervisor.async_nolink(TestTaskSup, __MODULE__, :do_task, [:via_mfa])
|> Task.await()

Task.Supervisor.async_nolink(TestTaskSup, __MODULE__, :do_task, [:via_mfa_opt],
shutdown: 1000
)
Task.Supervisor.async_nolink(TestTaskSup, __MODULE__, :do_task, [:via_mfa_opt], shutdown: 1000)
|> Task.await()
end)
|> Task.await()
Expand Down
4 changes: 1 addition & 3 deletions test/logs_in_context_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ defmodule LogsInContextTest do
test "LogsInContext in :direct mode" do
TestHelper.restart_harvest_cycle(TelemetrySdk.Logs.HarvestCycle)

TestHelper.restart_harvest_cycle(
NewRelic.Harvest.Collector.TransactionErrorEvent.HarvestCycle
)
TestHelper.restart_harvest_cycle(NewRelic.Harvest.Collector.TransactionErrorEvent.HarvestCycle)

configure_logs_in_context(:direct)

Expand Down
6 changes: 2 additions & 4 deletions test/metric_transaction_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ defmodule MetricTransactionTest do

assert TestHelper.find_metric(
metrics,
{"External/MetricTransactionTest.External.call",
"WebTransaction/Plug/GET//foo/:blah"}
{"External/MetricTransactionTest.External.call", "WebTransaction/Plug/GET//foo/:blah"}
)
end

Expand All @@ -146,8 +145,7 @@ defmodule MetricTransactionTest do
# Scoped
assert TestHelper.find_metric(
metrics,
{"Function/MetricTransactionTest.External.make_queries/0",
"WebTransaction/Plug/GET//foo/:blah"}
{"Function/MetricTransactionTest.External.make_queries/0", "WebTransaction/Plug/GET//foo/:blah"}
)
end

Expand Down
3 changes: 1 addition & 2 deletions test/other_transaction_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ defmodule OtherTransactionTest do

assert TestHelper.find_metric(
metrics,
{"External/OtherTransactionTest.External.call",
"OtherTransaction/TransactionCategory/MyTaskName"}
{"External/OtherTransactionTest.External.call", "OtherTransaction/TransactionCategory/MyTaskName"}
)

span_events = TestHelper.gather_harvest(Collector.SpanEvent.Harvester)
Expand Down

0 comments on commit c940d45

Please sign in to comment.