Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdk-contrib-aws: rename classes - use camel case convention #785

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/sdk/aws-resource-detectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ println("```")

println("Detected resource: ")
println("```yaml")
AWSLambdaDetector[IO].detect.unsafeRunSync().foreach { resource =>
AwsLambdaDetector[IO].detect.unsafeRunSync().foreach { resource =>
resource.attributes.toList.sortBy(_.key.name).foreach { attribute =>
println(attribute.key.name + ": " + attribute.value)
}
Expand Down Expand Up @@ -98,7 +98,7 @@ println("```")

println("Detected resource: ")
println("```yaml")
AWSEC2Detector[IO](uri"", client).detect.unsafeRunSync().foreach { resource =>
AwsEc2Detector[IO](uri"", client).detect.unsafeRunSync().foreach { resource =>
resource.attributes.toList.sortBy(_.key.name).foreach { attribute =>
println(attribute.key.name + ": " + attribute.value)
}
Expand Down Expand Up @@ -200,7 +200,7 @@ println("```")

println("Detected resource: ")
println("```yaml")
AWSECSDetector[IO](client).detect.unsafeRunSync().foreach { resource =>
AwsEcsDetector[IO](client).detect.unsafeRunSync().foreach { resource =>
resource.attributes.toList.sortBy(_.key.name).foreach { attribute =>
println(attribute.key.name + ": " + attribute.value)
}
Expand Down Expand Up @@ -241,7 +241,7 @@ println("```yaml")
val detected = Files[IO].tempFile.use { path =>
for {
_ <- fs2.Stream(content).through(fs2.text.utf8.encode).through(Files[IO].writeAll(path)).compile.drain
r <- AWSBeanstalkDetector[IO](path).detect
r <- AwsBeanstalkDetector[IO](path).detect
} yield r
}.unsafeRunSync()

Expand Down Expand Up @@ -311,13 +311,13 @@ object TelemetryApp extends IOApp.Simple {
// register OTLP exporters configurer
_.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
// register AWS Lambda detector
.addResourceDetector(AWSLambdaDetector[IO])
.addResourceDetector(AwsLambdaDetector[IO])
// register AWS EC2 detector
.addResourceDetector(AWSEC2Detector[IO])
.addResourceDetector(AwsEc2Detector[IO])
// register AWS ECS detector
.addResourceDetector(AWSECSDetector[IO])
.addResourceDetector(AwsEcsDetector[IO])
// register AWS Beanstalk detector
.addResourceDetector(AWSBeanstalkDetector[IO])
.addResourceDetector(AwsBeanstalkDetector[IO])
)
.use { autoConfigured =>
val sdk = autoConfigured.sdk
Expand Down Expand Up @@ -351,13 +351,13 @@ object TelemetryApp extends IOApp.Simple {
// register OTLP exporters configurer
_.addExporterConfigurer(OtlpSpanExporterAutoConfigure[IO])
// register AWS Lambda detector
.addResourceDetector(AWSLambdaDetector[IO])
.addResourceDetector(AwsLambdaDetector[IO])
// register AWS EC2 detector
.addResourceDetector(AWSEC2Detector[IO])
.addResourceDetector(AwsEc2Detector[IO])
// register AWS ECS detector
.addResourceDetector(AWSECSDetector[IO])
.addResourceDetector(AwsEcsDetector[IO])
// register AWS Beanstalk detector
.addResourceDetector(AWSBeanstalkDetector[IO])
.addResourceDetector(AwsBeanstalkDetector[IO])
)
.use { autoConfigured =>
program(autoConfigured.tracerProvider)
Expand Down
10 changes: 5 additions & 5 deletions docs/sdk/aws-xray-propagator.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object TelemetryApp extends IOApp.Simple {
_.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
// add AWS X-Ray Propagator
.addTracerProviderCustomizer((b, _) =>
b.addTextMapPropagators(AWSXRayPropagator())
b.addTextMapPropagators(AwsXRayPropagator())
)
)
.use { autoConfigured =>
Expand Down Expand Up @@ -102,7 +102,7 @@ object TelemetryApp extends IOApp.Simple {
_.addExporterConfigurer(OtlpSpanExporterAutoConfigure[IO])
// add AWS X-Ray Propagator
.addTracerProviderCustomizer((b, _) =>
b.addTextMapPropagators(AWSXRayPropagator())
b.addTextMapPropagators(AwsXRayPropagator())
)
)
.use { autoConfigured =>
Expand All @@ -123,7 +123,7 @@ object TelemetryApp extends IOApp.Simple {
AWS Lambda can [utilize][lambda-xray-envvars] `_X_AMZN_TRACE_ID` environment variable or
`com.amazonaws.xray.traceHeader` system property to set the X-Ray tracing header.

Use `AWSXRayLambdaPropagator` in such a case.
Use `AwsXRayLambdaPropagator` in such a case.

@:select(sdk-entry-point)

Expand All @@ -148,7 +148,7 @@ object TelemetryApp extends IOApp.Simple {
_.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
// add AWS X-Ray Lambda Propagator
.addTracerProviderCustomizer((b, _) =>
b.addTextMapPropagators(AWSXRayLambdaPropagator())
b.addTextMapPropagators(AwsXRayLambdaPropagator())
)
)
.use { autoConfigured =>
Expand Down Expand Up @@ -184,7 +184,7 @@ object TelemetryApp extends IOApp.Simple {
_.addExporterConfigurer(OtlpSpanExporterAutoConfigure[IO])
// add AWS X-Ray Lambda Propagator
.addTracerProviderCustomizer((b, _) =>
b.addTextMapPropagators(AWSXRayLambdaPropagator())
b.addTextMapPropagators(AwsXRayLambdaPropagator())
)
)
.use { autoConfigured =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import org.typelevel.otel4s.sdk.resource.TelemetryResourceDetector
import org.typelevel.otel4s.semconv.SchemaUrls
import org.typelevel.otel4s.semconv.attributes.ServiceAttributes

private class AWSBeanstalkDetector[F[_]: Concurrent: Files: Console] private (
private class AwsBeanstalkDetector[F[_]: Concurrent: Files: Console] private (
path: Path
) extends TelemetryResourceDetector[F] {

import AWSBeanstalkDetector.Const
import AWSBeanstalkDetector.Keys
import AWSBeanstalkDetector.Metadata
import AwsBeanstalkDetector.Const
import AwsBeanstalkDetector.Keys
import AwsBeanstalkDetector.Metadata

def name: String = Const.Name

Expand All @@ -47,7 +47,7 @@ private class AWSBeanstalkDetector[F[_]: Concurrent: Files: Console] private (
.exists(path)
.ifM(
parseFile,
Console[F].errorln(s"AWSBeanstalkDetector: config file doesn't exist at path $path").as(None)
Console[F].errorln(s"AwsBeanstalkDetector: config file doesn't exist at path $path").as(None)
)

private def parseFile: F[Option[TelemetryResource]] =
Expand All @@ -56,7 +56,7 @@ private class AWSBeanstalkDetector[F[_]: Concurrent: Files: Console] private (
resource <- io.circe.parser
.decode[Metadata](content)
.fold(
e => Console[F].errorln(show"AWSBeanstalkDetector: cannot parse metadata from $path. $e").as(None),
e => Console[F].errorln(show"AwsBeanstalkDetector: cannot parse metadata from $path. $e").as(None),
m => Concurrent[F].pure(Some(build(m)))
)
} yield resource
Expand All @@ -76,7 +76,7 @@ private class AWSBeanstalkDetector[F[_]: Concurrent: Files: Console] private (

}

object AWSBeanstalkDetector {
object AwsBeanstalkDetector {

private object Const {
val Name = "aws-beanstalk"
Expand Down Expand Up @@ -122,7 +122,7 @@ object AWSBeanstalkDetector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS Beanstalk detector
* .addResourceDetector(AWSBeanstalkDetector[IO])
* .addResourceDetector(AwsBeanstalkDetector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -131,7 +131,7 @@ object AWSBeanstalkDetector {
* }}}
*/
def apply[F[_]: Concurrent: Files: Console]: TelemetryResourceDetector[F] =
new AWSBeanstalkDetector[F](Path(Const.ConfigFilePath))
new AwsBeanstalkDetector[F](Path(Const.ConfigFilePath))

/** The detector parses environment details from the file at the given `path`.
*
Expand All @@ -147,7 +147,7 @@ object AWSBeanstalkDetector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS Beanstalk detector
* .addResourceDetector(AWSBeanstalkDetector[IO])
* .addResourceDetector(AwsBeanstalkDetector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -156,6 +156,6 @@ object AWSBeanstalkDetector {
* }}}
*/
def apply[F[_]: Concurrent: Files: Console](path: Path): TelemetryResourceDetector[F] =
new AWSBeanstalkDetector[F](path)
new AwsBeanstalkDetector[F](path)

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ import org.typelevel.otel4s.semconv.SchemaUrls

import scala.concurrent.duration._

private class AWSEC2Detector[F[_]: Async: Network: Console] private (
private class AwsEc2Detector[F[_]: Async: Network: Console] private (
baseUri: Uri,
customClient: Option[Client[F]]
) extends TelemetryResourceDetector[F] {

import AWSEC2Detector.Const
import AWSEC2Detector.Keys
import AWSEC2Detector.IdentityMetadata
import AwsEc2Detector.Const
import AwsEc2Detector.Keys
import AwsEc2Detector.IdentityMetadata

def name: String = Const.Name

def detect: F[Option[TelemetryResource]] =
mkClient.use { client =>
retrieve(client).handleErrorWith { e =>
Console[F]
.errorln(s"AWSEC2Detector: cannot retrieve metadata from $baseUri due to ${e.getMessage}")
.errorln(s"AwsEc2Detector: cannot retrieve metadata from $baseUri due to ${e.getMessage}")
.as(None)
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@ private class AWSEC2Detector[F[_]: Async: Network: Console] private (

}

object AWSEC2Detector {
object AwsEc2Detector {

private object Const {
val Name = "aws-ec2"
Expand Down Expand Up @@ -180,7 +180,7 @@ object AWSEC2Detector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS EC2 detector
* .addResourceDetector(AWSEC2Detector[IO])
* .addResourceDetector(AwsEc2Detector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -192,7 +192,7 @@ object AWSEC2Detector {
* [[https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html]]
*/
def apply[F[_]: Async: Network: Console]: TelemetryResourceDetector[F] =
new AWSEC2Detector[F](Const.MetadataEndpoint, None)
new AwsEc2Detector[F](Const.MetadataEndpoint, None)

/** The detector fetches instance metadata from the given `baseUri` using the given `client`.
*
Expand All @@ -203,7 +203,7 @@ object AWSEC2Detector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS EC2 detector
* .addResourceDetector(AWSEC2Detector[IO])
* .addResourceDetector(AwsEc2Detector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -215,6 +215,6 @@ object AWSEC2Detector {
* [[https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html]]
*/
def apply[F[_]: Async: Network: Console](baseUri: Uri, client: Client[F]): TelemetryResourceDetector[F] =
new AWSEC2Detector[F](baseUri, Some(client))
new AwsEc2Detector[F](baseUri, Some(client))

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ import org.typelevel.otel4s.semconv.SchemaUrls

import scala.concurrent.duration._

private class AWSECSDetector[F[_]: Async: Network: Env: Console] private (
private class AwsEcsDetector[F[_]: Async: Network: Env: Console] private (
customClient: Option[Client[F]]
) extends TelemetryResourceDetector[F] {

import AWSECSDetector.Const
import AWSECSDetector.Keys
import AWSECSDetector.ContainerMetadata
import AWSECSDetector.TaskMetadata
import AwsEcsDetector.Const
import AwsEcsDetector.Keys
import AwsEcsDetector.ContainerMetadata
import AwsEcsDetector.TaskMetadata

private implicit val containerDecoder: EntityDecoder[F, ContainerMetadata] = accumulatingJsonOf
private implicit val taskDecoder: EntityDecoder[F, TaskMetadata] = accumulatingJsonOf
Expand All @@ -59,7 +59,7 @@ private class AWSECSDetector[F[_]: Async: Network: Env: Console] private (
mkClient.use { client =>
retrieve(client, uri).handleErrorWith { e =>
Console[F]
.errorln(s"AWSECSDetector: cannot retrieve metadata from $uri due to ${e.getMessage}")
.errorln(s"AwsEcsDetector: cannot retrieve metadata from $uri due to ${e.getMessage}")
.as(None)
}
}
Expand Down Expand Up @@ -149,7 +149,7 @@ private class AWSECSDetector[F[_]: Async: Network: Env: Console] private (
}
}

object AWSECSDetector {
object AwsEcsDetector {

private object Const {
val Name = "aws-ecs"
Expand Down Expand Up @@ -195,7 +195,7 @@ object AWSECSDetector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS ECS detector
* .addResourceDetector(AWSECSDetector[IO])
* .addResourceDetector(AwsEcsDetector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -210,7 +210,7 @@ object AWSECSDetector {
* [[https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html]]
*/
def apply[F[_]: Async: Network: Env: Console]: TelemetryResourceDetector[F] =
new AWSECSDetector[F](None)
new AwsEcsDetector[F](None)

/** The detector fetches ECS container and task metadata using the given `client`.
*
Expand All @@ -223,7 +223,7 @@ object AWSECSDetector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS ECS detector
* .addResourceDetector(AWSECSDetector[IO])
* .addResourceDetector(AwsEcsDetector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -238,7 +238,7 @@ object AWSECSDetector {
* [[https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html]]
*/
def apply[F[_]: Async: Network: Env: Console](client: Client[F]): TelemetryResourceDetector[F] =
new AWSECSDetector[F](Some(client))
new AwsEcsDetector[F](Some(client))

private final case class ContainerMetadata(
dockerId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import org.typelevel.otel4s.sdk.TelemetryResource
import org.typelevel.otel4s.sdk.resource.TelemetryResourceDetector
import org.typelevel.otel4s.semconv.SchemaUrls

private class AWSLambdaDetector[F[_]: Env: Monad] extends TelemetryResourceDetector[F] {
private class AwsLambdaDetector[F[_]: Env: Monad] extends TelemetryResourceDetector[F] {

import AWSLambdaDetector.Const
import AWSLambdaDetector.Keys
import AwsLambdaDetector.Const
import AwsLambdaDetector.Keys

def name: String = Const.Name

Expand Down Expand Up @@ -59,7 +59,7 @@ private class AWSLambdaDetector[F[_]: Env: Monad] extends TelemetryResourceDetec
}
}

object AWSLambdaDetector {
object AwsLambdaDetector {

private object Const {
val Name = "aws-lambda"
Expand Down Expand Up @@ -87,7 +87,7 @@ object AWSLambdaDetector {
* // register OTLP exporters configurer
* _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
* // register AWS Lambda detector
* .addResourceDetector(AWSLambdaDetector[IO])
* .addResourceDetector(AwsLambdaDetector[IO])
* )
* .use { autoConfigured =>
* val sdk = autoConfigured.sdk
Expand All @@ -96,6 +96,6 @@ object AWSLambdaDetector {
* }}}
*/
def apply[F[_]: Env: Monad]: TelemetryResourceDetector[F] =
new AWSLambdaDetector[F]
new AwsLambdaDetector[F]

}
Loading