Skip to content

Commit

Permalink
Merge pull request #770 from iRevive/semconv/metrics
Browse files Browse the repository at this point in the history
semconv-metrics: fix package of the experimental metrics
  • Loading branch information
iRevive authored Sep 11, 2024
2 parents 8d43476 + 0fac6db commit 87b7652
Show file tree
Hide file tree
Showing 17 changed files with 139 additions and 326 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@

package org.typelevel.otel4s
package semconv
{%- if params.experimental == true %}
package experimental
package metrics
{%- else %}
package metrics
{%- endif %}

import org.typelevel.otel4s.metrics._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ params:
excluded_attributes: ["messaging.client_id"]
excluded_stability: ["experimental", "deprecated"] # stable - ["experimental", "deprecated"]; experimental - []
object_prefix: "" # stable - "", experimental - "Experimental"
experimental: false # stable - false, experimental - true
comment_formats:
scaladoc:
format: html
Expand Down
3 changes: 2 additions & 1 deletion project/SemanticConventionsGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ object SemanticConventionsGenerator {
if (experimental)
List(
"--param=excluded_stability=[]",
"--param=object_prefix=Experimental"
"--param=object_prefix=Experimental",
"--param=experimental=true"
)
else
Nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.typelevel.otel4s
package semconv
package experimental
package metrics

import org.typelevel.otel4s.metrics._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.typelevel.otel4s
package semconv
package experimental
package metrics

import org.typelevel.otel4s.metrics._
Expand All @@ -28,8 +29,7 @@ object DbExperimentalMetrics {
object ClientConnectionCount {

val Name = "db.client.connection.count"
val Description =
"The number of connections that are currently in state described by the `state` attribute"
val Description = "The number of connections that are currently in state described by the `state` attribute"
val Unit = "{connection}"

object AttributeSpecs {
Expand Down Expand Up @@ -110,9 +110,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -250,8 +248,7 @@ object DbExperimentalMetrics {
object ClientConnectionPendingRequests {

val Name = "db.client.connection.pending_requests"
val Description =
"The number of pending requests for an open connection, cumulative for the entire pool"
val Description = "The number of pending requests for an open connection, cumulative for the entire pool"
val Unit = "{request}"

object AttributeSpecs {
Expand Down Expand Up @@ -292,8 +289,7 @@ object DbExperimentalMetrics {
object ClientConnectionTimeouts {

val Name = "db.client.connection.timeouts"
val Description =
"The number of connection timeouts that have occurred trying to obtain a connection from the pool"
val Description = "The number of connection timeouts that have occurred trying to obtain a connection from the pool"
val Unit = "{timeout}"

object AttributeSpecs {
Expand Down Expand Up @@ -334,8 +330,7 @@ object DbExperimentalMetrics {
object ClientConnectionUseTime {

val Name = "db.client.connection.use_time"
val Description =
"The time between borrowing a connection and returning it to the pool"
val Description = "The time between borrowing a connection and returning it to the pool"
val Unit = "s"

object AttributeSpecs {
Expand All @@ -362,9 +357,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand All @@ -379,8 +372,7 @@ object DbExperimentalMetrics {
object ClientConnectionWaitTime {

val Name = "db.client.connection.wait_time"
val Description =
"The time it took to obtain an open connection from the pool"
val Description = "The time it took to obtain an open connection from the pool"
val Unit = "s"

object AttributeSpecs {
Expand All @@ -407,9 +399,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand All @@ -421,10 +411,7 @@ object DbExperimentalMetrics {

/** Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`.
*/
@deprecated(
"Replaced by `db.client.connection.create_time`. Note: the unit also changed from `ms` to `s`.",
""
)
@deprecated("Replaced by `db.client.connection.create_time`. Note: the unit also changed from `ms` to `s`.", "")
object ClientConnectionsCreateTime {

val Name = "db.client.connections.create_time"
Expand Down Expand Up @@ -453,9 +440,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -588,8 +573,7 @@ object DbExperimentalMetrics {
object ClientConnectionsPendingRequests {

val Name = "db.client.connections.pending_requests"
val Description =
"Deprecated, use `db.client.connection.pending_requests` instead."
val Description = "Deprecated, use `db.client.connection.pending_requests` instead."
val Unit = "{request}"

object AttributeSpecs {
Expand Down Expand Up @@ -716,10 +700,7 @@ object DbExperimentalMetrics {

/** Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`.
*/
@deprecated(
"Replaced by `db.client.connection.use_time`. Note: the unit also changed from `ms` to `s`.",
""
)
@deprecated("Replaced by `db.client.connection.use_time`. Note: the unit also changed from `ms` to `s`.", "")
object ClientConnectionsUseTime {

val Name = "db.client.connections.use_time"
Expand Down Expand Up @@ -748,9 +729,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand All @@ -762,10 +741,7 @@ object DbExperimentalMetrics {

/** Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from `ms` to `s`.
*/
@deprecated(
"Replaced by `db.client.connection.wait_time`. Note: the unit also changed from `ms` to `s`.",
""
)
@deprecated("Replaced by `db.client.connection.wait_time`. Note: the unit also changed from `ms` to `s`.", "")
object ClientConnectionsWaitTime {

val Name = "db.client.connections.wait_time"
Expand Down Expand Up @@ -794,9 +770,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -912,9 +886,7 @@ object DbExperimentalMetrics {
"server_certificate_invalid",
"500",
),
Requirement.conditionallyRequired(
"If and only if the operation failed."
),
Requirement.conditionallyRequired("If and only if the operation failed."),
Stability.stable
)

Expand Down Expand Up @@ -944,9 +916,7 @@ object DbExperimentalMetrics {
List(
65123,
),
Requirement.recommended(
"If and only if `network.peer.address` is set."
),
Requirement.recommended("If and only if `network.peer.address` is set."),
Stability.stable
)

Expand Down Expand Up @@ -1000,9 +970,7 @@ object DbExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.typelevel.otel4s
package semconv
package experimental
package metrics

import org.typelevel.otel4s.metrics._
Expand Down Expand Up @@ -66,9 +67,7 @@ object DnsExperimentalMetrics {
"no_recovery",
"java.net.UnknownHostException",
),
Requirement.conditionallyRequired(
"if and only if an error has occurred."
),
Requirement.conditionallyRequired("if and only if an error has occurred."),
Stability.stable
)

Expand All @@ -79,9 +78,7 @@ object DnsExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.typelevel.otel4s
package semconv
package experimental
package metrics

import org.typelevel.otel4s.metrics._
Expand Down Expand Up @@ -86,9 +87,7 @@ object FaasExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -139,8 +138,7 @@ object FaasExperimentalMetrics {
object InitDuration {

val Name = "faas.init_duration"
val Description =
"Measures the duration of the function's initialization, such as a cold start"
val Description = "Measures the duration of the function's initialization, such as a cold start"
val Unit = "s"

object AttributeSpecs {
Expand All @@ -162,9 +160,7 @@ object FaasExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -237,9 +233,7 @@ object FaasExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -276,9 +270,7 @@ object FaasExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down Expand Up @@ -315,9 +307,7 @@ object FaasExperimentalMetrics {
)
}

def create[F[_]: Meter](
boundaries: BucketBoundaries
): F[Histogram[F, Double]] =
def create[F[_]: Meter](boundaries: BucketBoundaries): F[Histogram[F, Double]] =
Meter[F]
.histogram[Double](Name)
.withDescription(Description)
Expand Down
Loading

0 comments on commit 87b7652

Please sign in to comment.