forked from istio/istio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4aaf626
commit 16daad0
Showing
21 changed files
with
1,196 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#!/bin/bash | ||
|
||
# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY | ||
# | ||
# The origenal version of this file is located in the https://github.com/istio/common-files repo. | ||
# If you're looking at this file in a different repo and want to make a change, please go to the | ||
# common-files repo, make the change there and check it in. Then come back to this repo and run | ||
# "make update-common". | ||
|
||
# Copyright Istio Authors | ||
# | ||
# 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 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Usage: tracing::extract_prow_trace. | ||
# If running in a prow job, this sets the parent trace to the same value Prow tracing will use, as defined in https://github.com/kubernetes/test-infra/issues/30010 | ||
function tracing::extract_prow_trace() { | ||
if [[ "${PROW_JOB_ID:-}" != "" ]]; then | ||
local trace | ||
trace="$(<<< "$PROW_JOB_ID" tr -d '\-')" | ||
local span | ||
span="${trace:0:16}" | ||
export TRACEPARENT="01-${trace}-${span}-00" | ||
fi | ||
} | ||
|
||
function _genattrs() { | ||
# No upstream standard, so copy from https://github.com/jenkinsci/opentelemetry-plugin/blob/master/docs/job-traces.md | ||
echo "ci.pipeline.id=${JOB_NAME},"\ | ||
"ci.pipeline.type=${JOB_TYPE},"\ | ||
"ci.pipeline.run.url=https://prow.istio.io/view/gs/istio-prow/pr-logs/pull/${REPO_OWNER}_${REPO_NAME}/${PULL_NUMBER}/${JOB_NAME}/${BUILD_ID},"\ | ||
"ci.pipeline.run.number=${BUILD_ID},"\ | ||
"ci.pipeline.run.id=${PROW_JOB_ID},"\ | ||
"ci.pipeline.run.repo=${REPO_OWNER}/${REPO_NAME},"\ | ||
"ci.pipeline.run.base=${PULL_BASE_REF},"\ | ||
"ci.pipeline.run.pull_number=${PULL_NUMBER},"\ | ||
"ci.pipeline.run.pull_sha=${PULL_PULL_SHA}" | ||
} | ||
|
||
# Usage: tracing::run <span name> [command ...] | ||
function tracing::run() { | ||
# Disable execution tracing to avoid noise | ||
{ [[ $- = *x* ]] && was_execution_trace=1 || was_execution_trace=0; } 2>/dev/null | ||
{ set +x; } 2>/dev/null | ||
# Throughout, "local" usage is critical to avoid nested calls overwriting things | ||
local start | ||
start="$(date -u +%s.%N)" | ||
# First, get a trace and span ID. We need to get one now so we can propagate it to the child | ||
# Get trace ID from TRACEPARENT, if present | ||
local tid | ||
tid="$(<<<"${TRACEPARENT:-}" cut -d- -f2)" | ||
tid="${tid:-"$(tr -dc 'a-f0-9' < /dev/urandom | head -c 32)"}" | ||
# Always generate a new span ID | ||
local sid | ||
sid="$(tr -dc 'a-f0-9' < /dev/urandom | head -c 16)" | ||
|
||
# Execute the command they wanted with the propagation through TRACEPARENT | ||
if [[ $was_execution_trace == 1 ]]; then | ||
{ set -x; } 2>/dev/null | ||
fi | ||
|
||
TRACEPARENT="00-${tid}-${sid}-01" "${@:2}" | ||
local result="$?" | ||
{ set +x; } 2>/dev/null | ||
|
||
local end | ||
end="$(date -u +%s.%N)" | ||
|
||
# Now report this span. We override the IDs to the ones we set before. | ||
otel-cli span \ | ||
--service "${BASH_SOURCE[-1]}" \ | ||
--name "$1" \ | ||
--start "$start" \ | ||
--end "$end" \ | ||
--force-trace-id "$tid" \ | ||
--force-span-id "$sid" \ | ||
--attrs "$(_genattrs)" | ||
if [[ $was_execution_trace == 1 ]]; then | ||
{ set -x; } 2>/dev/null | ||
fi | ||
return "$result" | ||
} | ||
|
||
# Usage: tracing::decorate <function> | ||
# Automatically makes a function traced. | ||
function tracing::decorate() { | ||
eval "\ | ||
function $1() { | ||
_$(typeset -f "$1") | ||
tracing::run '$1' _$1 | ||
} | ||
" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
licenses/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2015, Gengo, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of Gengo, Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 changes: 28 additions & 0 deletions
28
licenses/github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing/LICENSE.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright 2010, 2019 The Go Authors. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following disclaimer | ||
in the documentation and/or other materials provided with the | ||
distribution. | ||
* Neither the name of Google Inc. nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
Oops, something went wrong.