Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get time-series data that includes string values into Dynatrace?

Frequent Guest

Hi Everyone,

I maintain an open-source API Management project; we have a rich time-series data stream that we output that is very useful for analytics (typically into Elasticsearch or InfluxDB etc). We call it metrics, but it doesn't really map perfectly onto Dynatrace's definition of metrics — I would write a plugin for the platform to allow it to push that data directly to Dynatrace (e.g. via OneAgent or to the cloud).

My first instinct was to use the Dynatrace Metrics v2 API, but I'm not sure whether I'm trying to bash a square peg into a round hole. It really only seems to want the values to be numbers (literal number, gauge, or counter), and not strings. For example, a classic value would be the endpoint that was accessed.

Here is what a single metric record looks like from the API Management solution (pseudo-code to demonstrate the data, ignore the specific format). Each request-response through the gateway would produce its own record, which we aggregate, transform into platform-specific formats, and then push into the corresponding platform.

apiId="foo" // identifier
apiOrgId="test" // identifier
apiVersion="1.0" // identifier
requestStart="1682448091736" // timestamp for when request started
requestEnd="1682448092015" // timestamp for when request ended
apiStart="1682448091739" // timestamp (similar to above, but backend only)
apiEnd="1682448092013" // timestamp (similar to above, but backend only)
method="GET" // HTTP Method that was proxied
responseCode="200" // HTTP response code
responseMessage="OK" // HTTP response message
failureCode="0" // If an error occurred its code would be shown here
custom.request.header.X-Correlation-Id="1234-4949-4693" // Some custom header captured by the user's config

From reading the Dynatrace documentation and using your definitions, depending how you squint at this, a dataset like this could be:

  •  An event (represents a single request-response action);
  • A log (records what happened in detail, and can be used for audit);
  • A metric (some of this information could be transformed into counters, gauges, and values)


I've read through your docs a few times and I am not sure how I should tackle this.


  •  Do I need to emit multiple Dynatrace metrics for each example metric as shown above? For example, you _could_ put the endpoint as an additional dimension, but this seems likely to cause an explosion in dimensions.


  • Some of the metric values are essentially enums/text and not numeric — I am not sure how these would map across to a gauge or counter. For example, HTTP method, response messages, or custom captured header key-values.


  •  Is there a different API I should be looking at instead? I can see some examples of existing platforms that seem to be able to get the full raw per-request data in, not just counters/gauges. So I suppose there must be a way to do it.


  • For example, people want specific response codes for each request, and using metrics it seems you'd realistically need to batch into 4xx, 5xx, etc. This means you'd be losing some of the fidelity of the data. Or again, you'd need a cross-product of a huge range of dimensions (and/or keys), which would get out of control fairly quickly I suspect?


All guidance is much appreciated.


TL;DR: I'd like a way to get the sample data into Dynatrace, and ideally also provide some metadata/schema (etc), to allow Dynatrace to understand the meaning of the data. Is this possible via APIs?