krzko / opentelemetry-shell Goto Github PK
View Code? Open in Web Editor NEW๐ฆ OpenTelemetry functions for shells
License: Apache License 2.0
๐ฆ OpenTelemetry functions for shells
License: Apache License 2.0
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Google Cloud Build pipelines. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Github Actions workflow-specific information, such as;
Spec - https://cloud.google.com/build/docs/build-config-file-schema
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Harness pipelines. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Harness pipeline-specific information, such as;
Some vendors require API keys to be passed as headers (curl -H) via POST requests, need to cater for this scenario
ie export LIGHTSTEP_ACCESS_TOKEN='lightstep-access-token: foo'
A variable to check that exists, with a an associated format. Pass in to the net_client_post()
Need to remove the opinionated references to /v1/traces
and /v1/metrics
.
The library currently supports OTLP (HTTP), but would be nice to support OTLP (gRPC) aswell. Investigate utilising grpcurl
for this uplift.
Utilise the OTEL protos to then sent unary request via grpcurl
To allow for seamless tracing to take place it would be nice to allow traces to take place behind the scenes, without too much user interaction ala the Jenkins OTEL plugin.
name: otel-sh-action-example
on: [push]
jobs:
awesome-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: krzko/opentelemetry-shell-action@v1
with:
otlp-exporter-otel-endpoint: 'https://otel.awesomedomain.com:443'
- run: docker ...
- run: gcloud ...
To help in distribution, brew
should be utilised.
Make the solution brew install
compliant
(I love this issue template)
I'm always frustrated when something overwrites my service.name
. actually, the change introduced in #51 (to append the service.name
optionally) is probably not that useful. shortly after, I've noticed that "someone else" is now overwriting my globally defined service.name
with the bash script name.
that is, in my opinion, also not compliant with the documentation. because the global variable literally just gets thrown away.
I don't know if this was a design goal. but, I'd suggest to add explicit properties instead: "if you're a bash script and this property is true, add your name" or "if you are a gitlab pipeline and that (another) property is true, add your name".
(like I did in #51)
this way, nobody overwrites my globally defined service.name
. on the other hand, the order of the (internal) scripts will then matter, as just the very first one will add its service name. when the code reaches the other ones, it's already done.
opinions @krzko?
The default variable OTEL_SERVICE_NAME
configures the resource attribute service.name
. that's fine, but you're setting a default value when non is present. according to the spec this value is required, so I think it would be good to fail if this is not present.
second, I think that the library should respect the environment variables OTEL_SERVICE_VERSION
and OTEL_SERVICE_NAMESPACE
. it is already looking at service_version
, then adding this into resource attribute service.version
. I think, it would make sense to respect OTEL_SERVICE_VERSION
(for service.version
), as well as OTEL_SERVICE_NAMESPACE
(for service.namespace
).
let me know what you think of it @krzko, I could of course contribute the change.
Crazy idea: I don't know whether this is in-scope for your project, or whether I should build it myself, but yours feels like the most similar project to what I'm imagining, so I thought I'd ask anyway.
At work, we have a bunch of complicated scripts in our package.json, and they depend on each other in nontrivial ways. Running yarn build
will spawn a handful of codegen tasks in a carefully orchestrated manner, with a bunch of parallel tasks specified manually using the concurrently
js package. It's like make
but strictly worse. I want to rip it out and replace it with something that has an explicit concept of dependencies, and can avoid duplicated work. I've been putting off wrapping my head around the problem because I don't have a good way to visualise it at the moment.
I recently discovered (via https://stackoverflow.com/a/58188828) that if you run yarn config set script-shell $PATH_TO_WRAPPER_SCRIPT
then you can change which shell runs your scripts.
I was thinking that I could make a tiny go/rust/typescript/bash program that:
sh -c "$BODY_OF_SCRIPT"
)sh -c "$BODY_OF_SCRIPT"
sh
If I had this then I would be able to visualise the existing build process, and the whole thing would be a bit less scary.
a) Does the opentelemetry-shell project support linking parent/child relationships between shortlived child shells using environment variables?
b) If I built my idea using opentelemetry-shell, would you be interested in accepting it as an example in this repo?
Thinking about it, having a README that says docker run $PORT_FORWARDING_OR_WHATEVER zipkin
in one tab and yarn config set script-shell /path/to/shelemetry && yarn build && yarn config delete script-shell && open https://localhost:$ZIPKIN_GUI_PORT/
then it will be easy for people to get started with it with no additional setup or dependencies.
hi there! great lib, I wanted to use it for monitoring some bash scripts behavior. however, running the README.md
traces sample ends up in an error in plain bash Docker runtime:
./spam.sh
_____ _____ _____ _____ _____ _____ __ _____ _____ _____ _____ _____ __ __
| | _ | __| | |_ _| __| | | __| | __|_ _| __ | | |
| | | __| __| | | | | | | __| |__| __| | | | __| | | | -|_ _|
|_____|__| |_____|_|___| |_| |_____|_____|_____|_|_|_|_____| |_| |__|__| |_|
_____ _____ _____ __ __
| __| | | __| | | |
|__ | | __| |__| |__
|_____|__|__|_____|_____|_____|
2022-10-04 15:41:58 [INFO] [spam.sh#L43] [source()] Initialising OpenTelemetry Shell v0.0.8
/appl/otello/opentelemetry-shell/library/time.sh: line 34: EPOCHREALTIME: unbound variable
2022-10-04 15:41:58 [INFO] [spam.sh#L10] [sleep_for()] Sleeping for 1 sec...
/appl/otello/opentelemetry-shell/library/time.sh: line 34: EPOCHREALTIME: unbound variable
2022-10-04 15:41:59 [ERROR] [spam.sh#L41] [net_client_post()] The requested URL returned an error: https://[OMITTED]/v1/traces
it looks like $EPOCHREALTIME
was not expanded properly.
Steps to reproduce the behavior:
main
(btw you didn't tag v0.0.8
yet)since I do not have the $EPOCHREALTIME
defined, it should use date instead.
see bash output above.
curl
, git
, hostname
and jq
If $GITHUB_WORKFLOW includes special character the metric push will fail
Steps to reproduce the behavior:
To sanitise this and become valid to post to OTEL receiver
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Github Actions workflows. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Github Actions workflow-specific information, such as;
Check for $GITHUB_ACTIONS: true
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Gitlab CI/CD. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Github Actions workflow-specific information, such as;
CI_SERVER_NAME="GitLab"
?A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Jenkins pipelines. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Jenkins pipeline-specific information, such as;
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The resource detection functions should detect resource information from the underlying CI/CD system, in this case, Github Actions workflows. It should append or override the resource value in telemetry data with this information.
A basis for this work is following the OTEL Collector resource detection processor.
Append/add Github Actions workflow-specific information, such as;
Specs - https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html
OTEL_EXPORTER_OTEL_ENDPOINT dosn't exist
OTEL_EXPORTER_OTLP_ENDPOINT is used
Please change everywhere, including Readme
Suppose a detector recognises the CI/CD system its running on. In that case, it should pupulate the service.name
attribute and strive to create parent relationships to associated steps, with the command being child dependencies.
To ensure the releases are of high quality, run shellcheck to lint all *.sh
files.
Apply check during CI:
-f warn
Figure out a solution for traces that span child function calls, suggest a trace context
The span name is currently the second argument after a call to otel_trace_start_parent_span
or otel_trace_start_child_span
. This results in abnormally-named spans. For example, the code below would yield a span whose name is the SQLite query:
otel_trace_start_parent_span sqlite3 "SELECT 1;"
This wrong.
Allow me to manually set the name of the span. Just as custom attributes can be set by defining custom_resource_attributes
before calling the function, let me do the same with span_name
.
N/A
N/A
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.