VOOZH about

URL: https://pypi.org/project/opencensus-extension-azure-functions/

⇱ opencensus-extension-azure-functions Β· PyPI


Skip to main content

opencensus-extension-azure-functions 1.0.0

pip install opencensus-extension-azure-functions

Latest release

Released:

OpenCensus extension for Azure Functions

Navigation

Verified details

These details have been verified by PyPI
Maintainers
πŸ‘ Avatar for LeightonC from gravatar.com
LeightonC

Unverified details

These details have not been verified by PyPI
Project links
Meta

Project description

πŸ‘ pypi

Installation

pip install opencensus-extension-azure-functions

Prerequisites

Install azure-functions-core-tools or Azure Functions vscode-extension.

How To Use In Python Functions

  1. Use func init --python or VSCode Extensions Blade -> Azure -> Functions -> Create New Project... to create a Python function app.

  2. Use func new -a anonymous -t HttpTrigger -n HttpTrigger to create an anonymous Http trigger in your function app. If you’re using VSCode, the project creation wizard will guide you through the same process.

  3. Include opencensus-extension-azure-functions and requests to your requirements.txt.

  4. In local.settings.json, add new settings "PYTHON_ENABLE_WORKER_DEPENDENCIES": "1" and "APPLICATIONINSIGHTS_CONNECTION_STRING": "InstrumentationKey=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee". You can acquire your appinsights instrumentation key from your Azure Application Insights resource.

  5. Set up a virtual environment for your local development
    1. Create a virtual environment with py -3.7 -m venv .venv in Windows or python3.7 -m venv .venv in Unix-like systems.

    2. Activate the virtual environment with .venv\Scripts\Activate.ps1 in Windows PowerShell or source .venv/bin/activate in Unix-like systems.

  6. Change the HTTP trigger file in <project_root>/HttpTrigger/__init__.py to enable the OpenCensus tracing integration.

import jsonimport loggingfrom opencensus.extension.azure.functions import OpenCensusExtensionlogger = logging.getLogger('HttpTriggerLogger')OpenCensusExtension.configure()def main(req, context): logger.info('Executing HttpTrigger with OpenCensus extension') # You must use context.tracer to create spans with context.tracer.span("parent"): logger.info('Message from HttpTrigger') return json.dumps({ 'method': req.method, 'ctx_func_name': context.function_name, 'ctx_func_dir': context.function_directory, 'ctx_invocation_id': context.invocation_id, 'ctx_trace_context_Traceparent': context.trace_context.Traceparent, 'ctx_trace_context_Tracestate': context.trace_context.Tracestate, })
  1. Run it in your local development environment by func host start --verbose in Core Tools or hitting F5 in VSCode.

  2. You should now be able to check the trace information in your Application Insight -> Investigate -> Application Map.

To use Opencensus Python Extensions in other scenarios, please visit our example folder

References

Project details

Verified details

These details have been verified by PyPI
Maintainers
πŸ‘ Avatar for LeightonC from gravatar.com
LeightonC

Unverified details

These details have not been verified by PyPI
Project links
Meta

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more about wheel file names.

Copy a direct link to the current filters

opencensus_extension_azure_functions-1.0.0-py2.py3-none-any.whl (9.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file opencensus-extension-azure-functions-1.0.0.tar.gz.

File metadata

  • Download URL: opencensus-extension-azure-functions-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9

File hashes

Hashes for opencensus-extension-azure-functions-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8d55e73e594c386920558134c5ec8b1cf0de24a768a39711aed650e23cd1a839
MD5 53f8a6439bd49cba568021a3f48a8230
BLAKE2b-256 b669388dc77bd4535d51019ef26a815b4c3c76eda806eaa334d52a45461c4e37

See more details on using hashes here.

File details

Details for the file opencensus_extension_azure_functions-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for opencensus_extension_azure_functions-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9d480a979ee07c7a50ab072d2712aa18782667fafe242928863cd13eba111f9b
MD5 69725311b1ada4edf6e676920551554d
BLAKE2b-256 d8a4eb2f99051ccc008a94d183bf5459fdcd86d9179c0c667e1e6f8083e9b5fe

See more details on using hashes here.

Supported by

πŸ‘ Image
AWS Cloud computing and Security Sponsor πŸ‘ Image
Datadog Monitoring πŸ‘ Image
Depot Continuous Integration πŸ‘ Image
Fastly CDN πŸ‘ Image
Google Download Analytics πŸ‘ Image
Pingdom Monitoring πŸ‘ Image
Sentry Error logging πŸ‘ Image
StatusPage Status page