GithubHelp home page GithubHelp logo

qpc-github / opentelemetry-operations-e2e-testing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/opentelemetry-operations-e2e-testing

1.0 2.0 1.0 352 KB

License: Apache License 2.0

Go 64.41% HCL 32.27% Dockerfile 3.32%

opentelemetry-operations-e2e-testing's Introduction

opentelemetry-operations-e2e-testing

This project contains a test runner and configuration which are used for testing GCP's OpenTelemetry exporters, resource detectors, propagators, etc. These tests are run in pull requests to the other GoogleCloudPlatform/opentelemtry-operations-* repos.

The code in this repository is only for testing purposes! This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.

Run locally

Build the docker image locally:

docker build . -t opentelemetry-operations-e2e-testing:local

Run the image with a test server, e.g. with the python instrumented test server from a recent build:

PROJECT_ID="opentelemetry-ops-e2e"
GOOGLE_APPLICATION_CREDENTIALS="${HOME}/.config/gcloud/application_default_credentials.json"

# Using a recent python build for example. Alternatively, use a locally built
# test server.
INSTRUMENTED_TEST_SERVER="gcr.io/opentelemetry-ops-e2e/opentelemetry-operations-python-e2e-test-server:45ccd1d"

# Pull the image if it doesn't exist locally
docker pull ${INSTRUMENTED_TEST_SERVER}
docker run \
    -e "GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS}" \
    -v "${GOOGLE_APPLICATION_CREDENTIALS}:${GOOGLE_APPLICATION_CREDENTIALS}:ro" \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e PROJECT_ID=${PROJECT_ID} \
    --rm \
    opentelemetry-operations-e2e-testing:local \
    local \
    --image=${INSTRUMENTED_TEST_SERVER}

Run locally (in Google Cloud Functions)

Since running in cloud functions require you to upload a zipped file containing the source code, steps to trigger test runs in a cloud function environment are slightly different from running in a local environment.

Build the docker image locally:

docker build . -t opentelemetry-operations-e2e-testing:local

Make sure you have the proper environment variables setup:

PROJECT_ID="opentelemetry-ops-e2e"
GOOGLE_APPLICATION_CREDENTIALS="${HOME}/.config/gcloud/application_default_credentials.json"

Run the image with a test server provided through the zip file. The following docker command makes the following assumptions:

  • You have the source code for your function zipped in a file named function-source.zip
  • You have this zip file placed in a folder called function-deployment within your current directory (from where you run this command)
  • Your function code is written for java11 environment.
    • The entrypoint for your java function is com.google.cloud.opentelemetry.endtoend.CloudFunctionHandler.
docker run \
    -e PROJECT_ID=${PROJECT_ID} \
    -e GOOGLE_APPLICATION_CREDENTIALS=${GOOGLE_APPLICATION_CREDENTIALS} \
    -v "${GOOGLE_APPLICATION_CREDENTIALS}:${GOOGLE_APPLICATION_CREDENTIALS}:ro" \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v "$(pwd)/function-deployment/function-source.zip:/function-source.zip" \ 
    -it \
    --rm \
    opentelemetry-operations-e2e-testing:local \
    cloud-functions-gen2 \
    --runtime=java11 \
    --functionsource="/function-source.zip" \
    --entrypoint=com.google.cloud.opentelemetry.endtoend.CloudFunctionHandler

NOTE: If you are using Java, you can also use a generated JAR to deploy the function. However, you would still need zip the JAR and the JAR should be at the root of the zip. For more information look at the How to guides for Google Cloud Functions.

Matrix of implemented scenarios

Contributing

See docs/contributing.md for details.

License

Apache 2.0; see LICENSE for details.

Disclaimer

This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.

opentelemetry-operations-e2e-testing's People

Contributors

aabmass avatar dashpole avatar jsuereth avatar psx95 avatar tbarker25 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.