- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
Before you begin, make sure that Test Optimization is already set up for your language. This guide walks you through adding and using custom measures for your tests.
Add the custom measure to your test. The native instrumentation allows you to use the programmatic API:
it('sum function can sum', () => {
const testSpan = require('dd-trace').scope().active()
testSpan.setTag('test.memory.rss', process.memoryUsage().rss)
// test continues normally
// ...
})
To add custom metrics, include the opentracing-util
library as a compile-time dependency to your project.
import io.opentracing.Span;
import io.opentracing.util.GlobalTracer;
// ...
// inside your test
final Span span = GlobalTracer.get().activeSpan();
if (span != null) {
span.setTag("test.memory.usage", 1e8);
}
// test continues normally
// ...
from ddtrace import tracer
import os, psutil
# Declare `ddspan` as argument to your test
def test_simple_case(ddspan):
# Set your tags
process = psutil.Process()
ddspan.set_tag("test.memory.rss", process.memory_info().rss)
# test continues normally
# ...
// inside your test
var scope = Tracer.Instance.ActiveScope; // from Datadog.Trace;
if (scope != null) {
scope.Span.SetTag("test.memory.usage", 1e8);
}
// test continues normally
// ...
require 'datadog/ci'
# inside your test
Datadog::CI.active_test&.set_tag('test.memory.usage', 1e8)
# test continues normally
# ...
For datadog-ci
, use the DD_MEASURES
environment variable or --measures
CLI argument:
DD_MEASURES="test.memory.usage:1000" datadog-ci junit upload --service my-service --measures test.request.rate:30 report.xml
Create a facet for the custom measure you added to the test by navigating to the Test Runs page and clicking + Add on the facet list.
Make sure that the type of facet is Measure, which represents a numerical value:
Click Add to start using your custom measure.
Plot the evolution of your measure across time by selecting the Timeseries visualization:
For example, you can use this visualization to track the evolution of the memory usage in your tests.
You can export your graph to a dashboard or a notebook, and create a monitor based on it by clicking the Export button.
Get alerted if the value of your measure goes above or below a certain threshold by creating a CI Tests Monitor.
For example, you can use this type of alert to inform you about the memory usage reaching a certain threshold.
추가 유용한 문서, 링크 및 기사: