Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
Open
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 .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.6
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ruby:2.7-alpine

RUN apk update && apk add --update --no-cache \
build-base \
git \
libxml2 \
libxslt \
libxml2-dev \
libxslt-dev \
libc-dev \
libgcrypt-dev \
bash \
curl

WORKDIR /lib
RUN gem install bundler:2.1.4 google-protobuf

COPY . .
RUN bundle install
8 changes: 4 additions & 4 deletions bin/generate-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ set -eo pipefail
DIR=`dirname "$0"`
OUTPUT_DIR=$DIR/../lib/apollo-studio-tracing/proto

echo "Removing old client"
rm -f $OUTPUT_DIR/apollo.proto $OUTPUT_DIR/apollo_pb.rb
# echo "Removing old client"
# rm -f $OUTPUT_DIR/apollo.proto $OUTPUT_DIR/apollo_pb.rb

echo "Downloading latest Apollo Protobuf IDL"
curl --silent --output $OUTPUT_DIR/apollo.proto https://raw.githubusercontent.com/apollographql/apollo-server/main/packages/apollo-reporting-protobuf/src/reports.proto
# echo "Downloading latest Apollo Protobuf IDL"
# curl --silent --output $OUTPUT_DIR/apollo.proto https://usage-reporting.api.apollographql.com/proto/reports.proto

echo "Generating Ruby client stubs"
protoc -I $OUTPUT_DIR --ruby_out $OUTPUT_DIR $OUTPUT_DIR/apollo.proto
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3.9'
name: 'apollo-studio-tracing-ruby'
services:
lib:
build: .
volumes:
- '.:/lib'
4 changes: 2 additions & 2 deletions lib/apollo-studio-tracing/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ApolloStudioTracing
module API
extend self

APOLLO_URL = 'https://engine-report.apollodata.com/api/ingress/traces'
APOLLO_URL = 'https://usage-reporting.api.apollographql.com/api/ingress/traces'
APOLLO_URI = ::URI.parse(APOLLO_URL)
UploadAttemptError = Class.new(StandardError)
RetryableUploadAttemptError = Class.new(UploadAttemptError)
Expand All @@ -36,7 +36,7 @@ def upload(report_data, max_attempts:, min_retry_delay_secs:, **options)

def attempt_upload(report_data, compress:, api_key:)
body = compress ? gzip(report_data) : report_data
headers = { 'X-Api-Key' => api_key }
headers = { 'X-Api-Key' => api_key, 'user-agent' => 'ApolloServerPluginUsageReporting', 'accept' => 'application/json' }
headers['Content-Encoding'] = 'gzip' if compress
result = Net::HTTP.post(APOLLO_URI, body, headers)

Expand Down
Loading