Skip to content

Commit c472225

Browse files
committed
Prepare for 1.4.0
add preview support for metrics minor doc improvements
1 parent d9848b7 commit c472225

18 files changed

+1439
-32
lines changed

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This is the official Node.js implementation of the [Dynatrace OneAgent SDK](http
1919
* [Trace messaging](#trace-messaging)
2020
* [Trace SQL database requests](#trace-sql-database-requests)
2121
* [Set custom request attributes](#set-custom-request-attributes)
22+
* [Metrics](#metrics)
2223
* [Administrative Apis](#administrative-apis)
2324
* [Current SDK state](#current-sdk-state)
2425
* [Set callbacks for logging](#set-callbacks-for-logging)
@@ -46,6 +47,7 @@ This is the official Node.js implementation of the [Dynatrace OneAgent SDK](http
4647

4748
|OneAgent SDK for Node.js|Required OneAgent version|Support status|
4849
|:-----------------------|:------------------------|:-------------|
50+
|1.4.x |>=1.179 |Supported |
4951
|1.3.x |>=1.165 |Supported |
5052
|1.2.x |>=1.145 |Supported |
5153
|1.1.x |>=1.143 |Supported |
@@ -131,6 +133,7 @@ A more detailed specification of the features can be found in [Dynatrace OneAgen
131133
|Set result data on SQL database requests |>=1.1.0 |
132134
|Set custom request attributes |>=1.2.0 |
133135
|Trace Messaging |>=1.3.0 |
136+
|Metrics (preview only) |>=1.4.0 |
134137

135138
### Trace incoming and outgoing remote calls
136139

@@ -297,7 +300,7 @@ If the specific information like host/socketPath/... is not available, the prope
297300

298301
The result of `traceIncomingMessage()` is a tracer object to be used for further operations related to this trace (see [Tracers](#tracers) for details).
299302

300-
Besides the common APIs for outgoing tracers this tracer offers the additional methods `setVendorMessageId()` and `setCorrelationId()` which may be used to set more details about the message sent. Both APIs receive a `string` as parameter to pass the `correlationId` or `vendorMessageId` provided by messaging system.
303+
Besides the common APIs for incoming tracers this tracer offers the additional methods `setVendorMessageId()` and `setCorrelationId()` which may be used to set more details about the message sent. Both APIs receive a `string` as parameter to pass the `correlationId` or `vendorMessageId` provided by messaging system.
301304

302305
**Example (see [MessagingSample.js](samples/Messaging/MessagingSample.js) for more details):**
303306

@@ -406,6 +409,55 @@ Api.addCustomRequestAttribute("fooAttribute", "bar");
406409
Api.addCustomRequestAttribute("barAttribute", 15.34);
407410
```
408411

412+
### Metrics
413+
414+
**The metrics API is currently part of a preview program and will not work for users outside of the preview program. Visit [Dynatrace Help](https://www.dynatrace.com/support/help/whats-new/preview-and-early-adopter-releases/) for details.**
415+
416+
The SDK supports two **metric value types**: `Integer` and `Float` (double precision floating point).
417+
You should prefer integer metrics as they are more efficient, unless the loss of precision is unacceptable (but
418+
consider using a different unit, e.g. integer microseconds instead of floating point seconds).
419+
420+
There are these different **kinds of metrics**:
421+
422+
* **Counter**: For all metrics that are counting something like sent/received bytes to/from network.
423+
Counters should only be used when tracking things in flow, as opposed to state. It reports the `sum`
424+
only and is the most lightweight metric kind.
425+
* **Gauge**: For metrics that periodically sample a current state, e.g. temperatures, total number
426+
of bytes stored on a disk. Gauges report a `min`, `max` and `average` value (but no `sum`).
427+
* **Statistics**: For event-driven metrics like the packet size of a network interface. The most
428+
heavyweight metric. Reports `min`, `max`, `average` and `count`.
429+
430+
Each combination of metric value type and kind has its own create-function, named `create<ValueType><MetricKind>Metric`.
431+
432+
When creating a metric following information needs to be provided:
433+
434+
* `metricName` Mandatory - a string identifying the metric. Maximum size is 100 bytes.
435+
Although it is not recommended, you may create multiple metric instances with the same name, as long as you use the same creation function (metric value type and kind are the same) and the same options.
436+
Otherwise, using the same metric name multiple times is an error. All metrics with the same name will be aggregated together as if you used only one metric instance.
437+
438+
* `MetricOptions` Optional - an `object` with following properties:
439+
* `unit` Optional - a string that will be displayed when browsing for metrics in the Dynatrace UI.
440+
* `dimensionName` Optional - a `string` specifying the name of the dimension added to the metric.
441+
If a name is given here it's required to set a dimension value during booking samples on the metric. A dimension is like an additional label attached to values, for example a "disk.written.bytes" metric could have a dimension name of "disk-id" and when adding values to it a dimension value would be "/dev/sda1".
442+
443+
**Example (see [MetricsSample.js](samples/Metrics/MetricsSample.js) for more details):**
444+
445+
```js
446+
// create some metrics
447+
const intCounter = Api.createIntegerCounterMetric("aIntCounter");
448+
const floatGauge = Api.createFloatGaugeMetric("aFloatGauge", { dimensionName: "aDimName"} );
449+
const intStatistics = Api.createIntegerStatisticsMetric("aIntStat", { unit: "aUnit"} );
450+
451+
// report some values
452+
setInterval(() => {
453+
intCounter.increaseBy(10 * Math.random());
454+
floatGauge.setValue(10 * Math.random(), "firstDim");
455+
floatGauge.setValue(10 * Math.random(), "secondDim");
456+
intStatistics.addValue(10 * Math.random());
457+
}, 800);
458+
459+
```
460+
409461
### Administrative Apis
410462

411463
#### Current SDK state
@@ -608,6 +660,7 @@ see also [Releases](https://github.com/Dynatrace/OneAgent-SDK-for-NodeJs/release
608660

609661
|Version|Description |
610662
|:------|:-------------------------------------------|
663+
|1.4.0 |add support for metrics (preview only) |
611664
|1.3.0 |add support to trace messaging |
612665
|1.2.2 |don't swallow exceptions |
613666
|1.2.1 |improve type definitions |

0 commit comments

Comments
 (0)