-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added a static registration mechanism (following the pattern of filters mentioned in the comments on #967) for http tracers. This will likely be expanded to a more general registration mechanism in future work. This PR is part of the work towards solving #967. This commit deprecates the existing HttpFilterConfigFactory filter API in favor of NamedHttpFilterConfigFactory.
- Loading branch information
Showing
43 changed files
with
971 additions
and
294 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
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
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
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
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
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,46 @@ | ||
#include "server/config/http/lightstep_http_tracer.h" | ||
|
||
#include <string> | ||
|
||
#include "common/common/utility.h" | ||
#include "common/tracing/http_tracer_impl.h" | ||
#include "common/tracing/lightstep_tracer_impl.h" | ||
|
||
#include "lightstep/options.h" | ||
#include "lightstep/tracer.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
namespace Configuration { | ||
|
||
Tracing::HttpTracerPtr | ||
LightstepHttpTracerFactory::createHttpTracer(const Json::Object& json_config, | ||
Server::Instance& server, | ||
Upstream::ClusterManager& cluster_manager) { | ||
|
||
Envoy::Runtime::RandomGenerator& rand = server.random(); | ||
|
||
std::unique_ptr<lightstep::TracerOptions> opts(new lightstep::TracerOptions()); | ||
opts->access_token = server.api().fileReadToEnd(json_config.getString("access_token_file")); | ||
StringUtil::rtrim(opts->access_token); | ||
|
||
opts->tracer_attributes["lightstep.component_name"] = server.localInfo().clusterName(); | ||
opts->guid_generator = [&rand]() { return rand.random(); }; | ||
|
||
Tracing::DriverPtr lightstep_driver( | ||
new Tracing::LightStepDriver(json_config, cluster_manager, server.stats(), | ||
server.threadLocal(), server.runtime(), std::move(opts))); | ||
return Tracing::HttpTracerPtr( | ||
new Tracing::HttpTracerImpl(std::move(lightstep_driver), server.localInfo())); | ||
} | ||
|
||
std::string LightstepHttpTracerFactory::name() { return "lightstep"; } | ||
|
||
/** | ||
* Static registration for the lightstep http tracer. @see RegisterHttpTracerFactory. | ||
*/ | ||
static RegisterHttpTracerFactory<LightstepHttpTracerFactory> register_; | ||
|
||
} // Configuration | ||
} // Server | ||
} // Envoy |
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 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
|
||
#include "envoy/server/instance.h" | ||
|
||
#include "server/configuration_impl.h" | ||
|
||
namespace Envoy { | ||
namespace Server { | ||
namespace Configuration { | ||
|
||
/** | ||
* Config registration for the lightstep tracer. @see HttpTracerFactory. | ||
*/ | ||
class LightstepHttpTracerFactory : public HttpTracerFactory { | ||
public: | ||
// HttpTracerFactory | ||
Tracing::HttpTracerPtr createHttpTracer(const Json::Object& json_config, Server::Instance& server, | ||
Upstream::ClusterManager& cluster_manager) override; | ||
|
||
std::string name() override; | ||
}; | ||
|
||
} // Configuration | ||
} // Server | ||
} // Envoy |
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
Oops, something went wrong.