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

/config/memcache endpoint #54

Merged
merged 5 commits into from
Sep 11, 2017
Merged

Conversation

miguelff
Copy link
Contributor

@miguelff miguelff commented Sep 7, 2017

Freno clients can use Freno's memcache configuration at runtime to implement smarter strategies to access replication delay. This PR extends freno's HTTP API to provide the GET /config/memcache service, which returns the json representation of the memcache configuration in use:

{
  "MemcacheServers": [
    "memcache.server.one:11211",
    "memcache.server.two:11211",
    "memcache.server.three:11211"
  ],
  "MemcachePath": "freno-production",
}

If freno is not configured to publish metrics to memcache, the following defaults will be returned:

{
  "MemcacheServers": [],
  "MemcachePath": "freno",
}

@@ -101,6 +101,8 @@ Notes:

- `/help`: show all supported request paths

- `/config/memcache`: show the [memcache](memcache.md) configuration used, so freno clients can use it to implement more efficient read strategies.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"MemcacheServers": [],
"MemcachePath": "freno",
}
```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(memcacheConfig)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -119,5 +119,8 @@ func (settings *ConfigurationSettings) postReadAdjustments() error {
if err := settings.Stores.postReadAdjustments(); err != nil {
return err
}
if settings.MemcachePath == "" {
settings.MemcachePath = "freno"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@miguelff miguelff changed the base branch from memcache-key-prefix to master September 11, 2017 14:04
@miguelff miguelff temporarily deployed to production September 11, 2017 15:14 Inactive
@miguelff miguelff merged commit 2a98f7f into github:master Sep 11, 2017
@miguelff miguelff deleted the memcache-config-endpoint branch September 11, 2017 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants