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

Working version for Lambda - AWS Managed Prometheus integration #248

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17'
go-version: '^1.18'
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Go for ADOT Collector
uses: actions/setup-go@v2
with:
go-version: '^1.17'
go-version: '^1.18'
- name: Build Python Layer which includes ADOT Collector
working-directory: python/src
run: ./run.sh -b
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# OpenTelemetry Lambda
![GitHub Java Workflow Status](https://img.shields.io/github/workflow/status/open-telemetry/opentelemetry-lambda/Continuous%20Build%20(Java)/main?label=CI%20%28Java%29&style=for-the-badge)
![GitHub Collector Workflow Status](https://img.shields.io/github/workflow/status/open-telemetry/opentelemetry-lambda/Continuous%20Build%20(Collector)/main?label=CI%20%28Collector%29&style=for-the-badge)
![GitHub NodeJS Workflow Status](https://img.shields.io/github/workflow/status/open-telemetry/opentelemetry-lambda/Continuous%20Build%20(NodeJS)/main?label=CI%20%28NodeJS%29&style=for-the-badge)
![GitHub Terraform Lint Workflow Status](https://img.shields.io/github/workflow/status/open-telemetry/opentelemetry-lambda/Continuous%20Build%20(Terraform)/main?label=CI%20%28Terraform%20Lint%29&style=for-the-badge)
![GitHub Python Pull Request Workflow Status](https://img.shields.io/github/workflow/status/open-telemetry/opentelemetry-lambda/Pull%20Request%20(Python)/main?label=Pull%20Request%20%28Python%29&style=for-the-badge)

## OpenTelemetry Lambda Layers
The OpenTelemetry Lambda Layers provide the OpenTelemetry (OTel) code to export telemetry asynchronously from AWS Lambdas. It does this by embedding a stripped-down version of [OpenTelemetry Collector Contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib) inside an [AWS Lambda Extension Layer](https://aws.amazon.com/blogs/compute/introducing-aws-lambda-extensions-in-preview/).

### [Design Proposal](docs/design_proposal.md)
Some layers include the corresponding OTel language SDK for the Lambda. This allows Lambdas to use OpenTelemetry to send traces and metrics to any configured backend.

### [OpenTelemetry Collector extension](collector/README.md)
## Extension Layer Language Support

### [OpenTelemetry Python Lambda support](python/README.md)
* ### [Python + Collector Lambda Layer](python/README.md)
* ### [Java + Collector Lambda Layer](java/README.md)
* ### [NodeJS + Collector Lambda Layer](nodejs/README.md)
* ### [.NET + Collector Lambda Layer](dotnet/README.md)
* ### [Collector Lambda Layer](collector/README.md)

### [OpenTelemetry Java Lambda support](java/README.md)

### [OpenTelemetry NodeJS Lambda support](nodejs/README.md)
## FAQ
* **What exporters/recievers/processors are included from the OpenTelemetry Collector?**
> You can check out [the stripped-down collector's imports](https://github.com/open-telemetry/opentelemetry-lambda/blob/main/collector/lambdacomponents/default.go#L18) in this repository for a full list of currently included components.
* **Is the Lambda layer provided or do I need to build it and distribute it myself?**
> This repository does not provide pre-build Lambda layers. They must be built manually and saved in your AWS account. This repo has files to facilitate doing that. More information is provided in [the Collector folder's README](collector/README.md).

### [OpenTelemetry .Net Lambda support](dotnet/README.md)
## Design Proposal
To get a better understanding of the proposed design for the OpenTelemetry Lamda extension, you can see the [Design Proposal here.](docs/design_proposal.md)
3 changes: 2 additions & 1 deletion collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ GOBUILD=GO111MODULE=on CGO_ENABLED=0 installsuffix=cgo go build -trimpath
BUILD_INFO_IMPORT_PATH=main

LDFLAGS=-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH).GitHash=$(GIT_SHA) -X $(BUILD_INFO_IMPORT_PATH).Version=$(VERSION) \
-X github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter.collectorDistribution=opentelemetry-collector-lambda"
-X github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter.collectorDistribution=opentelemetry-collector-lambda \
-X github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsprometheusremotewriteexporter.collectorDistribution=opentelemetry-collector-lambda"

clean:
rm -rf build/
Expand Down
16 changes: 8 additions & 8 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"os"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/mapconverter/expandmapconverter"
"go.opentelemetry.io/collector/config/mapprovider/envmapprovider"
"go.opentelemetry.io/collector/config/mapprovider/filemapprovider"
"go.opentelemetry.io/collector/config/mapprovider/yamlmapprovider"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/confmap/converter/expandconverter"
"go.opentelemetry.io/collector/confmap/provider/envprovider"
"go.opentelemetry.io/collector/confmap/provider/fileprovider"
"go.opentelemetry.io/collector/confmap/provider/yamlprovider"
"go.opentelemetry.io/collector/service"
)

Expand Down Expand Up @@ -57,8 +57,8 @@ func getConfig() string {
}

func NewCollector(factories component.Factories) *Collector {
providers := []config.MapProvider{filemapprovider.New(), envmapprovider.New(), yamlmapprovider.New()}
mapProvider := make(map[string]config.MapProvider, len(providers))
providers := []confmap.Provider{fileprovider.New(), envprovider.New(), yamlprovider.New()}
mapProvider := make(map[string]confmap.Provider, len(providers))

for _, provider := range providers {
mapProvider[provider.Scheme()] = provider
Expand All @@ -67,7 +67,7 @@ func NewCollector(factories component.Factories) *Collector {
cfgSet := service.ConfigProviderSettings{
Locations: []string{getConfig()},
MapProviders: mapProvider,
MapConverters: []config.MapConverterFunc{expandmapconverter.New()},
MapConverters: []confmap.Converter{expandconverter.New()},
}
cfgProvider, err := service.NewConfigProvider(cfgSet)

Expand Down
8 changes: 7 additions & 1 deletion collector/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ receivers:
exporters:
logging:
loglevel: debug
awsprometheusremotewrite:
# endpoint should point to your Amazon Managed Service for Prometheus endpoint URL - value below is provided for reference
endpoint: "https://aps-workspaces.{REGION}.amazonaws.com/workspaces/ws-00000000-0000-0000-0000-000000000000/api/v1/remote_write"
aws_auth:
service: "aps"
region: "REGION"

service:
pipelines:
Expand All @@ -15,4 +21,4 @@ service:
exporters: [logging]
metrics:
receivers: [otlp]
exporters: [logging]
exporters: [logging, awsprometheusremotewrite]
49 changes: 26 additions & 23 deletions collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ replace github.com/open-telemetry/opentelemetry-lambda/collector/lambdacomponent

require (
github.com/open-telemetry/opentelemetry-lambda/collector/lambdacomponents v0.0.0
go.opentelemetry.io/collector v0.51.0
go.opentelemetry.io/collector v0.54.0
)

require (
cloud.google.com/go/compute v1.6.0 // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
github.com/antonmedv/expr v1.9.0 // indirect
github.com/aws/aws-sdk-go v1.44.38 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
Expand All @@ -31,9 +32,10 @@ require (
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.3 // indirect
github.com/knadh/koanf v1.4.1 // indirect
github.com/klauspost/compress v1.15.6 // indirect
github.com/knadh/koanf v1.4.2 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
Expand All @@ -43,25 +45,26 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.1.16 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.51.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsprometheusremotewriteexporter v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheusremotewrite v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.54.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.54.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/prometheus/common v0.35.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/prometheus/prometheus v1.8.2-0.20220117154355-4855a0c067e2 // indirect
github.com/prometheus/statsd_exporter v0.21.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/shirou/gopsutil/v3 v3.22.4 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/shirou/gopsutil/v3 v3.22.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/gjson v1.10.2 // indirect
Expand All @@ -73,11 +76,10 @@ require (
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/collector/pdata v0.51.0 // indirect
go.opentelemetry.io/collector/semconv v0.51.0 // indirect
go.opentelemetry.io/collector/pdata v0.54.0 // indirect
go.opentelemetry.io/collector/semconv v0.54.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.32.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 // indirect
go.opentelemetry.io/contrib/zpages v0.32.0 // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.30.0 // indirect
go.opentelemetry.io/otel/metric v0.30.0 // indirect
Expand All @@ -87,12 +89,13 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4 // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/genproto v0.0.0-20220524023933-508584e28198 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading