Skip to content

Commit

Permalink
fix: rename scopeOrgID to tenantID (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
korniltsev authored May 19, 2023
1 parent 7c79dda commit 85fcff2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
26 changes: 13 additions & 13 deletions agent/src/main/java/io/pyroscope/javaagent/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class Config {
private static final String PYROSCOPE_ALLOC_LIVE = "PYROSCOPE_ALLOC_LIVE";
private static final String PYROSCOPE_GC_BEFORE_DUMP = "PYROSCOPE_GC_BEFORE_DUMP";
private static final String PYROSCOPE_HTTP_HEADERS = "PYROSCOPE_HTTP_HEADERS";
private static final String PYROSCOPE_SCOPE_ORGID = "PYROSCOPE_SCOPE_ORGID";
private static final String PYROSCOPE_TENANT_ID = "PYROSCOPE_TENANT_ID";

/**
* Experimental feature, may be removed in the future
Expand Down Expand Up @@ -100,7 +100,7 @@ public final class Config {

public final Map<String, String> httpHeaders;
public final Duration samplingDuration;
public final String scopeOrgID;
public final String tenantID;
public final String APLogLevel;
public final String APExtraArguments;
public final String basicAuthUser;
Expand All @@ -125,7 +125,7 @@ public final class Config {
boolean gcBeforeDump,
Map<String, String> httpHeaders,
Duration samplingDuration,
String scopeOrgID,
String tenantID,
String APLogLevel,
String APExtraArguments,
String basicAuthUser,
Expand All @@ -146,7 +146,7 @@ public final class Config {
this.gcBeforeDump = gcBeforeDump;
this.httpHeaders = httpHeaders;
this.samplingDuration = samplingDuration;
this.scopeOrgID = scopeOrgID;
this.tenantID = tenantID;
this.APLogLevel = APLogLevel;
this.APExtraArguments = APExtraArguments;
this.basicAuthUser = basicAuthUser;
Expand Down Expand Up @@ -185,7 +185,7 @@ public String toString() {
", allocLive=" + allocLive +
", httpHeaders=" + httpHeaders +
", samplingDuration=" + samplingDuration +
", scopeOrgId=" + scopeOrgID +
", tenantID=" + tenantID +
'}';
}

Expand Down Expand Up @@ -230,7 +230,7 @@ public static Config build(ConfigurationProvider cp) {
bool(cp, PYROSCOPE_GC_BEFORE_DUMP, DEFAULT_GC_BEFORE_DUMP),
httpHeaders(cp),
samplingDuration(cp),
scopeOrgID(cp),
tenantID(cp),
cp.get(PYROSCOPE_AP_LOG_LEVEL_CONFIG),
cp.get(PYROSCOPE_AP_EXTRA_ARGUMENTS_CONFIG),
cp.get(PYROSCOPE_BASIC_AUTH_USER_CONFIG),
Expand Down Expand Up @@ -490,8 +490,8 @@ public static Map<String, String> httpHeaders(ConfigurationProvider cp) {
}
}

private static String scopeOrgID(ConfigurationProvider cp) {
return cp.get(PYROSCOPE_SCOPE_ORGID);
private static String tenantID(ConfigurationProvider cp) {
return cp.get(PYROSCOPE_TENANT_ID);
}

private static Duration samplingDuration(ConfigurationProvider configurationProvider) {
Expand Down Expand Up @@ -554,7 +554,7 @@ public static class Builder {
public Map<String, String> httpHeaders = new HashMap<>();
public Duration samplingDuration = DEFAULT_SAMPLING_DURATION;

private String scopeOrgID = null;
private String tenantID = null;
private String APLogLevel = null;
private String APExtraArguments = null;
private String basicAuthUser;
Expand All @@ -581,7 +581,7 @@ public Builder(Config buildUpon) {
gcBeforeDump = buildUpon.gcBeforeDump;
httpHeaders = new HashMap<>(buildUpon.httpHeaders);
samplingDuration = buildUpon.samplingDuration;
scopeOrgID = buildUpon.scopeOrgID;
tenantID = buildUpon.tenantID;
APLogLevel = buildUpon.APLogLevel;
APExtraArguments = buildUpon.APExtraArguments;
basicAuthUser = buildUpon.basicAuthUser;
Expand Down Expand Up @@ -688,8 +688,8 @@ public Builder setSamplingDuration(Duration samplingDuration) {
return this;
}

public Builder setScopeOrgID(String scopeOrgID) {
this.scopeOrgID = scopeOrgID;
public Builder setTenantID(String tenantID) {
this.tenantID = tenantID;
return this;
}

Expand Down Expand Up @@ -735,7 +735,7 @@ public Config build() {
gcBeforeDump,
httpHeaders,
samplingDuration,
scopeOrgID,
tenantID,
APLogLevel,
APExtraArguments,
basicAuthUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.time.Duration;
import java.time.Instant;
import java.util.Random;
import java.util.function.BiConsumer;
import java.util.zip.Deflater;

public class PyroscopeExporter implements Exporter {
Expand Down Expand Up @@ -113,8 +112,8 @@ private void uploadSnapshot(final Snapshot snapshot) throws InterruptedException
}

private static void addAuthHeader(Request.Builder request, HttpUrl url, Config config) {
if (config.scopeOrgID != null && !config.scopeOrgID.isEmpty()) {
request.header("X-Scope-OrgID", config.scopeOrgID);
if (config.tenantID != null && !config.tenantID.isEmpty()) {
request.header("X-Scope-OrgID", config.tenantID);
}
if (config.authToken != null && !config.authToken.isEmpty()) {
request.header("Authorization", "Bearer " + config.authToken);
Expand Down

0 comments on commit 85fcff2

Please sign in to comment.