Skip to content

Commit

Permalink
feat: migrate example to otel instrumentation instead of X-Ray SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h committed Jul 23, 2022
1 parent 0585104 commit c45b98e
Show file tree
Hide file tree
Showing 4 changed files with 478 additions and 102 deletions.
8 changes: 5 additions & 3 deletions example/cdk/example.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"fmt"

"github.com/aws/aws-cdk-go/awscdk/v2"
"github.com/aws/aws-cdk-go/awscdk/v2/awslambda"
awsapigatewayv2 "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2"
Expand All @@ -24,10 +26,10 @@ func NewExampleStack(scope constructs.Construct, id string, props *awscdk.StackP
MemorySize: jsii.Number(1024),
Timeout: awscdk.Duration_Millis(jsii.Number(15000)),
Tracing: awslambda.Tracing_ACTIVE,
Environment: &map[string]*string{
"AWS_XRAY_CONTEXT_MISSING": jsii.String("IGNORE_ERROR"),
},
})
otelLambdaLayerARN := fmt.Sprintf("arn:aws:lambda:%s:901920570463:layer:aws-otel-collector-arm64-ver-0-51-0:1", *stack.Region())
otelLambdaLayer := awslambda.LayerVersion_FromLayerVersionArn(stack, jsii.String("otelLambdaLayer"), jsii.String(otelLambdaLayerARN))
f.AddLayers(otelLambdaLayer)
// Add a Function URL.
url := f.AddFunctionUrl(&awslambda.FunctionUrlOptions{
AuthType: awslambda.FunctionUrlAuthType_NONE,
Expand Down
52 changes: 39 additions & 13 deletions example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,58 @@ require (
github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2 v2.31.1-alpha.0
github.com/aws/aws-cdk-go/awscdkapigatewayv2integrationsalpha/v2 v2.31.1-alpha.0
github.com/aws/aws-cdk-go/awscdklambdagoalpha/v2 v2.2.0-alpha.0
github.com/aws/aws-xray-sdk-go v1.6.1-0.20211110224843-1f272e4024a5
github.com/aws/aws-lambda-go v1.32.1
github.com/aws/aws-sdk-go-v2 v1.16.7
github.com/aws/aws-sdk-go-v2/config v1.15.14
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.15.9
github.com/aws/constructs-go/constructs/v10 v10.1.33
github.com/aws/jsii-runtime-go v1.60.1
github.com/joe-davidson1802/zapray v0.0.17-0.20211218172612-ff5bd3fd0d43
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda v0.33.0
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda/xrayconfig v0.33.0
go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.33.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.33.0
go.opentelemetry.io/contrib/propagators/aws v1.8.0
go.opentelemetry.io/otel v1.8.0
go.opentelemetry.io/otel/trace v1.8.0
go.uber.org/zap v1.19.1
golang.org/x/net v0.0.0-20210510120150-4163338589ed
)

require (
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/andybalholm/brotli v1.0.2 // indirect
github.com/aws/aws-lambda-go v1.32.1 // indirect
github.com/aws/aws-sdk-go v1.17.12 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9 // indirect
github.com/aws/smithy-go v1.12.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.13.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.31.0 // indirect
go.opentelemetry.io/contrib/detectors/aws/lambda v0.33.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.8.0 // indirect
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.opentelemetry.io/otel/sdk v1.8.0 // indirect
go.opentelemetry.io/proto/otlp v0.18.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f // indirect
google.golang.org/grpc v1.35.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
)

replace github.com/a-h/awsapigatewayv2handler => ../
Loading

0 comments on commit c45b98e

Please sign in to comment.