RequestData.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.

  3. package com.microsoft.opentelemetry.exporter.azuremonitor.implementation.models;

  4. import com.azure.core.annotation.Fluent;
  5. import com.fasterxml.jackson.annotation.JsonProperty;
  6. import java.util.Map;

  7. /**
  8.  * An instance of Request represents completion of an external request to the application to do work and contains a
  9.  * summary of that request execution and the results.
  10.  */
  11. @Fluent
  12. public final class RequestData extends MonitorDomain {
  13.     /*
  14.      * Identifier of a request call instance. Used for correlation between
  15.      * request and other telemetry items.
  16.      */
  17.     @JsonProperty(value = "id", required = true)
  18.     private String id;

  19.     /*
  20.      * Name of the request. Represents code path taken to process request. Low
  21.      * cardinality value to allow better grouping of requests. For HTTP
  22.      * requests it represents the HTTP method and URL path template like 'GET
  23.      * /values/{id}'.
  24.      */
  25.     @JsonProperty(value = "name")
  26.     private String name;

  27.     /*
  28.      * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000
  29.      * days.
  30.      */
  31.     @JsonProperty(value = "duration", required = true)
  32.     private String duration;

  33.     /*
  34.      * Indication of successful or unsuccessful call.
  35.      */
  36.     @JsonProperty(value = "success", required = true)
  37.     private boolean success;

  38.     /*
  39.      * Result of a request execution. HTTP status code for HTTP requests.
  40.      */
  41.     @JsonProperty(value = "responseCode", required = true)
  42.     private String responseCode;

  43.     /*
  44.      * Source of the request. Examples are the instrumentation key of the
  45.      * caller or the ip address of the caller.
  46.      */
  47.     @JsonProperty(value = "source")
  48.     private String source;

  49.     /*
  50.      * Request URL with all query string parameters.
  51.      */
  52.     @JsonProperty(value = "url")
  53.     private String url;

  54.     /*
  55.      * Collection of custom properties.
  56.      */
  57.     @JsonProperty(value = "properties")
  58.     private Map<String, String> properties;

  59.     /*
  60.      * Collection of custom measurements.
  61.      */
  62.     @JsonProperty(value = "measurements")
  63.     private Map<String, Double> measurements;

  64.     /**
  65.      * Get the id property: Identifier of a request call instance. Used for correlation between request and other
  66.      * telemetry items.
  67.      *
  68.      * @return the id value.
  69.      */
  70.     public String getId() {
  71.         return this.id;
  72.     }

  73.     /**
  74.      * Set the id property: Identifier of a request call instance. Used for correlation between request and other
  75.      * telemetry items.
  76.      *
  77.      * @param id the id value to set.
  78.      * @return the RequestData object itself.
  79.      */
  80.     public RequestData setId(String id) {
  81.         this.id = id;
  82.         return this;
  83.     }

  84.     /**
  85.      * Get the name property: Name of the request. Represents code path taken to process request. Low cardinality value
  86.      * to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like
  87.      * 'GET /values/{id}'.
  88.      *
  89.      * @return the name value.
  90.      */
  91.     public String getName() {
  92.         return this.name;
  93.     }

  94.     /**
  95.      * Set the name property: Name of the request. Represents code path taken to process request. Low cardinality value
  96.      * to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like
  97.      * 'GET /values/{id}'.
  98.      *
  99.      * @param name the name value to set.
  100.      * @return the RequestData object itself.
  101.      */
  102.     public RequestData setName(String name) {
  103.         this.name = name;
  104.         return this;
  105.     }

  106.     /**
  107.      * Get the duration property: Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.
  108.      *
  109.      * @return the duration value.
  110.      */
  111.     public String getDuration() {
  112.         return this.duration;
  113.     }

  114.     /**
  115.      * Set the duration property: Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.
  116.      *
  117.      * @param duration the duration value to set.
  118.      * @return the RequestData object itself.
  119.      */
  120.     public RequestData setDuration(String duration) {
  121.         this.duration = duration;
  122.         return this;
  123.     }

  124.     /**
  125.      * Get the success property: Indication of successful or unsuccessful call.
  126.      *
  127.      * @return the success value.
  128.      */
  129.     public boolean isSuccess() {
  130.         return this.success;
  131.     }

  132.     /**
  133.      * Set the success property: Indication of successful or unsuccessful call.
  134.      *
  135.      * @param success the success value to set.
  136.      * @return the RequestData object itself.
  137.      */
  138.     public RequestData setSuccess(boolean success) {
  139.         this.success = success;
  140.         return this;
  141.     }

  142.     /**
  143.      * Get the responseCode property: Result of a request execution. HTTP status code for HTTP requests.
  144.      *
  145.      * @return the responseCode value.
  146.      */
  147.     public String getResponseCode() {
  148.         return this.responseCode;
  149.     }

  150.     /**
  151.      * Set the responseCode property: Result of a request execution. HTTP status code for HTTP requests.
  152.      *
  153.      * @param responseCode the responseCode value to set.
  154.      * @return the RequestData object itself.
  155.      */
  156.     public RequestData setResponseCode(String responseCode) {
  157.         this.responseCode = responseCode;
  158.         return this;
  159.     }

  160.     /**
  161.      * Get the source property: Source of the request. Examples are the instrumentation key of the caller or the ip
  162.      * address of the caller.
  163.      *
  164.      * @return the source value.
  165.      */
  166.     public String getSource() {
  167.         return this.source;
  168.     }

  169.     /**
  170.      * Set the source property: Source of the request. Examples are the instrumentation key of the caller or the ip
  171.      * address of the caller.
  172.      *
  173.      * @param source the source value to set.
  174.      * @return the RequestData object itself.
  175.      */
  176.     public RequestData setSource(String source) {
  177.         this.source = source;
  178.         return this;
  179.     }

  180.     /**
  181.      * Get the url property: Request URL with all query string parameters.
  182.      *
  183.      * @return the url value.
  184.      */
  185.     public String getUrl() {
  186.         return this.url;
  187.     }

  188.     /**
  189.      * Set the url property: Request URL with all query string parameters.
  190.      *
  191.      * @param url the url value to set.
  192.      * @return the RequestData object itself.
  193.      */
  194.     public RequestData setUrl(String url) {
  195.         this.url = url;
  196.         return this;
  197.     }

  198.     /**
  199.      * Get the properties property: Collection of custom properties.
  200.      *
  201.      * @return the properties value.
  202.      */
  203.     public Map<String, String> getProperties() {
  204.         return this.properties;
  205.     }

  206.     /**
  207.      * Set the properties property: Collection of custom properties.
  208.      *
  209.      * @param properties the properties value to set.
  210.      * @return the RequestData object itself.
  211.      */
  212.     public RequestData setProperties(Map<String, String> properties) {
  213.         this.properties = properties;
  214.         return this;
  215.     }

  216.     /**
  217.      * Get the measurements property: Collection of custom measurements.
  218.      *
  219.      * @return the measurements value.
  220.      */
  221.     public Map<String, Double> getMeasurements() {
  222.         return this.measurements;
  223.     }

  224.     /**
  225.      * Set the measurements property: Collection of custom measurements.
  226.      *
  227.      * @param measurements the measurements value to set.
  228.      * @return the RequestData object itself.
  229.      */
  230.     public RequestData setMeasurements(Map<String, Double> measurements) {
  231.         this.measurements = measurements;
  232.         return this;
  233.     }
  234. }