Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mero #2

Merged
merged 12 commits into from
Nov 23, 2020
Merged
51 changes: 19 additions & 32 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
name: "Code Scanning - Action"

on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
branches: [ master ]
pull_request:
branches:
- master
branches: [ master ]
schedule:
- cron: '0 0 * * 0'
- cron: '31 6 * * 1'

jobs:
CodeQL-Build:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: true


# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest
fail-fast: false
matrix:
language: [ 'go', 'python' ]
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
Expand All @@ -29,25 +26,15 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
#- name: Autobuild
# uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
33 changes: 19 additions & 14 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Use Go ^1.14.x
uses: actions/setup-go@v2
with:
go-version: ^1.14.x

- name: Add GOPATH to GITHUB_ENV
run: echo "GOPATH=$(go env GOPATH)" >>"$GITHUB_ENV"

- name: Add GOPATH to GITHUB_PATH
run: echo "$GOPATH/bin" >>"$GITHUB_PATH"

- name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@v1
with:
go-version: "^1.14.x"
- run: go version
# Runs a set of commands to initialize and analyze with FOSSA
- name: run FOSSA analysis
env:
# FOSSA Push-Only API Token
FOSSA_API_KEY: '304657e2357ba57b416b94e6b119131b'
run: |
export GOPATH=$HOME/go
export PATH=$PATH:$(go env GOPATH)/bin
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | bash
fossa init
fossa analyze
fossa-api-key: 304657e2357ba57b416b94e6b119131b
github-token: ${{ github.token }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ examples/memstore-plugin/memstore-plugin
cmd/all-in-one/all-in-one-*
cmd/agent/agent
cmd/agent/agent-*
cmd/anonymizer/anonymizer
cmd/anonymizer/anonymizer-*
cmd/collector/collector
cmd/collector/collector-*
cmd/ingester/ingester
Expand Down
43 changes: 42 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,50 @@
Changes by Version
==================

1.21.0 (unreleased)
1.22.0 (unreleased)
-------------------

1.21.0 (2020-11-13)
-------------------

### Backend Changes

#### New Features

* Add trace anonymizer utility ([#2621](https://github.com/jaegertracing/jaeger/pull/2621), [#2585](https://github.com/jaegertracing/jaeger/pull/2585), [@Ashmita152](https://github.com/Ashmita152))
* Add URL option for sampling strategies file ([#2519](https://github.com/jaegertracing/jaeger/pull/2519), [@goku321](https://github.com/goku321))
* Expose tunning options via expvar ([#2496](https://github.com/jaegertracing/jaeger/pull/2496), [@dstdfx](https://github.com/dstdfx))
* Support more encodings for Kafka in OTel Ingester ([#2580](https://github.com/jaegertracing/jaeger/pull/2580), [@XSAM](https://github.com/XSAM))
* Create debug docker images for jaeger backends ([#2545](https://github.com/jaegertracing/jaeger/pull/2545), [@Ashmita152](https://github.com/Ashmita152))
* Display backend & UI versions in Jaeger UI
* Inject version info into index.html ([#2547](https://github.com/jaegertracing/jaeger/pull/2547), [@yurishkuro](https://github.com/yurishkuro))
* Added jaeger ui version to about menu ([#606](https://github.com/jaegertracing/jaeger-ui/pull/606), [@alanisaac](https://github.com/alanisaac))

#### Bug fixes, Minor Improvements

* Update x/text to v0.3.4 ([#2625](https://github.com/jaegertracing/jaeger/pull/2625), [@objectiser](https://github.com/objectiser))
* Update CodeQL to latest best practices ([#2615](https://github.com/jaegertracing/jaeger/pull/2615), [@jhutchings1](https://github.com/jhutchings1))
* Bump opentelemetry-collector to v0.14.0 ([#2617](https://github.com/jaegertracing/jaeger/pull/2617), [@Vemmy124](https://github.com/Vemmy124))
* Bump Badger to v1.6.2 ([#2613](https://github.com/jaegertracing/jaeger/pull/2613), [@Ackar](https://github.com/Ackar))
* Fix sarama consumer deadlock ([#2587](https://github.com/jaegertracing/jaeger/pull/2587), [@albertteoh](https://github.com/albertteoh))
* Avoid deadlock if Stop is called before Serve ([#2608](https://github.com/jaegertracing/jaeger/pull/2608), [@chlunde](https://github.com/chlunde))
* Return buffers to pool on network errors or queue overflow ([#2609](https://github.com/jaegertracing/jaeger/pull/2609), [@chlunde](https://github.com/chlunde))
* Clarify deadlock panic message ([#2605](https://github.com/jaegertracing/jaeger/pull/2605), [@yurishkuro](https://github.com/yurishkuro))
* fix: don't create tags w/ empty name for internal zipkin spans ([#2596](https://github.com/jaegertracing/jaeger/pull/2596), [@mzahor](https://github.com/mzahor))
* TBufferedServer: Avoid channel close/send race on Stop ([#2583](https://github.com/jaegertracing/jaeger/pull/2583), [@chlunde](https://github.com/chlunde))
* Bumped OpenTelemetry Collector to v0.12.0 ([#2562](https://github.com/jaegertracing/jaeger/pull/2562), [@jpkrohling](https://github.com/jpkrohling))
* Disable Zipkin server if port/address is not configured ([#2554](https://github.com/jaegertracing/jaeger/pull/2554), [@yurishkuro](https://github.com/yurishkuro))
* [hotrod] Add links to traces ([#2536](https://github.com/jaegertracing/jaeger/pull/2536), [@yurishkuro](https://github.com/yurishkuro))
* OTel Cassandra/Elasticsearch Exporter queue defaults ([#2533](https://github.com/jaegertracing/jaeger/pull/2533), [@joe-elliott](https://github.com/joe-elliott))
* [otel] Update jaeger-lib to v2.4.0 ([#2538](https://github.com/jaegertracing/jaeger/pull/2538), [@dstdfx](https://github.com/dstdfx))
* Remove unnecessary ServiceName index seek if tags query is available ([#2535](https://github.com/jaegertracing/jaeger/pull/2535), [@burmanm](https://github.com/burmanm))
* Update static UI assets path in contrib doc ([#2548](https://github.com/jaegertracing/jaeger/pull/2548), [@albertteoh](https://github.com/albertteoh))

### UI Changes

* UI pinned to version 1.12.0. The changelog is available here [v1.12.0](https://github.com/jaegertracing/jaeger-ui/blob/master/CHANGELOG.md#v1120-november-14-2020)


1.20.0 (2020-09-29)
-------------------

Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ build-examples:
build-tracegen:
$(GOBUILD) -o ./cmd/tracegen/tracegen-$(GOOS)-$(GOARCH) ./cmd/tracegen/main.go

.PHONY: build-anonymizer
build-anonymizer:
$(GOBUILD) -o ./cmd/anonymizer/anonymizer-$(GOOS)-$(GOARCH) ./cmd/anonymizer/main.go

.PHONY: docker-hotrod
docker-hotrod:
GOOS=linux $(MAKE) build-examples
Expand Down Expand Up @@ -317,6 +321,7 @@ build-platform-binaries: build-agent \
build-all-in-one \
build-examples \
build-tracegen \
build-anonymizer \
build-otel-collector \
build-otel-agent \
build-otel-ingester \
Expand Down Expand Up @@ -360,12 +365,18 @@ docker-images-tracegen:
docker build -t $(DOCKER_NAMESPACE)/jaeger-tracegen:${DOCKER_TAG} cmd/tracegen/ --build-arg TARGETARCH=$(GOARCH)
@echo "Finished building jaeger-tracegen =============="

.PHONY: docker-images-anonymizer
docker-images-anonymizer:
docker build -t $(DOCKER_NAMESPACE)/jaeger-anonymizer:${DOCKER_TAG} cmd/anonymizer/ --build-arg TARGETARCH=$(GOARCH)
@echo "Finished building jaeger-anonymizer =============="

.PHONY: docker-images-only
docker-images-only: docker-images-cassandra \
docker-images-elastic \
docker-images-jaeger-backend \
docker-images-jaeger-backend-debug \
docker-images-tracegen
docker-images-tracegen \
docker-images-anonymizer

.PHONY: docker-push
docker-push:
Expand All @@ -375,7 +386,7 @@ docker-push:
if [ $$CONFIRM != "y" ] && [ $$CONFIRM != "Y" ]; then \
echo "Exiting." ; exit 1 ; \
fi
for component in agent cassandra-schema es-index-cleaner es-rollover collector query ingester example-hotrod tracegen; do \
for component in agent cassandra-schema es-index-cleaner es-rollover collector query ingester example-hotrod tracegen anonymizer; do \
docker push $(DOCKER_NAMESPACE)/jaeger-$$component ; \
done

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func withRunningAgent(t *testing.T, testcase func(string, chan error)) {
},
},
HTTPServer: HTTPServerConfiguration{
HostPort: ":0",
HostPort: "127.0.0.1:0",
},
}
logger, logBuf := testutils.NewLogger()
Expand Down
5 changes: 5 additions & 0 deletions cmd/anonymizer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
ARG TARGETARCH=amd64

COPY anonymizer-linux-$TARGETARCH /go/bin/anonymizer-linux
ENTRYPOINT ["/go/bin/anonymizer-linux"]
32 changes: 19 additions & 13 deletions cmd/anonymizer/app/anonymizer/anonymizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,32 @@ type mapping struct {
//
// The mapping from original to obfuscated strings is stored in a file and can be reused between runs.
type Anonymizer struct {
mappingFile string
logger *zap.Logger
lock sync.Mutex
mapping mapping
hashStandardTags bool
hashCustomTags bool
hashLogs bool
hashProcess bool
mappingFile string
logger *zap.Logger
lock sync.Mutex
mapping mapping
options Options
}

// Options represents the various options with which the anonymizer can be configured.
type Options struct {
HashStandardTags bool `yaml:"hash_standard_tags" name:"hash_standard_tags"`
HashCustomTags bool `yaml:"hash_custom_tags" name:"hash_custom_tags"`
HashLogs bool `yaml:"hash_logs" name:"hash_logs"`
HashProcess bool `yaml:"hash_process" name:"hash_process"`
}

// New creates new Anonymizer. The mappingFile stores the mapping from original to
// obfuscated strings, in case later investigations require looking at the original traces.
func New(mappingFile string, logger *zap.Logger) *Anonymizer {
func New(mappingFile string, options Options, logger *zap.Logger) *Anonymizer {
a := &Anonymizer{
mappingFile: mappingFile,
logger: logger,
mapping: mapping{
Services: make(map[string]string),
Operations: make(map[string]string),
},
options: options,
}
if _, err := os.Stat(filepath.Clean(mappingFile)); err == nil {
dat, err := ioutil.ReadFile(filepath.Clean(mappingFile))
Expand Down Expand Up @@ -142,18 +148,18 @@ func (a *Anonymizer) AnonymizeSpan(span *model.Span) *uimodel.Span {

outputTags := filterStandardTags(span.Tags)
// when true, the allowedTags are hashed and when false they are preserved as it is
if a.hashStandardTags {
if a.options.HashStandardTags {
outputTags = hashTags(outputTags)
}
// when true, all tags other than allowedTags are hashed, when false they are dropped
if a.hashCustomTags {
if a.options.HashCustomTags {
customTags := hashTags(filterCustomTags(span.Tags))
outputTags = append(outputTags, customTags...)
}
span.Tags = outputTags

// when true, logs are hashed, when false, they are dropped
if a.hashLogs {
if a.options.HashLogs {
for _, log := range span.Logs {
log.Fields = hashTags(log.Fields)
}
Expand All @@ -164,7 +170,7 @@ func (a *Anonymizer) AnonymizeSpan(span *model.Span) *uimodel.Span {
span.Process.ServiceName = a.mapServiceName(service)

// when true, process tags are hashed, when false they are dropped
if a.hashProcess {
if a.options.HashProcess {
span.Process.Tags = hashTags(span.Process.Tags)
} else {
span.Process.Tags = nil
Expand Down
20 changes: 12 additions & 8 deletions cmd/anonymizer/app/anonymizer/anonymizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ func TestAnonymizer_AnonymizeSpan_AllTrue(t *testing.T) {
Services: make(map[string]string),
Operations: make(map[string]string),
},
hashStandardTags: true,
hashCustomTags: true,
hashProcess: true,
hashLogs: true,
options: Options{
HashStandardTags: true,
HashCustomTags: true,
HashProcess: true,
HashLogs: true,
},
}
_ = anonymizer.AnonymizeSpan(span1)
assert.Equal(t, 3, len(span1.Tags))
Expand All @@ -120,10 +122,12 @@ func TestAnonymizer_AnonymizeSpan_AllFalse(t *testing.T) {
Services: make(map[string]string),
Operations: make(map[string]string),
},
hashStandardTags: false,
hashCustomTags: false,
hashProcess: false,
hashLogs: false,
options: Options{
HashStandardTags: false,
HashCustomTags: false,
HashProcess: false,
HashLogs: false,
},
}
_ = anonymizer.AnonymizeSpan(span2)
assert.Equal(t, 2, len(span2.Tags))
Expand Down
Loading