Skip to content

Commit ed87ffa

Browse files
committed
[MegaLinter] Apply linters fixes
1 parent 493e8df commit ed87ffa

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

newrelic/core/node_mixin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def span_event(
9898
if partial_granularity_type == "reduced":
9999
return [i_attrs, u_attrs, a_attrs]
100100
else:
101-
return [i_attrs, {}, {key:a_attrs.get(key) for key in exit_span_error_attrs_present | {"nr.pg"}}]
101+
return [i_attrs, {}, {key: a_attrs.get(key) for key in exit_span_error_attrs_present | {"nr.pg"}}]
102102
# If the span is not an exit span, skip it by returning None.
103103
if not exit_span_attrs_present:
104104
return None
@@ -108,7 +108,9 @@ def span_event(
108108
ct_exit_spans["kept"] += 1
109109
return [i_attrs, u_attrs, a_attrs]
110110
else:
111-
a_minimized_attrs = attr_class({key: a_attrs[key] for key in (exit_span_attrs_present | exit_span_error_attrs_present)})
111+
a_minimized_attrs = attr_class(
112+
{key: a_attrs[key] for key in (exit_span_attrs_present | exit_span_error_attrs_present)}
113+
)
112114
# If we are in essential mode return the span with minimized attributes.
113115
if partial_granularity_type == "essential":
114116
ct_exit_spans["kept"] += 1
@@ -132,7 +134,9 @@ def span_event(
132134
# (last occurring error takes precedence), add it's guid to the list
133135
# of ids on the seen span, compute the new duration & start time, and
134136
# return None.
135-
ct_exit_spans[span_attrs][1].update(attr_class({key: a_minimized_attrs[key] for key in exit_span_error_attrs_present}))
137+
ct_exit_spans[span_attrs][1].update(
138+
attr_class({key: a_minimized_attrs[key] for key in exit_span_error_attrs_present})
139+
)
136140
# Max size for `nr.ids` = 1024. Max length = 63 (each span id is 16 bytes + 8 bytes for list type).
137141
if len(ct_exit_spans[span_attrs][1]["nr.ids"]) < 63:
138142
ct_exit_spans[span_attrs][1]["nr.ids"].append(self.guid)

newrelic/core/stats_engine.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,7 @@ def record_transaction(self, transaction):
11931193
if transaction.partial_granularity_sampled:
11941194
partial_gran_type = settings.distributed_tracing.sampler.partial_granularity.type
11951195
self.record_custom_metric(
1196-
f"Supportability/Python/PartialGranularity/{partial_gran_type}",
1197-
{"count": 1},
1196+
f"Supportability/Python/PartialGranularity/{partial_gran_type}", {"count": 1}
11981197
)
11991198
instrumented = getattr(transaction, "instrumented", 0)
12001199
if instrumented:
@@ -1211,8 +1210,7 @@ def record_transaction(self, transaction):
12111210
dropped_ids = getattr(transaction, "dropped_ids", 0)
12121211
if dropped_ids:
12131212
self.record_custom_metric(
1214-
"Supportability/Python/PartialGranularity/NrIds/Dropped",
1215-
{"count": dropped_ids},
1213+
"Supportability/Python/PartialGranularity/NrIds/Dropped", {"count": dropped_ids}
12161214
)
12171215

12181216
# Merge in log events

tests/agent_unittests/test_harvest_loop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
from newrelic.core.config import finalize_application_settings, global_settings
2828
from newrelic.core.custom_event import create_custom_event
2929
from newrelic.core.error_node import ErrorNode
30-
from newrelic.core.function_node import FunctionNode
3130
from newrelic.core.external_node import ExternalNode
31+
from newrelic.core.function_node import FunctionNode
3232
from newrelic.core.log_event_node import LogEventNode
3333
from newrelic.core.root_node import RootNode
3434
from newrelic.core.stats_engine import CustomMetrics, DimensionalMetrics, SampledDataSet

0 commit comments

Comments
 (0)