- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
After you set up the tracing library with your code, configure the Agent to collect APM data, and activate the Go integration, optionally configure the tracing library as desired.
Datadog recommends using DD_ENV
, DD_SERVICE
, and DD_VERSION
to set env
, service
, and version
for your services.
Read the Unified Service Tagging documentation for recommendations on how to configure these environment variables. These variables are available for versions 1.24.0+ of the Go tracer.
You may also elect to provide env
, service
, and version
through the tracer’s API:
package main
import (
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
)
func main() {
tracer.Start(
tracer.WithEnv("prod"),
tracer.WithService("test-go"),
tracer.WithServiceVersion("abc123"),
)
// When the tracer is stopped, it will flush everything it has to the Datadog Agent before quitting.
// Make sure this line stays in your main function.
defer tracer.Stop()
}
The Go tracer supports additional environment variables and functions for configuration. See all available options in the configuration documentation.
DD_VERSION
1.2.3
, 6c44da20
, 2020.02.13
DD_SERVICE
DD_ENV
DD_TRACE_ENABLED
true
DD_TRACE_AGENT_PORT
8126
receiver_port
or DD_APM_RECEIVER_PORT
to something other than the default 8126
, then the library configuration DD_DOGSTATSD_PORT
must match it.DD_TRACE_SAMPLE_RATE
nil
DD_TRACE_RATE_LIMIT
DD_TRACE_STARTUP_LOGS
true
DD_TRACE_DEBUG
false
DD_SERVICE_MAPPING
null
mysql:mysql-service-name,postgres:postgres-service-name
, mysql:mysql-service-name postgres:postgres-service-name
.DD_TRACE_PARTIAL_FLUSH_ENABLED
false
true
or false
.
Added in version 1.54.0. Only compatible with the Datadog Agent 7.26.0+.DD_TRACE_PARTIAL_FLUSH_MIN_SPANS
1000
DD_TRACE_PARTIAL_FLUSH_ENABLED
must be true
for partial flushing to occur.
Added in version 1.54.0. Only compatible with the Datadog Agent 7.26.0+.DD_TRACE_CLIENT_IP_ENABLED
false
DD_TRACE_HEADER_TAGS
null
my-header
: "DD_TRACE_HEADER_TAGS=my-header"
my-header-1
and my-header-2
: "DD_TRACE_HEADER_TAGS=my-header1,my-header-2"
my-header
and rename it to my-tag
: "DD_TRACE_HEADER_TAGS=my-header:my-tag"
DD_TRACE_SAMPLING_RULES
nil
"sample_rate"
. The "name"
,"service"
, "resource"
, and "tags"
fields are optional. The "sample_rate"
value must be between 0.0
and 1.0
(inclusive). Rules are applied in configured order to determine the trace’s sample rate.For more information, see Ingestion Mechanisms.
Examples:
'[{"sample_rate": 0.2}]'
'[{"service": "a.*", "name": "b", "sample_rate": 0.1}, {"sample_rate": 0.2}]'
.HTTP GET
resource name: '[{"resource": "HTTP GET", "sample_rate": 0.4}]'
.tier
tag with the value premium
: '[{"tags": {"tier":"premium"}, "sample_rate": 1}]'
.DD_SPAN_SAMPLING_RULES
nil
"sample_rate"
. The "name"
,"service"
, "resource"
, and "tags"
fields are optional. Rules are applied in configured order to determine the span’s sample rate. The sample_rate
value must be between 0.0 and 1.0 (inclusive).For more information, see Ingestion Mechanisms.
Example:
my-service
and operation name http.request
, up to 50 traces per second: '[{"service": "my-service", "name": "http.request", "sample_rate":0.5, "max_per_second": 50}]'
priority
tag with the value high
: '[{"tags": {"priority":"high"}, "sample_rate": 1}]'
.DD_TAGS
layer:api,team:intake,key:value
or layer:api team:intake key:value
.DD_AGENT_HOST
localhost
DD_DOGSTATSD_PORT
8125
dogstatsd_port
or DD_DOGSTATSD_PORT
to something other than the default 8125
, then the library configuration DD_DOGSTATSD_PORT
must match it.DD_INSTRUMENTATION_TELEMETRY_ENABLED
true
DD_RUNTIME_METRICS_ENABLED
false
DD_TRACE_PROPAGATION_STYLE
datadog,tracecontext
The APM environment name may be configured in the Agent or using the WithEnv start option of the tracer.