Unlike automatic ingestion using OneAgent, data sent directly to an ActiveGate (for example, ingest APIs) is not automatically enriched with host-related information. This may incur additional charges, as it would not take into account possibly included DDU quotas.
The different Dynatrace deployment options provide several Java-style property and JSON files with sets of attributes that you can use to enrich your requests to Dynatrace and ensure Dynatrace can map the data to your infrastructure.
Dynatrace uses the following directories to provide .json
and .properties
files with enrichment data:
/var/lib/dynatrace/enrichment
%ProgramData%\dynatrace\enrichment
A standard OneAgent setup provides the following files with host-specific details in the enrichment directory:
dt_host_metadata.json
dt_host_metadata.properties
Both files contain the same data in different formats. They also hold any custom properties and tags you assigned to the OneAgent instance.
For an example of how to load the JSON file, see the Python example below.
The following files are available in the enrichment directory when you are using the deployment option applicationMonitoring
(standalone or as part of cloudNativeFullStack
) and cloud-native injection is enabled:
dt_metadata.json
dt_metadata.properties
Both files contain the same data in different formats.
For an example of how to load the JSON file, see the Python example below.
When OneAgent is monitoring your application, your application is also able to access the following virtual files:
dt_metadata_e617c525669e072eebe3d0f08212e8f2.json
dt_metadata_e617c525669e072eebe3d0f08212e8f2.properties
These files are not specific to the enrichment directory and do not physically exists in your file system, but are provided by the OneAgent instrumentation. Both files return the same data and the file extension (.json
/.properties
) only determines the output format.
In the context of the Kubernetes Operator, the virtual file also contains the attributes of the dt_metadata.{json,properties}
files.
Use the standard file read function of your language platform to open and read one of these files:
dt_metadata_e617c525669e072eebe3d0f08212e8f2.json
dt_metadata_e617c525669e072eebe3d0f08212e8f2.properties
The file extension you choose is relevant for step 4. Only use the filename and do not specify an additional path.
The content of the file is a single text line with an absolute file path (consider it an ephemeral value and do not store, persist, or cache that path for later use).
Open the file at the path location obtained in the previous step and read its entire content.
The content format received from the previous read will match the file extension you chose in step 1 (Java-style properties or JSON).
If step 1 returns a file-not-found error, verify that your application is instrumented by OneAgent.
stat
and other if (exists)
checks fail for these files. These checks are not required for the mechanism to work.syscalls
used directly for file access aren't supported. This also means that the Go-based applications used for metric ingestion aren't supported unless you use the OneAgent SDK as explained in Instrument your Go application with OpenTelemetry.The following example shows how to load the enrichment information as JSON in Python on Unix.
# Initialize dictionary variableenrich_attrs = dict()# Iterate over the potential data files and try reading themfor name in ["dt_metadata_e617c525669e072eebe3d0f08212e8f2.json", "/var/lib/dynatrace/enrichment/dt_metadata.json", "/var/lib/dynatrace/enrichment/dt_host_metadata.json"]:try:data = ''with open(name) as f:data = json.load(f if name.startswith("/var") else open(f.read()))enrich_attrs.update(data)except:pass # An exception indicates the file was not available# Use enrich_attrs here to enrich your requests to Dynatrace.# For example, when instrumenting with OpenTelemetry, add the data as resource attributes.
The example code initializes an empty dictionary for the imported attributes. It then iterates over an array of .json
filenames and loads the content of each file as JSON document, adding the keys to the dictionary. File exceptions indicate the particular file is not available and are ignored.