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

Add instrumentation for httpd - Apache HTTP Server #7

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions instrumentation/httpd/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.7.2
58 changes: 58 additions & 0 deletions instrumentation/httpd/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# See Clang docs: http://clang.llvm.org/docs/ClangFormatStyleOptions.html
BasedOnStyle: Chromium

# Allow double brackets such as std::vector<std::vector<int>>.
Standard: Cpp11

# Indent 2 spaces at a time.
IndentWidth: 2

# Keep lines under 100 columns long.
ColumnLimit: 100

# Always break before braces
BreakBeforeBraces: Custom
BraceWrapping:
# TODO(lujc) wait for clang-format-9 support in Chromium tools
# AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false

# Keeps extern "C" blocks unindented.
AfterExternBlock: false

# Indent case labels.
IndentCaseLabels: true

# Right-align pointers and references
PointerAlignment: Right

# ANGLE likes to align things as much as possible.
AlignOperands: true
AlignConsecutiveAssignments: true

# Use 2 space negative offset for access modifiers
AccessModifierOffset: -2

# TODO(jmadill): Decide if we want this on. Doesn't have an "all or none" mode.
AllowShortCaseLabelsOnASingleLine: false

# Useful for spacing out functions in classes
KeepEmptyLinesAtTheStartOfBlocks: true

# Indent nested PP directives.
IndentPPDirectives: AfterHash

# Include blocks style
IncludeBlocks: Preserve
64 changes: 64 additions & 0 deletions instrumentation/httpd/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
name: Build module
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup buildtools
run: |
sudo ./setup-buildtools.sh
sudo ./setup_environment.sh
- name: Compile
run: ./build.sh

clang_format:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup formatting tool (clang)
run: |
sudo ./tools/setup-tools.sh code
- name: Check formatting
run: ./tools/format-code.sh

build_format:
name: Check build formatting
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup formatting tool (buildifier)
run: |
sudo ./tools/setup-tools.sh buildifier
- name: Check formatting
run: ./tools/format-bazel.sh

e2e_tests:
name: Run end-to-end tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup buildtools
run: |
sudo ./tests/setup-tools.sh
sudo ./setup-buildtools.sh
sudo ./setup_environment.sh
- name: Compile
run: ./build.sh
- name: Run tests
run: |
./create-otel-load.sh
sudo ./httpd_install_otel.sh
cd tests && sudo ./run-all.sh
45 changes: 45 additions & 0 deletions instrumentation/httpd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Ref. https://github.com/github/gitignore/blob/master/C%2B%2B.gitignore
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Bazel files
/bazel-*

# Mac
.DS_Store

# Output directories
/out
/out.*
# Indicator that the tools were deployed
.buildtools
11 changes: 11 additions & 0 deletions instrumentation/httpd/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")

package(default_visibility = ["//visibility:public"])

cc_binary(
name = "otel.so",
linkshared = 1,
deps = [
"//src/otel:otelmodlib",
],
)
38 changes: 38 additions & 0 deletions instrumentation/httpd/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:18.04

#########################################
# copy setup stuff from opentelemetry-cpp
#########################################

WORKDIR /setup-ci

ADD setup-buildtools.sh /setup-ci/setup-buildtools.sh

RUN /setup-ci/setup-buildtools.sh

#########################
# now build plugin itself
#########################

ADD setup_environment.sh /setup/setup_environment.sh

RUN /setup/setup_environment.sh

COPY src /root/src
COPY .clang-format /root
COPY tools /root/tools

COPY .bazelversion /root
COPY BUILD /root
COPY WORKSPACE /root

WORKDIR /root
COPY create-otel-load.sh /root
COPY build.sh /root
COPY opentelemetry.conf /root
COPY httpd_install_otel.sh /root
RUN /root/build.sh

# TODO: check apache configuration (apachectl configtest)

# TODO: run tests?
Loading