- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
After you set up the tracing library with your code and configure the Agent to collect APM data, optionally configure the tracing library as desired, including setting up Unified Service Tagging.
You can set configuration settings in the .NET Tracer with any of the following methods:
To configure the tracer using environment variables, set the variables before launching the instrumented application. To learn how to set environment variables in different environments, see Configuring process environment variables.
To configure the tracer in application code, create a TracerSettings
instance from the default configuration sources. Set properties on this TracerSettings
instance before calling Tracer.Configure()
. For example:
TracerSettings
before creating the Tracer
. Changes made to TracerSettings
properties after the Tracer
is created are ignored.using Datadog.Trace;
using Datadog.Trace.Configuration;
// read default configuration sources (env vars or datadog.json)
var settings = TracerSettings.FromDefaultSources();
// change some settings
settings.Environment = "prod";
settings.ServiceName = "MyService";
settings.ServiceVersion = "abc123";
// In v2 of Datadog.Trace, use settings.Exporter.AgentUri
settings.AgentUri = new Uri("http://localhost:8126/");
// configure the global Tracer settings
Tracer.Configure(settings);
To configure the tracer using a JSON file, create datadog.json
in the instrumented application’s directory. The root JSON object must be an object with a key-value pair for each setting. For example:
{
"DD_TRACE_AGENT_URL": "http://localhost:8126",
"DD_ENV": "prod",
"DD_SERVICE": "MyService",
"DD_VERSION": "abc123",
}
Using the methods described above, customize your tracing configuration with the following variables. Use the environment variable name (for example, DD_TRACE_AGENT_URL
) when setting environment variables or configuration files. Use the TracerSettings property (for example, Exporter.AgentUri
) when changing settings in code.
To use Unified Service Tagging, configure the following settings for your services:
DD_ENV
Environment
env
tag with the specified value to all generated spans. Added in version 1.17.0.DD_SERVICE
ServiceName
DD_VERSION
ServiceVersion
The following configuration variables are available for both automatic and custom instrumentation:
DD_TRACE_SAMPLE_RATE
GlobalSamplingRate
0.0
to 1.0
.
For more information, see Ingestion Mechanisms.DD_TRACE_SAMPLE_RATE
is deprecated in favor of DD_TRACE_SAMPLING_RULES
.DD_TRACE_SAMPLE_RATE
in the Service Catalog UI.DD_TRACE_SAMPLING_RULES
CustomSamplingRules
null
sample_rate
. The name
and service
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.[{"sample_rate": 0.2}]
[{"service": "a.*", "name": "b", "sample_rate": 0.1}, {"sample_rate": 0.2}]
DD_TRACE_RATE_LIMIT
MaxTracesSubmittedPerSecond
DD_MAX_TRACES_PER_SECOND
).100
when DD_TRACE_SAMPLE_RATE
is set. Otherwise, delegates rate limiting to the Datadog Agent.DD_SPAN_SAMPLING_RULES
null
sample_rate
value must be between 0.0 and 1.0 (inclusive). For more information, see Ingestion Mechanisms.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}]
DD_TAGS
GlobalTags
layer:api, team:intake, key:value
,
.DD_TRACE_HEADER_TAGS
HeaderTags
http.request.headers.<header-name>
and http.response.headers.<header-name>
respectively.User-ID:userId
User-ID
, its value is applied as tag userId
to the spans produced by the service.User-ID
User-ID
, its value is applied as tag http.request.headers.User-ID
.User-ID
, its value is applied as tag http.response.headers.User-ID
.DD_TRACE_HEADER_TAGS
in the Service Catalog UI.
=======669e6ada8bd16c9130ccb8cb06535032d9f2e9b1
DD_TRACE_CLIENT_IP_ENABLED
2.19.0
.false
DD_TRACE_CLIENT_IP_HEADER
x-forwarded-for
.2.19.0
.x-forwarded-for
, x-real-ip
, true-client-ip
, x-client-ip
, x-forwarded
, forwarded-for
, x-cluster-client-ip
, fastly-client-ip
, cf-connecting-ip
, cf-connecting-ipv6
. If several are present, the first from the list to parse correctly will be used.DD_TRACE_SERVICE_MAPPING
[from-key]:[to-name]
.mysql:main-mysql-db, mongodb:offsite-mongodb-service
from-key
value is specific to the integration type, and should exclude the application name prefix. For example, to rename my-application-sql-server
to main-db
, use sql-server:main-db
. Added in version 1.23.0DD_HTTP_SERVER_TAG_QUERY_STRING
true
, the http.url
includes query string parameters. You can find more details in Redacting the query in the url.
Default: true
DD_HTTP_SERVER_TAG_QUERY_STRING_SIZE
DD_HTTP_SERVER_TAG_QUERY_STRING
is true, sets the max size of the querystring to report, before obfuscation. Set 0 for no limit in size5000
DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP
DD_HTTP_SERVER_TAG_QUERY_STRING
is true, this regex redacts sensitive data from incoming requests’ query string reported in the http.url
tag (matches are replaced with <redacted>
). This regex executes for every incoming request.DD_TRACE_AGENT_URL
Exporter.AgentUri
DD_AGENT_HOST
and DD_TRACE_AGENT_PORT
if set. If the Agent configuration sets receiver_port
or DD_APM_RECEIVER_PORT
to something other than the default 8126
, then DD_TRACE_AGENT_PORT
or DD_TRACE_AGENT_URL
must match it.unix://
.http://<DD_AGENT_HOST>:<DD_TRACE_AGENT_PORT>
if they are set, unix:///var/run/datadog/apm.socket
if the file exists, or http://localhost:8126
.DD_AGENT_HOST
DD_TRACE_AGENT_URL
, which has precedence over this parameter.localhost
DD_TRACE_AGENT_PORT
DD_TRACE_AGENT_URL
, which has precedence over this parameter. If the Agent configuration sets receiver_port
or DD_APM_RECEIVER_PORT
to something other than the default 8126
, then DD_TRACE_AGENT_PORT
or DD_TRACE_AGENT_URL
must match it.8126
DD_INSTRUMENTATION_TELEMETRY_ENABLED
true
For information about valid values and using the following configuration options, see Trace Context Propagation.
DD_TRACE_PROPAGATION_STYLE_INJECT
datadog,tracecontext
2.20.0
DD_TRACE_PROPAGATION_STYLE_EXTRACT
datadog,tracecontext
2.20.0
DD_TRACE_PROPAGATION_STYLE
datadog,tracecontext
DD_TRACE_PROPAGATION_STYLE_INJECT
and DD_TRACE_PROPAGATION_STYLE_EXTRACT
configuration settings take priority when present.2.20.0
DD_TRACE_PROPAGATION_EXTRACT_FIRST
false
true
, stop extracting trace context when a valid one is found.2.42.0
DD_TRACE_DEBUG
true
or false
.false
DD_TRACE_LOG_DIRECTORY
%ProgramData%\Datadog .NET Tracer\logs\
on Windows, /var/log/datadog/dotnet
on LinuxDD_TRACE_LOGFILE_RETENTION_DAYS
31
DD_TRACE_LOGGING_RATE
x
seconds. For example, to log a given message once per 60 seconds, set to 60
. Setting to 0
disables log rate limiting. Added in version 1.24.0. Disabled by default.DD_TRACE_OTEL_ENABLED
true
or false
.false
The following configuration variables are available only when using automatic instrumentation:
DD_TRACE_ENABLED
TraceEnabled
true
or false
.true
Note: Setting the environment variable to false
completely disables the client library, and it cannot be enabled through other configuration methods. If it is set to false
through another configuration method (not an environment variable), the client library is still loaded, but traces will not be generated.DD_TRACE_EXPAND_ROUTE_TEMPLATES_ENABLED
false
Added in version 2.5.1.DD_TRACE_METHODS
;
) separated list where each entry has the format Namespace.TypeName[MethodNames]
, where MethodNames
is either a comma (,
) separated list of method names or the *
wildcard. For generic types, replace the angled brackets and the type parameters’ names with a backtick (`
) followed by the number of generic type parameters. For example, Dictionary<TKey, TValue>
must be written as Dictionary`2
. For generic methods, you only need to specify the method name.Namespace1.Class1[Method1,GenericMethod];Namespace1.GenericTypeWithOneTypeVariable`1[ExecuteAsync];Namespace2.Class2[*]
[*]
) selects all methods in a type except constructors, property getters and setters, Equals
, Finalize
, GetHashCode
, and ToString
.[*]
added in version 2.7.0.DD_TRACE_KAFKA_CREATE_CONSUMER_SCOPE_ENABLED
true
true
, the consumer span is created when a message is consumed and closed before consuming the next message. The span duration is representative of the computation between one message consumption and the next. Use this setting when message consumption is performed in a loop.false
, the consumer span is created when a message is consumed and immediately closed. Use this setting when a message is not processed completely before consuming the next one, or when multiple messages are consumed at once. When you set this parameter to false
, consumer spans are closed right away. If you have child spans to trace, you must extract the context manually. Read Headers extraction and injection for more details.DD_DBM_PROPAGATION_MODE
service
or full
. The service
option enables the connection between DBM and APM services. The full
option enables connection between database spans with database query events. Available for Postgres and MySQL.disabled
DD_RUNTIME_METRICS_ENABLED
true
or false
.false
DD_HTTP_CLIENT_ERROR_STATUSES
400-499
DD_HTTP_SERVER_ERROR_STATUSES
500-599
DD_LOGS_INJECTION
LogsInjectionEnabled
source
that sets the trace_id
mapping correctly. The default source for .NET Applications, csharp
, does this automatically. For more information, see correlated logs in the Trace ID panel.DD_LOGS_INJECTION
in the Service Catalog UI.The following table lists configuration variables that are available only when using automatic instrumentation and can be set for each integration.
DD_DISABLED_INTEGRATIONS
DisabledIntegrationNames
DD_TRACE_<INTEGRATION_NAME>_ENABLED
Integrations[<INTEGRATION_NAME>].Enabled
true
or false
. Integration names are listed in the Integrations section.true
The following configuration variables are for features that are available for use but may change in future releases.
DD_TRACE_PARTIAL_FLUSH_ENABLED
true
or false
. Added in version 1.26.0, only compatible with the Datadog Agent 7.26.0+.false
DD_TRACE_LOG_PATH
DD_TRACE_LOG_DIRECTORY
is set.DD_TRACE_ROUTE_TEMPLATE_RESOURCE_NAMES_ENABLED
true
. Uses route template information where available, adds an additional span for ASP.NET Core integrations, and enables additional tags. Added in version 1.26.0. Enabled by default in 2.0.0true
추가 유용한 문서, 링크 및 기사: