Sha256: 2fcc2fc89a254d1aea71761e552ae014b06b30d1ab56a603f6feecd54be189db

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# Create a rum-based metric returns "Created" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::RumMetricsAPI.new

body = DatadogAPIClient::V2::RumMetricCreateRequest.new({
  data: DatadogAPIClient::V2::RumMetricCreateData.new({
    attributes: DatadogAPIClient::V2::RumMetricCreateAttributes.new({
      compute: DatadogAPIClient::V2::RumMetricCompute.new({
        aggregation_type: DatadogAPIClient::V2::RumMetricComputeAggregationType::DISTRIBUTION,
        include_percentiles: true,
        path: "@duration",
      }),
      event_type: DatadogAPIClient::V2::RumMetricEventType::SESSION,
      filter: DatadogAPIClient::V2::RumMetricFilter.new({
        query: "@service:web-ui",
      }),
      group_by: [
        DatadogAPIClient::V2::RumMetricGroupBy.new({
          path: "@browser.name",
          tag_name: "browser_name",
        }),
      ],
      uniqueness: DatadogAPIClient::V2::RumMetricUniqueness.new({
        _when: DatadogAPIClient::V2::RumMetricUniquenessWhen::WHEN_MATCH,
      }),
    }),
    id: "rum.sessions.webui.count",
    type: DatadogAPIClient::V2::RumMetricType::RUM_METRICS,
  }),
})
p api_instance.create_rum_metric(body)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 examples/v2/rum-metrics/CreateRumMetric.rb
datadog_api_client-2.28.1 examples/v2/rum-metrics/CreateRumMetric.rb