• /
  • EnglishEspaรฑolFranรงaisๆ—ฅๆœฌ่ชžํ•œ๊ตญ์–ดPortuguรชs
  • ๋กœ๊ทธ์ธ์ง€๊ธˆ ์‹œ์ž‘ํ•˜๊ธฐ

์‚ฌ์šฉ์ž์˜ ํŽธ์˜๋ฅผ ์œ„ํ•ด ์ œ๊ณต๋˜๋Š” ๊ธฐ๊ณ„ ๋ฒˆ์—ญ์ž…๋‹ˆ๋‹ค.

์˜๋ฌธ๋ณธ๊ณผ ๋ฒˆ์—ญ๋ณธ์ด ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ์˜๋ฌธ๋ณธ์ด ์šฐ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋ณด๋‹ค ์ž์„ธํ•œ ๋‚ด์šฉ์€ ์ด ํŽ˜์ด์ง€๋ฅผ ๋ฐฉ๋ฌธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

๋ฌธ์ œ ์‹ ๊ณ 

set_error_group_callback(Python ์—์ด์ „ํŠธ API)

ํ†ต์‚ฌ๋ก 

newrelic.agent.set_error_group_callback(callback_function(exception, transaction_data))

์ด ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•˜๋ฉด ์˜ค๋ฅ˜ ๋ฐ›์€ ํŽธ์ง€ํ•จ ๋‚ด์˜ ์˜ค๋ฅ˜ ๊ทธ๋ฃน์„ ํŠน์ • ์‹๋ณ„์ž(๋˜๋Š” "์ง€๋ฌธ")๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์š”๊ตฌ ์‚ฌํ•ญ

Python ์—์ด์ „ํŠธ ๋ฒ„์ „ 8.8.0 ์ด์ƒ.

์„ค๋ช…

์ด ์—”๋“œํฌ์ธํŠธ๋Š” ์˜ค๋ฅ˜ ๊ทธ๋ฃน์„ ๋“ฑ๋กํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ฝœ๋ฐฑ์ด๋ผ๋Š” ๋‹จ์ผ ์ž…๋ ฅ์„ ๋ฐ›์Šต๋‹ˆ๋‹ค. ์ด ์ฝœ๋ฐฑ์€ ๊ณ ๊ฐ์ด ์ •์˜ํ•˜๋ฉฐ ์—์ด์ „ํŠธ์˜ notice_error API๋ฅผํŠธ๋ฆฌ๊ฑฐํ•œ ์˜ˆ์™ธ๋ฅผ ์ˆ˜๋ฝํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ์„ค์ •์„ ํ•ด์ œํ•˜๋ ค๋ฉด API๋ฅผ ๋‹ค์‹œ ํ˜ธ์ถœํ•˜๊ณ  ์ฝœ๋ฐฑ์„ None๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

์— ๋Œ€ํ•œ ๋งค๊ฐœ๋ณ€์ˆ˜ set_error_group_callback

๋งค๊ฐœ๋ณ€์ˆ˜

์„ค๋ช…

callback

ํ˜ธ์ถœ ๊ฐ€๋Šฅ ํ•จ์ˆ˜

ํ•„์ˆ˜์˜. ์ •์˜ํ•˜๋ ค๋Š” ์ฝœ๋ฐฑ ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ์„ค์ •์„ ํ•ด์ œํ•˜๋ ค๋ฉด None ์‚ฌ์šฉํ•˜์„ธ์š”.

application

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ธ์Šคํ„ด์Šค

์„ ํƒ ๊ณผ๋ชฉ. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ธ์Šคํ„ด์Šค๊ฐ€ ์ œ๊ณต๋˜์ง€ ์•Š์œผ๋ฉด ํ•จ์ˆ˜๋Š” ํ™œ์„ฑํ™”๋œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ธ์Šคํ„ด์Šค๋ฅผ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

๊ณ ๊ฐ ์ •์˜ ์ฝœ๋ฐฑ ํ•จ์ˆ˜์˜ ๋งค๊ฐœ๋ณ€์ˆ˜

๋งค๊ฐœ๋ณ€์ˆ˜

์„ค๋ช…

exception

๋Ÿฐํƒ€์ž„ ์˜ˆ์™ธ

ํ•„์ˆ˜์˜. ์ด๋Š” ์—์ด์ „ํŠธ์˜ notice_error API๋ฅผํŠธ๋ฆฌ๊ฑฐํ•œ ๋Ÿฐํƒ€์ž„ ์˜ˆ์™ธ์ž…๋‹ˆ๋‹ค.

transaction_data

์‚ฌ์ „

ํ•„์ˆ˜์˜. Python ์—์ด์ „ํŠธ๊ฐ€ ์บก์ฒ˜ํ•œ ํŠธ๋žœ์žญ์…˜ ๋ฐ์ดํ„ฐ ์‚ฌ์ „์ž…๋‹ˆ๋‹ค.

๋ฐ˜ํ™˜ ๊ฐ’

์„ฑ๊ณตํ•˜๋ฉด API๋Š” ์›ํ•˜๋Š” ์˜ค๋ฅ˜ ๊ทธ๋ฃน ์ด๋ฆ„์„ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฌธ์ž์—ด์„ ์—์ด์ „ํŠธ ์†์„ฑ์œผ๋กœ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

์‹คํŒจํ•˜๋ฉด API๋Š” error.group.name ์—์ด์ „ํŠธ ์†์„ฑ์œผ๋กœ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ ์˜ˆ

์˜ค๋ฅ˜ ๊ทธ๋ฃน ์ฝœ๋ฐฑ ์„ค์ •

set_error_group_callback ์‚ฌ์šฉ ์˜ˆ:

def customer_callback(exc, data):
if isinstance(exc, ValueError):
return "group1"
def some_other_function():
try:
raise ValueError("Oh no!")
except Exception:
newrelic.agent.notice_error()
def example_function(customer_callback):
try:
newrelic.agent.set_error_group_callback(customer_callback)
some_other_function()
finally:
newrelic.agent.set_error_group_callback(None)
Copyright ยฉ 2025 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.