Skip to content

Instantly share code, notes, and snippets.

View ocelotl's full-sized avatar
🎯
Focusing

Diego Hurtado ocelotl

🎯
Focusing
  • San José, Costa Rica
View GitHub Profile
py38-proto3-opentelemetry-exporter-otlp-proto-grpc: 198 W remove tox env folder /home/tigre/github/ocelotl/opentelemetry-python/.tox/py38-proto3-opentelemetry-exporter-otlp-proto-grpc [tox/tox_env/api.py:323]
py38-proto3-opentelemetry-exporter-otlp-proto-grpc: 261 I find interpreter for spec PythonSpec(major=3, minor=8) [virtualenv/discovery/builtin.py:58]
py38-proto3-opentelemetry-exporter-otlp-proto-grpc: 261 I proposed PythonInfo(spec=CPython3.11.2.final.0-64, exe=/home/tigre/.pyenv/versions/3.11.2/bin/python3.11, platform=linux, version='3.11.2 (main, Feb 12 2023, 12:17:23) [GCC 11.3.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65]
py38-proto3-opentelemetry-exporter-otlp-proto-grpc: 262 D discover PATH[0]=/home/tigre/.pyenv/versions/3.11.2/bin [virtualenv/discovery/builtin.py:111]
py38-proto3-opentelemetry-exporter-otlp-proto-grpc: 262 D got python info of %s from (PosixPath('/home/tigre/.pyenv/versions/3.11.2/bin/python3'), PosixPath('/home/tigre/.local/share/virtualenv/py_info/1/e50
@ocelotl
ocelotl / configuration_proposal.rst
Last active March 11, 2024 16:06
Configuration Proposal

TLDR

We have been mixing up two things that are actually separate:

  1. The pipeline configuration (the creation of providers, meters, etc.) This should take its values from a YAML configuration file.
  2. The configuration of the SDK (using a Configuration object) This should take its values from environment variables only.
@ocelotl
ocelotl / ieee_754.py
Created October 13, 2022 12:28
Function that converts floating point values into their IEEE 754 representation
from ctypes import c_double, c_uint64
from decimal import Decimal
from unittest import TestCase
def get_ieee_754_representation(value: float):
"""
The purpose of this function is to illustrate the IEEE 754 64-bit float
representation.
Traceback (most recent call last):
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/site-packages/scalene/scalene_profiler.py", line 1525, in main
exec(code, the_globals, the_locals)
File "opentelemetry-sdk/tests/performance/resource-usage/trace/test_resource_usage_simple_export.py", line 18, in <module>
from opentelemetry.exporter.otlp.trace_exporter import OTLPSpanExporter
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/site-packages/opentelemetry/exporter/otlp/trace_exporter/__init__.py", line 46, in <module>
from opentelemetry.sdk.trace import Span as SDKSpan
File "/home/ocelotl/.pyenv/versions/3.8.3/lib/python3.8/site-packages/opentelemetry/sdk/trace/__init__.py", line 45, in <module>
from opentelemetry.trace import SpanContext, sampling
ImportError: cannot import name 'sampling' from 'opentelemetry.trace' (/home/ocelotl/sandbox/test_entry_points/opentelemetry-api/src/opentelemetry/trace/__init__.py)
@ocelotl
ocelotl / auto_instrumentation.rst
Last active March 2, 2020 17:43
Python Auto Instrumentation Design Specification

Overview

Auto instrumentation is a mechanism to produce the telemetry data of an uninstrumented application without modifying the original application code itself. It relies on patching libraries utilized by the application and running the application via a command line script:

auto-instrumentation-command python3 uninstrumented_program.py

When uninstrumented_program.py is run in this way, it displays the results like it had been instrumented beforehand. The practical benefit of auto instrumentation is of course to make it possible for the end user to save time and effort by not having to instrument existing code.

Example

# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#