Class ServiceMonitorSpec

  • All Implemented Interfaces:
    io.fabric8.kubernetes.api.builder.Editable<ServiceMonitorSpecBuilder>, io.fabric8.kubernetes.api.model.KubernetesResource, Serializable

    @Generated("io.fabric8.kubernetes.schema.generator.model.ModelGenerator")
    public class ServiceMonitorSpec
    extends Object
    implements io.fabric8.kubernetes.api.builder.Editable<ServiceMonitorSpecBuilder>, io.fabric8.kubernetes.api.model.KubernetesResource
    ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
    See Also:
    Serialized Form
    • Constructor Detail

      • ServiceMonitorSpec

        public ServiceMonitorSpec()
        No args constructor for use in serialization
      • ServiceMonitorSpec

        public ServiceMonitorSpec​(AttachMetadata attachMetadata,
                                  String bodySizeLimit,
                                  Boolean convertClassicHistogramsToNHCB,
                                  List<Endpoint> endpoints,
                                  String fallbackScrapeProtocol,
                                  String jobLabel,
                                  Long keepDroppedTargets,
                                  Long labelLimit,
                                  Long labelNameLengthLimit,
                                  Long labelValueLengthLimit,
                                  NamespaceSelector namespaceSelector,
                                  Long nativeHistogramBucketLimit,
                                  io.fabric8.kubernetes.api.model.Quantity nativeHistogramMinBucketFactor,
                                  List<String> podTargetLabels,
                                  Long sampleLimit,
                                  String scrapeClass,
                                  Boolean scrapeClassicHistograms,
                                  List<String> scrapeProtocols,
                                  io.fabric8.kubernetes.api.model.LabelSelector selector,
                                  String selectorMechanism,
                                  List<String> targetLabels,
                                  Long targetLimit)
    • Method Detail

      • getAttachMetadata

        public AttachMetadata getAttachMetadata()
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • setAttachMetadata

        public void setAttachMetadata​(AttachMetadata attachMetadata)
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • getBodySizeLimit

        public String getBodySizeLimit()
        When defined, bodySizeLimit specifies a job level limit on the size of uncompressed response body that will be accepted by Prometheus.


        It requires Prometheus >= v2.28.0.

      • setBodySizeLimit

        public void setBodySizeLimit​(String bodySizeLimit)
        When defined, bodySizeLimit specifies a job level limit on the size of uncompressed response body that will be accepted by Prometheus.


        It requires Prometheus >= v2.28.0.

      • getConvertClassicHistogramsToNHCB

        public Boolean getConvertClassicHistogramsToNHCB()
        Whether to convert all scraped classic histograms into a native histogram with custom buckets. It requires Prometheus >= v3.0.0.
      • setConvertClassicHistogramsToNHCB

        public void setConvertClassicHistogramsToNHCB​(Boolean convertClassicHistogramsToNHCB)
        Whether to convert all scraped classic histograms into a native histogram with custom buckets. It requires Prometheus >= v3.0.0.
      • getEndpoints

        public List<Endpoint> getEndpoints()
        List of endpoints part of this ServiceMonitor. Defines how to scrape metrics from Kubernetes [Endpoints](https://kubernetes.io/docs/concepts/services-networking/service/#endpoints) objects. In most cases, an Endpoints object is backed by a Kubernetes [Service](https://kubernetes.io/docs/concepts/services-networking/service/) object with the same name and labels.
      • setEndpoints

        public void setEndpoints​(List<Endpoint> endpoints)
        List of endpoints part of this ServiceMonitor. Defines how to scrape metrics from Kubernetes [Endpoints](https://kubernetes.io/docs/concepts/services-networking/service/#endpoints) objects. In most cases, an Endpoints object is backed by a Kubernetes [Service](https://kubernetes.io/docs/concepts/services-networking/service/) object with the same name and labels.
      • getFallbackScrapeProtocol

        public String getFallbackScrapeProtocol()
        The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.


        It requires Prometheus >= v3.0.0.

      • setFallbackScrapeProtocol

        public void setFallbackScrapeProtocol​(String fallbackScrapeProtocol)
        The protocol to use if a scrape returns blank, unparseable, or otherwise invalid Content-Type.


        It requires Prometheus >= v3.0.0.

      • getJobLabel

        public String getJobLabel()
        `jobLabel` selects the label from the associated Kubernetes `Service` object which will be used as the `job` label for all metrics.


        For example if `jobLabel` is set to `foo` and the Kubernetes `Service` object is labeled with `foo: bar`, then Prometheus adds the `job="bar"` label to all ingested metrics.


        If the value of this field is empty or if the label doesn't exist for the given Service, the `job` label of the metrics defaults to the name of the associated Kubernetes `Service`.

      • setJobLabel

        public void setJobLabel​(String jobLabel)
        `jobLabel` selects the label from the associated Kubernetes `Service` object which will be used as the `job` label for all metrics.


        For example if `jobLabel` is set to `foo` and the Kubernetes `Service` object is labeled with `foo: bar`, then Prometheus adds the `job="bar"` label to all ingested metrics.


        If the value of this field is empty or if the label doesn't exist for the given Service, the `job` label of the metrics defaults to the name of the associated Kubernetes `Service`.

      • getKeepDroppedTargets

        public Long getKeepDroppedTargets()
        Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit.


        It requires Prometheus >= v2.47.0.

      • setKeepDroppedTargets

        public void setKeepDroppedTargets​(Long keepDroppedTargets)
        Per-scrape limit on the number of targets dropped by relabeling that will be kept in memory. 0 means no limit.


        It requires Prometheus >= v2.47.0.

      • getLabelLimit

        public Long getLabelLimit()
        Per-scrape limit on number of labels that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • setLabelLimit

        public void setLabelLimit​(Long labelLimit)
        Per-scrape limit on number of labels that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • getLabelNameLengthLimit

        public Long getLabelNameLengthLimit()
        Per-scrape limit on length of labels name that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • setLabelNameLengthLimit

        public void setLabelNameLengthLimit​(Long labelNameLengthLimit)
        Per-scrape limit on length of labels name that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • getLabelValueLengthLimit

        public Long getLabelValueLengthLimit()
        Per-scrape limit on length of labels value that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • setLabelValueLengthLimit

        public void setLabelValueLengthLimit​(Long labelValueLengthLimit)
        Per-scrape limit on length of labels value that will be accepted for a sample.


        It requires Prometheus >= v2.27.0.

      • getNamespaceSelector

        public NamespaceSelector getNamespaceSelector()
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • setNamespaceSelector

        public void setNamespaceSelector​(NamespaceSelector namespaceSelector)
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • getNativeHistogramBucketLimit

        public Long getNativeHistogramBucketLimit()
        If there are more than this many buckets in a native histogram, buckets will be merged to stay within the limit. It requires Prometheus >= v2.45.0.
      • setNativeHistogramBucketLimit

        public void setNativeHistogramBucketLimit​(Long nativeHistogramBucketLimit)
        If there are more than this many buckets in a native histogram, buckets will be merged to stay within the limit. It requires Prometheus >= v2.45.0.
      • getNativeHistogramMinBucketFactor

        public io.fabric8.kubernetes.api.model.Quantity getNativeHistogramMinBucketFactor()
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • setNativeHistogramMinBucketFactor

        public void setNativeHistogramMinBucketFactor​(io.fabric8.kubernetes.api.model.Quantity nativeHistogramMinBucketFactor)
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • getPodTargetLabels

        public List<String> getPodTargetLabels()
        `podTargetLabels` defines the labels which are transferred from the associated Kubernetes `Pod` object onto the ingested metrics.
      • setPodTargetLabels

        public void setPodTargetLabels​(List<String> podTargetLabels)
        `podTargetLabels` defines the labels which are transferred from the associated Kubernetes `Pod` object onto the ingested metrics.
      • getSampleLimit

        public Long getSampleLimit()
        `sampleLimit` defines a per-scrape limit on the number of scraped samples that will be accepted.
      • setSampleLimit

        public void setSampleLimit​(Long sampleLimit)
        `sampleLimit` defines a per-scrape limit on the number of scraped samples that will be accepted.
      • getScrapeClass

        public String getScrapeClass()
        The scrape class to apply.
      • setScrapeClass

        public void setScrapeClass​(String scrapeClass)
        The scrape class to apply.
      • getScrapeClassicHistograms

        public Boolean getScrapeClassicHistograms()
        Whether to scrape a classic histogram that is also exposed as a native histogram. It requires Prometheus >= v2.45.0.


        Notice: `scrapeClassicHistograms` corresponds to the `always_scrape_classic_histograms` field in the Prometheus configuration.

      • setScrapeClassicHistograms

        public void setScrapeClassicHistograms​(Boolean scrapeClassicHistograms)
        Whether to scrape a classic histogram that is also exposed as a native histogram. It requires Prometheus >= v2.45.0.


        Notice: `scrapeClassicHistograms` corresponds to the `always_scrape_classic_histograms` field in the Prometheus configuration.

      • getScrapeProtocols

        public List<String> getScrapeProtocols()
        `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred).


        If unset, Prometheus uses its default value.


        It requires Prometheus >= v2.49.0.

      • setScrapeProtocols

        public void setScrapeProtocols​(List<String> scrapeProtocols)
        `scrapeProtocols` defines the protocols to negotiate during a scrape. It tells clients the protocols supported by Prometheus in order of preference (from most to least preferred).


        If unset, Prometheus uses its default value.


        It requires Prometheus >= v2.49.0.

      • getSelector

        public io.fabric8.kubernetes.api.model.LabelSelector getSelector()
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • setSelector

        public void setSelector​(io.fabric8.kubernetes.api.model.LabelSelector selector)
        ServiceMonitorSpec defines the specification parameters for a ServiceMonitor.
      • getSelectorMechanism

        public String getSelectorMechanism()
        Mechanism used to select the endpoints to scrape. By default, the selection process relies on relabel configurations to filter the discovered targets. Alternatively, you can opt in for role selectors, which may offer better efficiency in large clusters. Which strategy is best for your use case needs to be carefully evaluated.


        It requires Prometheus >= v2.17.0.

      • setSelectorMechanism

        public void setSelectorMechanism​(String selectorMechanism)
        Mechanism used to select the endpoints to scrape. By default, the selection process relies on relabel configurations to filter the discovered targets. Alternatively, you can opt in for role selectors, which may offer better efficiency in large clusters. Which strategy is best for your use case needs to be carefully evaluated.


        It requires Prometheus >= v2.17.0.

      • getTargetLabels

        public List<String> getTargetLabels()
        `targetLabels` defines the labels which are transferred from the associated Kubernetes `Service` object onto the ingested metrics.
      • setTargetLabels

        public void setTargetLabels​(List<String> targetLabels)
        `targetLabels` defines the labels which are transferred from the associated Kubernetes `Service` object onto the ingested metrics.
      • getTargetLimit

        public Long getTargetLimit()
        `targetLimit` defines a limit on the number of scraped targets that will be accepted.
      • setTargetLimit

        public void setTargetLimit​(Long targetLimit)
        `targetLimit` defines a limit on the number of scraped targets that will be accepted.
      • getAdditionalProperties

        public Map<String,​Object> getAdditionalProperties()
      • setAdditionalProperty

        public void setAdditionalProperty​(String name,
                                          Object value)
      • setAdditionalProperties

        public void setAdditionalProperties​(Map<String,​Object> additionalProperties)