Giter VIP home page Giter VIP logo

axiom-lambda-extension's People

Contributors

a-khaledf avatar bahlo avatar lukasmalkmus avatar nikita-tech-writer avatar schehata avatar thecraftman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

raychorn

axiom-lambda-extension's Issues

use a config struct instead of a raw global in main.go

          also, this is separate but how do we feel about using a struct instead of this global variable?

like, instead of this:

var (
	runtimeAPI        = os.Getenv("AWS_LAMBDA_RUNTIME_API")
	extensionName     = filepath.Base(os.Args[0])
	isFirstInvocation = true
	runtimeDone       = make(chan struct{})

	// API Port
	logsPort = "8080"

	// Buffering Config
	defaultMaxItems  = 1000
	defaultMaxBytes  = 262144
	defaultTimeoutMS = 1000

	developmentMode = false
	logger          *zap.Logger
)

something more like:

type Config struct {
    RuntimeAPI        string
    ExtensionName     string
    IsFirstInvocation bool
    LogsPort          string
    MaxItems          int
    MaxBytes          int
    TimeoutMS         int
    DevelopmentMode   bool
    Logger            *zap.Logger
    RuntimeDone       chan struct{}
}

var cfg = Config{
    RuntimeAPI:        os.Getenv("AWS_LAMBDA_RUNTIME_API"),
    ExtensionName:     filepath.Base(os.Args[0]),
    IsFirstInvocation: true,
    LogsPort:          "8080",
    MaxItems:          1000,
    MaxBytes:          262144,
    TimeoutMS:         1000,
    DevelopmentMode:   false,
    RuntimeDone:       make(chan struct{}),
}

and then used like

cfg.Logger.Error('ex')

Originally posted by @flbn in #17 (comment)

Serverless and axiom-lambda-extension

Hi there,

I'm trying to use your plugin with the serverless framework.
Basically I'm doing something like:

service: app

frameworkVersion: '3'
useDotenv: true

plugins:
  - serverless-plugin-typescript
  - serverless-plugin-optimize
  - serverless-extra-parameters
  - serverless-offline

package:
  excludeDevDependencies: true
  individually: true
  patterns:
    - '!**/node_modules/@aws-sdk/**'

provider:
  name: aws
  runtime: nodejs18.x
  architecture: arm64
  region: ${opt:region, 'eu-central-1'}
  stage: ${opt:stage, 'dev'}
  stackName: dev-app
  layers:
    axiom:
      path: arn:aws:lambda:${self:provider.region}:694952825951:layer:axiom-extension-arm64:4
      name: axiom-layer
      description: Axiom unlocks observability at any scale.
  environment:
    AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1
    AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1
    LOG_LEVEL: debug
    NODE_ENV: production
    NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000'
    AXIOM_TOKEN: ${ssm:/${self:provider.stage}/AXIOM_TOKEN}
    AXIOM_DATASET: 'app'

functions:
  api:
    handler: ./src/events/api.handler
    description: 'REST API / GraphQL handler'
    events:
      - httpApi:
          path: /{proxy+}
          method: ANY

But unfortunately when I'm trying to deploy my lambda (using sls deploy command) I'm getting error:

Error:
No file matches include / exclude patterns
image

Any idea what's wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.