@@ -489,6 +489,122 @@ object K8sExperimentalAttributes {
489489 val K8sResourcequotaUid : AttributeKey [String ] =
490490 AttributeKey (" k8s.resourcequota.uid" )
491491
492+ /** The annotation placed on the Service, the `<key>` being the annotation name, the value being the annotation value,
493+ * even if the value is empty.
494+ *
495+ * @note
496+ * <p> Examples: <ul> <li>An annotation `prometheus.io/scrape` with value `true` SHOULD be recorded as the
497+ * `k8s.service.annotation.prometheus.io/scrape` attribute with value `"true"`. <li>An annotation `data` with empty
498+ * string value SHOULD be recorded as the `k8s.service.annotation.data` attribute with value `""`. </ul>
499+ */
500+ val K8sServiceAnnotation : AttributeKey [String ] =
501+ AttributeKey (" k8s.service.annotation" )
502+
503+ /** The address type of the service endpoint.
504+ *
505+ * @note
506+ * <p> The network address family or type of the endpoint. This attribute aligns with the `addressType` field of
507+ * the <a href="https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/">K8s
508+ * EndpointSlice</a>. It is used to differentiate metrics when a Service is backed by multiple address types (e.g.,
509+ * in dual-stack clusters).
510+ */
511+ val K8sServiceEndpointAddressType : AttributeKey [String ] =
512+ AttributeKey (" k8s.service.endpoint.address_type" )
513+
514+ /** The condition of the service endpoint.
515+ *
516+ * @note
517+ * <p> The current operational condition of the service endpoint. An endpoint can have multiple conditions set at
518+ * once (e.g., both `serving` and `terminating` during rollout). This attribute aligns with the condition fields in
519+ * the <a href="https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/">K8s
520+ * EndpointSlice</a>.
521+ */
522+ val K8sServiceEndpointCondition : AttributeKey [String ] =
523+ AttributeKey (" k8s.service.endpoint.condition" )
524+
525+ /** The zone of the service endpoint.
526+ *
527+ * @note
528+ * <p> The zone where the endpoint is located, typically corresponding to a failure domain. This attribute aligns
529+ * with the `zone` field of endpoints in the <a
530+ * href="https://kubernetes.io/docs/reference/kubernetes-api/service-resources/endpoint-slice-v1/">K8s
531+ * EndpointSlice</a>. It enables zone-aware monitoring of service endpoint distribution and supports features like
532+ * <a href="https://kubernetes.io/docs/concepts/services-networking/topology-aware-routing/">Topology Aware
533+ * Routing</a>. <p> If the zone is not populated (e.g., nodes without the `topology.kubernetes.io/zone` label), the
534+ * attribute value will be an empty string.
535+ */
536+ val K8sServiceEndpointZone : AttributeKey [String ] =
537+ AttributeKey (" k8s.service.endpoint.zone" )
538+
539+ /** The label placed on the Service, the `<key>` being the label name, the value being the label value, even if the
540+ * value is empty.
541+ *
542+ * @note
543+ * <p> Examples: <ul> <li>A label `app` with value `my-service` SHOULD be recorded as the `k8s.service.label.app`
544+ * attribute with value `"my-service"`. <li>A label `data` with empty string value SHOULD be recorded as the
545+ * `k8s.service.label.data` attribute with value `""`. </ul>
546+ */
547+ val K8sServiceLabel : AttributeKey [String ] =
548+ AttributeKey (" k8s.service.label" )
549+
550+ /** The name of the Service.
551+ */
552+ val K8sServiceName : AttributeKey [String ] =
553+ AttributeKey (" k8s.service.name" )
554+
555+ /** Whether the Service publishes not-ready endpoints.
556+ *
557+ * @note
558+ * <p> Whether the Service is configured to publish endpoints before the pods are ready. This attribute is
559+ * typically used to indicate that a Service (such as a headless Service for a StatefulSet) allows peer discovery
560+ * before pods pass their readiness probes. It aligns with the `publishNotReadyAddresses` field of the <a
561+ * href="https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/#ServiceSpec">K8s
562+ * ServiceSpec</a>.
563+ */
564+ val K8sServicePublishNotReadyAddresses : AttributeKey [Boolean ] =
565+ AttributeKey (" k8s.service.publish_not_ready_addresses" )
566+
567+ /** The selector key-value pair placed on the Service, the `<key>` being the selector key, the value being the
568+ * selector value.
569+ *
570+ * @note
571+ * <p> These selectors are used to correlate with pod labels. Each selector key-value pair becomes a separate
572+ * attribute. <p> Examples: <ul> <li>A selector `app=my-app` SHOULD be recorded as the `k8s.service.selector.app`
573+ * attribute with value `"my-app"`. <li>A selector `version=v1` SHOULD be recorded as the
574+ * `k8s.service.selector.version` attribute with value `"v1"`. </ul>
575+ */
576+ val K8sServiceSelector : AttributeKey [String ] =
577+ AttributeKey (" k8s.service.selector" )
578+
579+ /** The traffic distribution policy for the Service.
580+ *
581+ * @note
582+ * <p> Specifies how traffic is distributed to endpoints for this Service. This attribute aligns with the
583+ * `trafficDistribution` field of the <a
584+ * href="https://kubernetes.io/docs/reference/networking/virtual-ips/#traffic-distribution">K8s ServiceSpec</a>.
585+ * Known values include `PreferSameZone` (prefer endpoints in the same zone as the client) and `PreferSameNode`
586+ * (prefer endpoints on the same node, fallback to same zone, then cluster-wide). If this field is not set on the
587+ * Service, the attribute SHOULD NOT be emitted. When not set, Kubernetes distributes traffic evenly across all
588+ * endpoints cluster-wide.
589+ */
590+ val K8sServiceTrafficDistribution : AttributeKey [String ] =
591+ AttributeKey (" k8s.service.traffic_distribution" )
592+
593+ /** The type of the Kubernetes Service.
594+ *
595+ * @note
596+ * <p> This attribute aligns with the `type` field of the <a
597+ * href="https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/#ServiceSpec">K8s
598+ * ServiceSpec</a>.
599+ */
600+ val K8sServiceType : AttributeKey [String ] =
601+ AttributeKey (" k8s.service.type" )
602+
603+ /** The UID of the Service.
604+ */
605+ val K8sServiceUid : AttributeKey [String ] =
606+ AttributeKey (" k8s.service.uid" )
607+
492608 /** The annotation placed on the StatefulSet, the `<key>` being the annotation name, the value being the annotation
493609 * value, even if the value is empty.
494610 *
@@ -725,6 +841,69 @@ object K8sExperimentalAttributes {
725841 case object UnexpectedAdmissionError extends K8sPodStatusReasonValue (" UnexpectedAdmissionError" )
726842 }
727843
844+ /** Values for [[K8sServiceEndpointAddressType ]].
845+ */
846+ abstract class K8sServiceEndpointAddressTypeValue (val value : String )
847+ object K8sServiceEndpointAddressTypeValue {
848+ implicit val attributeFromK8sServiceEndpointAddressTypeValue
849+ : Attribute .From [K8sServiceEndpointAddressTypeValue , String ] = _.value
850+
851+ /** IPv4 address type
852+ */
853+ case object Ipv4 extends K8sServiceEndpointAddressTypeValue (" IPv4" )
854+
855+ /** IPv6 address type
856+ */
857+ case object Ipv6 extends K8sServiceEndpointAddressTypeValue (" IPv6" )
858+
859+ /** FQDN address type
860+ */
861+ case object Fqdn extends K8sServiceEndpointAddressTypeValue (" FQDN" )
862+ }
863+
864+ /** Values for [[K8sServiceEndpointCondition ]].
865+ */
866+ abstract class K8sServiceEndpointConditionValue (val value : String )
867+ object K8sServiceEndpointConditionValue {
868+ implicit val attributeFromK8sServiceEndpointConditionValue
869+ : Attribute .From [K8sServiceEndpointConditionValue , String ] = _.value
870+
871+ /** The endpoint is ready to receive new connections.
872+ */
873+ case object Ready extends K8sServiceEndpointConditionValue (" ready" )
874+
875+ /** The endpoint is currently handling traffic.
876+ */
877+ case object Serving extends K8sServiceEndpointConditionValue (" serving" )
878+
879+ /** The endpoint is in the process of shutting down.
880+ */
881+ case object Terminating extends K8sServiceEndpointConditionValue (" terminating" )
882+ }
883+
884+ /** Values for [[K8sServiceType ]].
885+ */
886+ abstract class K8sServiceTypeValue (val value : String )
887+ object K8sServiceTypeValue {
888+ implicit val attributeFromK8sServiceTypeValue : Attribute .From [K8sServiceTypeValue , String ] = _.value
889+
890+ /** ClusterIP service type
891+ */
892+ case object ClusterIp extends K8sServiceTypeValue (" ClusterIP" )
893+
894+ /** NodePort service type
895+ */
896+ case object NodePort extends K8sServiceTypeValue (" NodePort" )
897+
898+ /** LoadBalancer service type
899+ */
900+ case object LoadBalancer extends K8sServiceTypeValue (" LoadBalancer" )
901+
902+ /** ExternalName service type
903+ */
904+ case object ExternalName extends K8sServiceTypeValue (" ExternalName" )
905+ }
906+
728907 /** Values for [[K8sVolumeType ]].
729908 */
730909 abstract class K8sVolumeTypeValue (val value : String )
0 commit comments